]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h1-htx: Set the flag HTX_SL_F_HAS_AUTHORITY during the request parsing
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 8 Oct 2019 13:01:34 +0000 (15:01 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 9 Oct 2019 09:05:31 +0000 (11:05 +0200)
When an h1 request is received and parsed, this flag is set if it is a CONNECT
request or if an absolute URI is detected.

src/h1_htx.c

index 1252f8a13dc7a9bd27710c7d14cc395a7c431ff6..9ecabf04390160ca45ae4b0db443d72b32490f9b 100644 (file)
@@ -193,10 +193,12 @@ static int h1_postparse_req_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx
                goto error;
        sl->info.req.meth = h1sl->rq.meth;
 
-       /* Check if the uri contains an explicit scheme and if it is
-        * "http" or "https". */
-       if (uri.len && uri.ptr[0] != '/') {
-               sl->flags |= HTX_SL_F_HAS_SCHM;
+       /* Check if the uri contains an authority. Also check if it contains an
+        * explicit scheme and if it is "http" or "https". */
+       if (h1sl->rq.meth == HTTP_METH_CONNECT)
+               sl->flags |= HTX_SL_F_HAS_AUTHORITY;
+       else if (uri.len && uri.ptr[0] != '/' && uri.ptr[0] != '*') {
+               sl->flags |= (HTX_SL_F_HAS_AUTHORITY|HTX_SL_F_HAS_SCHM);
                if (uri.len > 4 && (uri.ptr[0] | 0x20) == 'h')
                        sl->flags |= ((uri.ptr[4] == ':') ? HTX_SL_F_SCHM_HTTP : HTX_SL_F_SCHM_HTTPS);
        }