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.
This commit is contained in:
William Lallemand 2024-04-29 17:10:47 +02:00
parent 9bdce67585
commit 95949e6868
2 changed files with 5 additions and 1 deletions

View 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 */

View 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;