]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: httpclient: allow to use absolute URI with new flag HC_F_HTTPROXY
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 29 Apr 2024 15:10:47 +0000 (17:10 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 29 Apr 2024 15:10:47 +0000 (17:10 +0200)
The new HC_F_HTTPPROXY flag allows to use an absolute URI within a
request that won't be modified in order to use an http proxy.

include/haproxy/http_client-t.h
src/http_client.c

index 7ae0e612f0b5f5ab1ca42a4ba7f52c4b795648da..2c07f7795b96eaa020a97742089d10269a4e5bc4 100644 (file)
@@ -64,6 +64,7 @@ enum {
 #define HC_F_RES_HDR        0x02
 #define HC_F_RES_BODY       0x04
 #define HC_F_RES_END        0x08
+#define HC_F_HTTPPROXY      0x10
 
 
 #endif /* ! _HAPROXY_HTTCLIENT__T_H */
index 96ddd037832ef36992939922c82638b3257d7703..d8327804ef33434d8cf4eaa7fb9801fc9da82161 100644 (file)
@@ -277,10 +277,13 @@ int httpclient_req_gen(struct httpclient *hc, const struct ist url, enum http_me
        struct htx *htx;
        int err_code = 0;
        struct ist meth_ist, vsn;
-       unsigned int flags = HTX_SL_F_VER_11 | HTX_SL_F_NORMALIZED_URI | HTX_SL_F_HAS_SCHM;
+       unsigned int flags = HTX_SL_F_VER_11 | HTX_SL_F_HAS_SCHM | HTX_SL_F_HAS_AUTHORITY;
        int i;
        int foundhost = 0, foundaccept = 0, foundua = 0;
 
+       if (!(hc->flags & HC_F_HTTPPROXY))
+               flags |= HTX_SL_F_NORMALIZED_URI;
+
        if (!b_alloc(&hc->req.buf))
                goto error;