From fcc625024a389b01a151bf73d2b0f28a6b7d60f0 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Thu, 21 May 1998 06:01:28 +0000 Subject: [PATCH] added X-Squid-Error: reply header --- src/HttpHeader.cc | 6 ++++-- src/enums.h | 1 + src/errorpage.cc | 14 +++++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index d255a5d150..83d21e47e7 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.cc,v 1.34 1998/05/20 23:35:03 wessels Exp $ + * $Id: HttpHeader.cc,v 1.35 1998/05/21 00:01:28 wessels Exp $ * * DEBUG: section 55 HTTP Header * AUTHOR: Alex Rousskov @@ -125,6 +125,7 @@ static const HttpHeaderFieldAttrs HeadersAttrs[] = {"X-Cache", HDR_X_CACHE, ftStr}, {"X-Cache-Lookup", HDR_X_CACHE_LOOKUP, ftStr}, {"X-Forwarded-For", HDR_X_FORWARDED_FOR, ftStr}, + {"X-Squid-Error", HDR_X_SQUID_ERROR, ftStr}, {"Other:", HDR_OTHER, ftStr} /* ':' will not allow matches */ }; static HttpHeaderFieldInfo *Headers = NULL; @@ -182,7 +183,8 @@ static http_hdr_type ReplyHeadersArr[] = HDR_MIME_VERSION, HDR_PUBLIC, HDR_RETRY_AFTER, HDR_SERVER, HDR_SET_COOKIE, HDR_VARY, HDR_WARNING, HDR_PROXY_CONNECTION, HDR_X_CACHE, - HDR_X_CACHE_LOOKUP + HDR_X_CACHE_LOOKUP, + HDR_X_SQUID_ERROR }; static HttpHeaderMask RequestHeadersMask; /* set run-time using RequestHeaders */ diff --git a/src/enums.h b/src/enums.h index 12e3e4576c..a28b30256f 100644 --- a/src/enums.h +++ b/src/enums.h @@ -228,6 +228,7 @@ typedef enum { HDR_X_CACHE, HDR_X_CACHE_LOOKUP, /* tmp hack, remove later */ HDR_X_FORWARDED_FOR, + HDR_X_SQUID_ERROR, HDR_OTHER, HDR_ENUM_END } http_hdr_type; diff --git a/src/errorpage.cc b/src/errorpage.cc index 51822a12eb..a163306767 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -1,6 +1,6 @@ /* - * $Id: errorpage.cc,v 1.131 1998/05/08 23:29:26 wessels Exp $ + * $Id: errorpage.cc,v 1.132 1998/05/21 00:01:29 wessels Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -497,10 +497,22 @@ errorConvert(char token, ErrorState * err) HttpReply * errorBuildReply(ErrorState * err) { + char err_hdr[CVT_BUF_SZ]; HttpReply *rep = httpReplyCreate(); MemBuf content = errorBuildContent(err); /* no LMT for error pages; error pages expire immediately */ httpReplySetHeaders(rep, 1.0, err->http_status, NULL, "text/html", content.size, 0, squid_curtime); + /* + * include some information for downstream caches. Implicit + * replaceable content This isn't quite sufficient. xerrno is not + * necessarily meaningful to another system, so we really should + * expand it. Additionally, we should identify ourselves. Someone + * might want to know. Someone _will_ want to know OTOH, the first + * X-CACHE-MISS entry should tell us who. + */ + snprintf(err_hdr, CVT_BUF_SZ, "%s %d", + err_type_str[err->page_id], err->xerrno); + httpHeaderPutStr(&rep->header, HDR_X_SQUID_ERROR, err_hdr); httpBodySet(&rep->body, content.buf, content.size + 1, NULL); memBufClean(&content); return rep; -- 2.47.3