[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-cvs
Subject:    svn commit: r1910686 - /httpd/httpd/trunk/modules/http2/h2_request.c
From:       icing () apache ! org
Date:       2023-06-29 10:15:50
Message-ID: 20230629101550.61DA017B3CE () svn01-us-east ! apache ! org
[Download RAW message or body]

Author: icing
Date: Thu Jun 29 10:15:50 2023
New Revision: 1910686

URL: http://svn.apache.org/viewvc?rev=1910686&view=rev
Log:
mod_http2: when failing a request, make sure the request_rec fields
are populated (best effort) for the response generation since this
might access fields in there.
Respect a http_status already assigned during stream processing
for error generation.


Modified:
    httpd/httpd/trunk/modules/http2/h2_request.c

Modified: httpd/httpd/trunk/modules/http2/h2_request.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_request.c?rev=1910686&r1=1910685&r2=1910686&view=diff
 ==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_request.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_request.c Thu Jun 29 10:15:50 2023
@@ -385,7 +385,11 @@ request_rec *h2_create_request_rec(const
     /* Time to populate r with the data we have. */
     r->request_time = req->request_time;
     AP_DEBUG_ASSERT(req->authority);
-    if (is_connect) {
+    if (req->http_status != H2_HTTP_STATUS_UNSET) {
+        access_status = req->http_status;
+        goto die;
+    }
+    else if (is_connect) {
       /* CONNECT MUST NOT have scheme or path */
         r->the_request = apr_psprintf(r->pool, "%s %s HTTP/2.0",
                                       req->method, req->authority);
@@ -548,6 +552,16 @@ request_rec *h2_create_request_rec(const
     return r;
 
 die:
+    if (!r->method) {
+        /* if we fail early, `r` is not properly initialized for error
+         * processing which accesses fields in message generation.
+         * Make a best effort. */
+        if (!r->the_request) {
+                r->the_request = apr_psprintf(r->pool, "%s %s HTTP/2.0",
+                                      req->method, req->path);
+        }
+        ap_parse_request_line(r);
+    }
     ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, c,
                   "ap_die(%d) for %s", access_status, r->the_request);
     ap_die(access_status, r);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic