You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2025/07/07 11:53:44 UTC

svn commit: r1927036 - /httpd/httpd/trunk/modules/http2/h2_proxy_session.c

Author: covener
Date: Mon Jul  7 11:53:43 2025
New Revision: 1927036

URL: http://svn.apache.org/viewvc?rev=1927036&view=rev
Log:
tolerate missing host header in h2 proxy

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

Modified: httpd/httpd/trunk/modules/http2/h2_proxy_session.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_proxy_session.c?rev=1927036&r1=1927035&r2=1927036&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_proxy_session.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_proxy_session.c Mon Jul  7 11:53:43 2025
@@ -850,6 +850,18 @@ static apr_status_t open_stream(h2_proxy
     dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
     if (dconf->preserve_host) {
         authority = orig_host;
+        if (!authority) {
+            /* Duplicate mod_proxy behaviour if ProxyPreserveHost is
+             * used but an "HTTP/0.9" request is received without a
+             * Host: header */
+            authority = r->server->server_hostname;
+            ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(10511)
+                          "HTTP/0.9 request (with no host line) "
+                          "on incoming request and preserve host set "
+                          "forcing hostname to be %s for uri %s",
+                          authority, r->uri);
+            apr_table_setn(r->headers_in, "Host", authority);
+        }
     }
     else {
         authority = puri.hostname;