MEDIUM: httpclient: allow address and port change for resolving
To allow the http-request set-dst to work for the httpclient DNS
resolving, some changes need to be done:
- The destination address need to be set in the frontend (s->csf->dst)
instead of the backend (s->csb->dst) to be able to use
tcp_action_req_set_dst()
- SRV_F_MAPPORTS need to be set on the proxy in order to allow the port
change in alloc_dst_address()
diff --git a/src/http_client.c b/src/http_client.c
index e45653f..ff02984 100644
--- a/src/http_client.c
+++ b/src/http_client.c
@@ -596,8 +596,8 @@
s->req.wto = hc->timeout_server;
s->res.rto = hc->timeout_server;
- s->csb->dst = addr;
- s->csb->flags |= CS_FL_NOLINGER;
+ s->csf->dst = addr;
+ s->csf->flags |= CS_FL_NOLINGER;
s->flags |= SF_ASSIGNED;
s->res.flags |= CF_READ_DONTWAIT;
@@ -1114,6 +1114,7 @@
httpclient_srv_raw->iweight = 0;
httpclient_srv_raw->uweight = 0;
httpclient_srv_raw->xprt = xprt_get(XPRT_RAW);
+ httpclient_srv_raw->flags |= SRV_F_MAPPORTS; /* needed to apply the port change with resolving */
httpclient_srv_raw->id = strdup("<HTTPCLIENT>");
if (!httpclient_srv_raw->id)
goto err;
@@ -1130,6 +1131,7 @@
httpclient_srv_ssl->uweight = 0;
httpclient_srv_ssl->xprt = xprt_get(XPRT_SSL);
httpclient_srv_ssl->use_ssl = 1;
+ httpclient_srv_ssl->flags |= SRV_F_MAPPORTS; /* needed to apply the port change with resolving */
httpclient_srv_ssl->id = strdup("<HTTPSCLIENT>");
if (!httpclient_srv_ssl->id)
goto err;