From 95949e68687048f5aca3588b0a2714f1ef7bd6ad Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Mon, 29 Apr 2024 17:10:47 +0200 Subject: [PATCH] MINOR: httpclient: allow to use absolute URI with new flag HC_F_HTTPROXY 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 | 1 + src/http_client.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/haproxy/http_client-t.h b/include/haproxy/http_client-t.h index 7ae0e612f..2c07f7795 100644 --- a/include/haproxy/http_client-t.h +++ b/include/haproxy/http_client-t.h @@ -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 */ diff --git a/src/http_client.c b/src/http_client.c index 96ddd0378..d8327804e 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -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;