summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--include/ap_mmn.h3
-rw-r--r--include/http_protocol.h7
-rw-r--r--modules/http2/h2_request.c54
-rw-r--r--server/protocol.c23
5 files changed, 31 insertions, 58 deletions
diff --git a/CHANGES b/CHANGES
index ab351839f8..dfab7323a9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
-*- coding: utf-8 -*-
Changes with Apache 2.5.0
+ *) core: Split ap_create_request() from ap_read_request(). [Graham Leggett]
+
*) mod_ssl: Don't lose track of the SSL context if the ssl_run_pre_handshake()
hook returns an error. [Graham Leggett]
diff --git a/include/ap_mmn.h b/include/ap_mmn.h
index 9789081d6f..c73c9f21c8 100644
--- a/include/ap_mmn.h
+++ b/include/ap_mmn.h
@@ -506,6 +506,7 @@
* the request_rec, with ap_get_useragent_host()
* 20150222.12 (2.5.0-dev) Add complete_connection hook,
* ap_filter_complete_connection().
+ * 20150222.13 (2.5.0-dev) Add ap_create_request().
*/
#define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
@@ -513,7 +514,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20150222
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 12 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 13 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
diff --git a/include/http_protocol.h b/include/http_protocol.h
index a9a06b0582..581540693f 100644
--- a/include/http_protocol.h
+++ b/include/http_protocol.h
@@ -54,6 +54,13 @@ AP_DECLARE_DATA extern ap_filter_rec_t *ap_old_write_func;
*/
/**
+ * Read an empty request and set reasonable defaults.
+ * @param c The current connection
+ * @return The new request_rec
+ */
+request_rec *ap_create_request(conn_rec *c);
+
+/**
* Read a request and fill in the fields.
* @param c The current connection
* @return The new request_rec
diff --git a/modules/http2/h2_request.c b/modules/http2/h2_request.c
index 18509dfc12..2c22750559 100644
--- a/modules/http2/h2_request.c
+++ b/modules/http2/h2_request.c
@@ -356,58 +356,12 @@ h2_request *h2_request_clone(apr_pool_t *p, const h2_request *src)
request_rec *h2_request_create_rec(const h2_request *req, conn_rec *conn)
{
- request_rec *r;
- apr_pool_t *p;
int access_status = HTTP_OK;
- apr_pool_create(&p, conn->pool);
- apr_pool_tag(p, "request");
- r = apr_pcalloc(p, sizeof(request_rec));
- AP_READ_REQUEST_ENTRY((intptr_t)r, (uintptr_t)conn);
- r->pool = p;
- r->connection = conn;
- r->server = conn->base_server;
-
- r->user = NULL;
- r->ap_auth_type = NULL;
-
- r->allowed_methods = ap_make_method_list(p, 2);
-
- r->headers_in = apr_table_clone(r->pool, req->headers);
- r->trailers_in = apr_table_make(r->pool, 5);
- r->subprocess_env = apr_table_make(r->pool, 25);
- r->headers_out = apr_table_make(r->pool, 12);
- r->err_headers_out = apr_table_make(r->pool, 5);
- r->trailers_out = apr_table_make(r->pool, 5);
- r->notes = apr_table_make(r->pool, 5);
-
- r->request_config = ap_create_request_config(r->pool);
- /* Must be set before we run create request hook */
-
- r->proto_output_filters = conn->output_filters;
- r->output_filters = r->proto_output_filters;
- r->proto_input_filters = conn->input_filters;
- r->input_filters = r->proto_input_filters;
- ap_run_create_request(r);
- r->per_dir_config = r->server->lookup_defaults;
-
- r->sent_bodyct = 0; /* bytect isn't for body */
-
- r->read_length = 0;
- r->read_body = REQUEST_NO_BODY;
-
- r->status = HTTP_OK; /* Until further notice */
- r->header_only = 0;
- r->the_request = NULL;
-
- /* Begin by presuming any module can make its own path_info assumptions,
- * until some module interjects and changes the value.
- */
- r->used_path_info = AP_REQ_DEFAULT_PATH_INFO;
-
- r->useragent_addr = conn->client_addr;
- r->useragent_ip = conn->client_ip;
-
+ request_rec *r = ap_create_request(c);
+
+ r->headers_in = apr_table_clone(r->pool, req->headers);
+
ap_run_pre_read_request(r, conn);
/* Time to populate r with the data we have. */
diff --git a/server/protocol.c b/server/protocol.c
index 6bc597eb6e..c6950a7d44 100644
--- a/server/protocol.c
+++ b/server/protocol.c
@@ -1003,16 +1003,10 @@ AP_DECLARE(void) ap_get_mime_headers(request_rec *r)
apr_brigade_destroy(tmp_bb);
}
-request_rec *ap_read_request(conn_rec *conn)
+request_rec *ap_create_request(conn_rec *conn)
{
request_rec *r;
apr_pool_t *p;
- const char *expect;
- int access_status;
- apr_bucket_brigade *tmp_bb;
- apr_socket_t *csd;
- apr_interval_time_t cur_timeout;
-
apr_pool_create(&p, conn->pool);
apr_pool_tag(p, "request");
@@ -1051,6 +1045,7 @@ request_rec *ap_read_request(conn_rec *conn)
r->read_body = REQUEST_NO_BODY;
r->status = HTTP_OK; /* Until further notice */
+ r->header_only = 0;
r->the_request = NULL;
/* Begin by presuming any module can make its own path_info assumptions,
@@ -1061,6 +1056,20 @@ request_rec *ap_read_request(conn_rec *conn)
r->useragent_addr = conn->client_addr;
r->useragent_ip = conn->client_ip;
+ return r;
+}
+
+request_rec *ap_read_request(conn_rec *conn)
+{
+ const char *expect;
+ int access_status;
+ apr_bucket_brigade *tmp_bb;
+ apr_socket_t *csd;
+ apr_interval_time_t cur_timeout;
+
+
+ request_rec *r = ap_create_request(conn);
+
tmp_bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
ap_run_pre_read_request(r, conn);