[4.0] 0a02a39 Add Date and Server headers also on backend error objects
Martin Blix Grydeland
martin at varnish-software.com
Tue Jun 24 11:31:37 CEST 2014
commit 0a02a3974f36929bef9212904ae2a1494bbba7c6
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Mon Apr 14 17:50:11 2014 +0200
Add Date and Server headers also on backend error objects
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 2bb5feb..be664e5 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -653,11 +653,14 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
{
struct storage *st;
ssize_t l;
+ double now;
+ char time_str[VTIM_FORMAT_SIZE];
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
- VSLb_ts_busyobj(bo, "Error", W_TIM_real(wrk));
+ now = W_TIM_real(wrk);
+ VSLb_ts_busyobj(bo, "Error", now);
AN(bo->fetch_objcore->flags & OC_F_BUSY);
@@ -669,6 +672,9 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
HTTP_Setup(bo->beresp, bo->ws, bo->vsl, SLT_BerespMethod);
http_SetResp(bo->beresp, "HTTP/1.1", 503, "Backend fetch failed");
+ VTIM_format(now, time_str);
+ http_PrintfHeader(bo->beresp, "Date: %s", time_str);
+ http_SetHeader(bo->beresp, "Server: Varnish");
bo->exp.t_origin = bo->t_prev;
bo->exp.ttl = 0;
More information about the varnish-commit
mailing list