[4.0] 56bac2c Set X-F-F early enough that it's present if we head directly to synth{}
Lasse Karstensen
lkarsten at varnish-software.com
Mon Sep 22 16:38:25 CEST 2014
commit 56bac2c4bacfe5b906f6cc840397cab4879df201
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Sep 8 19:52:31 2014 +0000
Set X-F-F early enough that it's present if we head directly to synth{}
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 73a36c0..56762e9 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -719,6 +719,21 @@ cnt_recv(struct worker *wrk, struct req *req)
http_VSL_log(req->http);
+ if (req->restarts == 0) {
+ /*
+ * This really should be done earlier, but we want to capture
+ * it in the VSL log.
+ */
+ 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, req->sp->client_addr_str);
+ } else {
+ http_PrintfHeader(req->http, "X-Forwarded-For: %s",
+ req->sp->client_addr_str);
+ }
+ }
+
if (req->err_code) {
req->req_step = R_STP_SYNTH;
return (REQ_FSM_MORE);
@@ -734,25 +749,15 @@ cnt_recv(struct worker *wrk, struct req *req)
req->hash_always_miss = 0;
req->hash_ignore_busy = 0;
req->client_identity = NULL;
- if (req->restarts == 0) {
- 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,
- req->sp->client_addr_str);
- } else {
- http_PrintfHeader(req->http, "X-Forwarded-For: %s",
- req->sp->client_addr_str);
- }
- }
http_CollectHdr(req->http, H_Cache_Control);
VCL_recv_method(req->vcl, wrk, req, NULL, req->http->ws);
/* Attempts to cache req.body may fail */
- if (req->req_body_status == REQ_BODY_FAIL) {
+ if (req->req_body_status == REQ_BODY_FAIL)
return (REQ_FSM_DONE);
- }
+
recv_handling = wrk->handling;
/* We wash the A-E header here for the sake of VRY */
More information about the varnish-commit
mailing list