MCPcopy Create free account
hub / github.com/apache/httpd / h2_create_request_rec

Function h2_create_request_rec

modules/http2/h2_request.c:374–597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372}
373
374request_rec *h2_create_request_rec(const h2_request *req, conn_rec *c,
375 int no_body)
376{
377 int access_status = HTTP_OK;
378 int is_connect = !ap_cstr_casecmp("CONNECT", req->method);
379
380#if AP_MODULE_MAGIC_AT_LEAST(20120211, 106)
381 request_rec *r = ap_create_request(c);
382#else
383 request_rec *r = my_ap_create_request(c);
384#endif
385
386#if AP_MODULE_MAGIC_AT_LEAST(20120211, 107)
387 assign_headers(r, req, no_body, is_connect);
388 ap_run_pre_read_request(r, c);
389
390 /* Time to populate r with the data we have. */
391 r->request_time = req->request_time;
392 AP_DEBUG_ASSERT(req->authority);
393 if (req->http_status != H2_HTTP_STATUS_UNSET) {
394 access_status = req->http_status;
395 goto die;
396 }
397 else if (is_connect) {
398 /* CONNECT MUST NOT have scheme or path */
399 r->the_request = apr_psprintf(r->pool, "%s %s HTTP/2.0",
400 req->method, req->authority);
401 if (req->scheme) {
402 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(10458)
403 "':scheme: %s' header present in CONNECT request",
404 req->scheme);
405 access_status = HTTP_BAD_REQUEST;
406 goto die;
407 }
408 else if (req->path) {
409 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(10459)
410 "':path: %s' header present in CONNECT request",
411 req->path);
412 access_status = HTTP_BAD_REQUEST;
413 goto die;
414 }
415 }
416 else if (req->protocol) {
417 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(10470)
418 "':protocol: %s' header present in %s request",
419 req->protocol, req->method);
420 access_status = HTTP_BAD_REQUEST;
421 goto die;
422 }
423 else if (h2_config_cgeti(c, H2_CONF_PROXY_REQUESTS)) {
424 if (!req->scheme) {
425 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(10468)
426 "H2ProxyRequests on, but request misses :scheme");
427 access_status = HTTP_BAD_REQUEST;
428 goto die;
429 }
430 if (!req->authority) {
431 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(10469)

Callers 2

c2_processFunction · 0.85

Calls 15

ap_cstr_casecmpFunction · 0.85
ap_create_requestFunction · 0.85
my_ap_create_requestFunction · 0.85
assign_headersFunction · 0.85
h2_config_cgetiFunction · 0.85
ap_parse_request_lineFunction · 0.85
ap_check_request_headerFunction · 0.85
ap_method_number_ofFunction · 0.85
ap_parse_uriFunction · 0.85
ap_post_read_requestFunction · 0.85

Tested by

no test coverage detected