"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "mod_http2/h2_request.c" between
mod_http2-1.15.16.tar.gz and mod_http2-1.15.17.tar.gz

About: mod_h[ttp]2 is an Apache httpd module implementing the HTTP2 protocol. It uses nghttp2 as base engine and connects it with the Apache infrastructure. Hint: Module (previous name "mod_h2") now integrated into Apache httpd (since v2.4.17). Experimental release.

h2_request.c  (mod_http2-1.15.16):h2_request.c  (mod_http2-1.15.17)
skipping to change at line 81 skipping to change at line 81
if (!ap_strchr_c(authority, ':') && r->server && r->server->port) { if (!ap_strchr_c(authority, ':') && r->server && r->server->port) {
apr_port_t defport = apr_uri_port_of_scheme(scheme); apr_port_t defport = apr_uri_port_of_scheme(scheme);
if (defport != r->server->port) { if (defport != r->server->port) {
/* port info missing and port is not default for scheme: append */ /* port info missing and port is not default for scheme: append */
authority = apr_psprintf(pool, "%s:%d", authority, authority = apr_psprintf(pool, "%s:%d", authority,
(int)r->server->port); (int)r->server->port);
} }
} }
req = apr_pcalloc(pool, sizeof(*req)); req = apr_pcalloc(pool, sizeof(*req));
req->method = apr_pstrdup(pool, r->method); req->method = apr_pstrdup(pool, r->method);
req->scheme = scheme; req->scheme = scheme;
req->authority = authority; req->authority = authority;
req->path = path; req->path = path;
req->headers = apr_table_make(pool, 10); req->headers = apr_table_make(pool, 10);
req->http_status = H2_HTTP_STATUS_UNSET;
if (r->server) { if (r->server) {
req->serialize = h2_config_rgeti(r, H2_CONF_SER_HEADERS); req->serialize = h2_config_rgeti(r, H2_CONF_SER_HEADERS);
} }
x.pool = pool; x.pool = pool;
x.headers = req->headers; x.headers = req->headers;
x.status = APR_SUCCESS; x.status = APR_SUCCESS;
apr_table_do(set_h1_header, &x, r->headers_in, NULL); apr_table_do(set_h1_header, &x, r->headers_in, NULL);
*preq = req; *preq = req;
skipping to change at line 271 skipping to change at line 272
r->useragent_addr = c->client_addr; r->useragent_addr = c->client_addr;
r->useragent_ip = c->client_ip; r->useragent_ip = c->client_ip;
return r; return r;
} }
#endif #endif
request_rec *h2_request_create_rec(const h2_request *req, conn_rec *c) request_rec *h2_request_create_rec(const h2_request *req, conn_rec *c)
{ {
int access_status = HTTP_OK; int access_status;
const char *rpath;
const char *s;
#if AP_MODULE_MAGIC_AT_LEAST(20150222, 13) #if AP_MODULE_MAGIC_AT_LEAST(20150222, 13)
request_rec *r = ap_create_request(c); request_rec *r = ap_create_request(c);
#else #else
request_rec *r = my_ap_create_request(c); request_rec *r = my_ap_create_request(c);
#endif #endif
r->headers_in = apr_table_clone(r->pool, req->headers); #if AP_MODULE_MAGIC_AT_LEAST(20200331, 3)
ap_run_pre_read_request(r, c); ap_run_pre_read_request(r, c);
/* Time to populate r with the data we have. */ /* Time to populate r with the data we have. */
r->request_time = req->request_time; r->request_time = req->request_time;
r->method = apr_pstrdup(r->pool, req->method); r->the_request = apr_psprintf(r->pool, "%s %s HTTP/2.0",
/* Provide quick information about the request method as soon as known */ req->method, req->path ? req->path : "");
r->method_number = ap_method_number_of(r->method); r->headers_in = apr_table_clone(r->pool, req->headers);
if (r->method_number == M_GET && r->method[0] == 'H') {
r->header_only = 1; /* Start with r->hostname = NULL, ap_check_request_header() will get it
} * form Host: header, otherwise we get complains about port numbers.
rpath = (req->path ? req->path : "");
ap_parse_uri(r, rpath);
r->protocol = (char*)"HTTP/2.0";
r->proto_num = HTTP_VERSION(2, 0);
r->the_request = apr_psprintf(r->pool, "%s %s %s",
r->method, rpath, r->protocol);
/* update what we think the virtual host is based on the headers we've
* now read. may update status.
* Leave r->hostname empty, vhost will parse if form our Host: header,
* otherwise we get complains about port numbers.
*/ */
r->hostname = NULL; r->hostname = NULL;
ap_update_vhost_from_headers(r);
/* we may have switched to another server */
r->per_dir_config = r->server->lookup_defaults;
s = apr_table_get(r->headers_in, "Expect"); /* Validate HTTP/1 request and select vhost. */
if (s && s[0]) { if (!ap_parse_request_line(r) || !ap_check_request_header(r)) {
if (ap_cstr_casecmp(s, "100-continue") == 0) { /* we may have switched to another server still */
r->expecting_100 = 1; r->per_dir_config = r->server->lookup_defaults;
if (req->http_status != H2_HTTP_STATUS_UNSET) {
access_status = req->http_status;
/* Be safe and close the connection */
c->keepalive = AP_CONN_CLOSE;
} }
else { else {
r->status = HTTP_EXPECTATION_FAILED; access_status = r->status;
ap_send_error_response(r, 0);
} }
r->status = HTTP_OK;
goto die;
}
#else
{
const char *s;
r->headers_in = apr_table_clone(r->pool, req->headers);
ap_run_pre_read_request(r, c);
/* Time to populate r with the data we have. */
r->request_time = req->request_time;
r->method = apr_pstrdup(r->pool, req->method);
/* Provide quick information about the request method as soon as known *
/
r->method_number = ap_method_number_of(r->method);
if (r->method_number == M_GET && r->method[0] == 'H') {
r->header_only = 1;
}
ap_parse_uri(r, req->path ? req->path : "");
r->protocol = (char*)"HTTP/2.0";
r->proto_num = HTTP_VERSION(2, 0);
r->the_request = apr_psprintf(r->pool, "%s %s HTTP/2.0",
r->method, req->path ? req->path : "");
/* Start with r->hostname = NULL, ap_check_request_header() will get it
* form Host: header, otherwise we get complains about port numbers.
*/
r->hostname = NULL;
ap_update_vhost_from_headers(r);
/* we may have switched to another server */
r->per_dir_config = r->server->lookup_defaults;
s = apr_table_get(r->headers_in, "Expect");
if (s && s[0]) {
if (ap_cstr_casecmp(s, "100-continue") == 0) {
r->expecting_100 = 1;
}
else {
r->status = HTTP_EXPECTATION_FAILED;
access_status = r->status;
goto die;
}
}
}
#endif
/* we may have switched to another server */
r->per_dir_config = r->server->lookup_defaults;
if (req->http_status != H2_HTTP_STATUS_UNSET) {
access_status = req->http_status;
r->status = HTTP_OK;
/* Be safe and close the connection */
c->keepalive = AP_CONN_CLOSE;
goto die;
} }
/* /*
* Add the HTTP_IN filter here to ensure that ap_discard_request_body * Add the HTTP_IN filter here to ensure that ap_discard_request_body
* called by ap_die and by ap_send_error_response works correctly on * called by ap_die and by ap_send_error_response works correctly on
* status codes that do not cause the connection to be dropped and * status codes that do not cause the connection to be dropped and
* in situations where the connection should be kept alive. * in situations where the connection should be kept alive.
*/ */
ap_add_input_filter_handle(ap_http_input_filter_handle, ap_add_input_filter_handle(ap_http_input_filter_handle,
NULL, r, r->connection); NULL, r, r->connection);
if (access_status != HTTP_OK if ((access_status = ap_run_post_read_request(r))) {
|| (access_status = ap_run_post_read_request(r))) {
/* Request check post hooks failed. An example of this would be a /* Request check post hooks failed. An example of this would be a
* request for a vhost where h2 is disabled --> 421. * request for a vhost where h2 is disabled --> 421.
*/ */
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(03367) ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(03367)
"h2_request: access_status=%d, request_create failed", "h2_request: access_status=%d, request_create failed",
access_status); access_status);
ap_die(access_status, r); goto die;
ap_update_child_status(c->sbh, SERVER_BUSY_LOG, r);
ap_run_log_transaction(r);
r = NULL;
goto traceout;
} }
AP_READ_REQUEST_SUCCESS((uintptr_t)r, (char *)r->method, AP_READ_REQUEST_SUCCESS((uintptr_t)r, (char *)r->method,
(char *)r->uri, (char *)r->server->defn_name, (char *)r->uri, (char *)r->server->defn_name,
r->status); r->status);
return r; return r;
traceout:
die:
ap_die(access_status, r);
/* ap_die() sent the response through the output filters, we must now
* end the request with an EOR bucket for stream/pipeline accounting.
*/
{
apr_bucket_brigade *eor_bb;
#if AP_MODULE_MAGIC_AT_LEAST(20180905, 1)
eor_bb = ap_acquire_brigade(c);
APR_BRIGADE_INSERT_TAIL(eor_bb,
ap_bucket_eor_create(c->bucket_alloc, r));
ap_pass_brigade(c->output_filters, eor_bb);
ap_release_brigade(c, eor_bb);
#else
eor_bb = apr_brigade_create(c->pool, c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(eor_bb,
ap_bucket_eor_create(c->bucket_alloc, r));
ap_pass_brigade(c->output_filters, eor_bb);
apr_brigade_destroy(eor_bb);
#endif
}
r = NULL;
AP_READ_REQUEST_FAILURE((uintptr_t)r); AP_READ_REQUEST_FAILURE((uintptr_t)r);
return r; return NULL;
} }
 End of changes. 12 change blocks. 
48 lines changed or deleted 108 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)