]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
added X-Squid-Error: reply header
authorwessels <>
Thu, 21 May 1998 06:01:28 +0000 (06:01 +0000)
committerwessels <>
Thu, 21 May 1998 06:01:28 +0000 (06:01 +0000)
src/HttpHeader.cc
src/enums.h
src/errorpage.cc

index d255a5d150f600c06a952edb7934866b08a45711..83d21e47e7436738621e87b2fca4f2c5944eb0a3 100644 (file)
@@ -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 */
index 12e3e4576c83736b684efba90d4cca3aca6e0452..a28b30256fbcfaf94b53a2280355f9de58e7d0f7 100644 (file)
@@ -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;
index 51822a12eb8c867bb0e5ed9cb4c1177de359f055..a163306767d109e0017248d910ab853caacef59d 100644 (file)
@@ -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;