[master] da08a4c26 req: Build X-Forwarded-For with http_AppendHeader()
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Fri Aug 5 09:24:07 UTC 2022
commit da08a4c26db8314b1c04bde5e105b11c617052c6
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Tue Jul 26 10:35:44 2022 +0200
req: Build X-Forwarded-For with http_AppendHeader()
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 0b6141bbf..c23270073 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -866,21 +866,13 @@ cnt_restart(struct worker *wrk, struct req *req)
static void v_matchproto_(req_state_f)
cnt_recv_prep(struct req *req, const char *ci)
{
- const char *xff;
if (req->restarts == 0) {
/*
* This really should be done earlier, but we want to capture
* it in the VSL log.
*/
- http_CollectHdr(req->http, H_X_Forwarded_For);
- if (http_GetHdr(req->http, H_X_Forwarded_For, &xff)) {
- http_Unset(req->http, H_X_Forwarded_For);
- http_PrintfHeader(req->http, "X-Forwarded-For: %s, %s",
- xff, ci);
- } else {
- http_PrintfHeader(req->http, "X-Forwarded-For: %s", ci);
- }
+ http_AppendHeader(req->http, H_X_Forwarded_For, ci);
http_CollectHdr(req->http, H_Cache_Control);
/* By default we use the first backend */
More information about the varnish-commit
mailing list