]> granicus.if.org Git - apache/commitdiff
fixing default port handling in authority composition for upgraded requests
authorStefan Eissing <icing@apache.org>
Mon, 7 Dec 2015 11:45:43 +0000 (11:45 +0000)
committerStefan Eissing <icing@apache.org>
Mon, 7 Dec 2015 11:45:43 +0000 (11:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1718314 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_request.c

index bce58593c1557654cc47ddd463935c0e46a75c81..bf2d0c2e3ad2baa7730feb9c3987e4a67ae2ea7f 100644 (file)
@@ -150,9 +150,13 @@ apr_status_t h2_request_rwrite(h2_request *req, request_rec *r)
     req->path      = apr_uri_unparse(r->pool, &r->parsed_uri, 
                                      APR_URI_UNP_OMITSITEPART);
 
-    if (!ap_strchr_c(req->authority, ':') && r->server) {
-        req->authority = apr_psprintf(r->pool, "%s:%d", req->authority,
-                                      (int)r->server->port);
+    if (!ap_strchr_c(req->authority, ':') && r->server && r->server->port) {
+        apr_port_t defport = apr_uri_port_of_scheme(req->scheme);
+        if (defport != r->server->port) {
+            /* port info missing and port is not default for scheme: append */
+            req->authority = apr_psprintf(r->pool, "%s:%d", req->authority,
+                                          (int)r->server->port);
+        }
     }
     
     AP_DEBUG_ASSERT(req->scheme);