http: fix Host header usage in http1_target_fixup 45/43145/2
authorMatus Fabian <[email protected]>
Wed, 11 Jun 2025 10:37:18 +0000 (06:37 -0400)
committerFlorin Coras <[email protected]>
Wed, 11 Jun 2025 15:45:29 +0000 (15:45 +0000)
Type: fix

Change-Id: I034d40872515dcb192ea5cdd244737fafdb12217
Signed-off-by: Matus Fabian <[email protected]>
src/plugins/http/http1.c

index 5ecc1f5..f7d79b8 100644 (file)
@@ -768,12 +768,12 @@ http1_target_fixup (http_conn_t *hc, http_req_t *req)
                  HTTP_URL_SCHEME_HTTP;
 
   if (req->target_form == HTTP_TARGET_AUTHORITY_FORM ||
-      req->connection_header_index == ~0)
+      req->host_header_index == ~0)
     return;
 
   /* authority fixup */
-  host = vec_elt_at_index (req->headers, req->connection_header_index);
-  req->target_authority_offset = host->value_offset;
+  host = vec_elt_at_index (req->headers, req->host_header_index);
+  req->target_authority_offset = req->headers_offset + host->value_offset;
   req->target_authority_len = host->value_len;
 }