]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Generate error for 'squid-internal-*' MISSes
authorwessels <>
Wed, 27 May 1998 05:56:19 +0000 (05:56 +0000)
committerwessels <>
Wed, 27 May 1998 05:56:19 +0000 (05:56 +0000)
src/errorpage.cc
src/internal.cc

index a163306767d109e0017248d910ab853caacef59d..e6356c9ad8eb7d74aa8be67175a567dd62af966f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: errorpage.cc,v 1.132 1998/05/21 00:01:29 wessels Exp $
+ * $Id: errorpage.cc,v 1.133 1998/05/26 23:56:20 wessels Exp $
  *
  * DEBUG: section 4     Error Generation
  * AUTHOR: Duane Wessels
@@ -440,7 +440,24 @@ errorConvert(char token, ErrorState * err)
        p = r ? ProtocolStr[r->protocol] : "[unkown protocol]";
        break;
     case 'R':
-       p = err->request_hdrs ? err->request_hdrs : "[no request]";
+       if (NULL != r) {
+           MemBuf mb;
+           Packer p;
+           memBufDefInit(&mb);
+           memBufPrintf(&mb, "%s %s HTTP/%3.1f\n",
+               RequestMethodStr[r->method],
+               strLen(r->urlpath) ? strBuf(r->urlpath) : "/",
+               (double) r->http_ver);
+           packerToMemInit(&p, &mb);
+           httpHeaderPackInto(&r->header, &p);
+           packerClean(&p);
+           xstrncpy(buf, mb.buf, CVT_BUF_SZ);
+           memBufClean(&mb);
+       } else if (err->request_hdrs) {
+           p = err->request_hdrs;
+       } else {
+           p = "[no request]";
+       }
        break;
     case 's':
        p = full_appname_string;
index ebd6ef971e64c6d2b87a3b40344460e598b36582..032fefcaca3a9e4900b65e06cdc9ee9a60b32c63 100644 (file)
@@ -4,13 +4,18 @@
 void
 internalStart(request_t * request, StoreEntry * entry)
 {
+    ErrorState *err;
     const char *upath = strBuf(request->urlpath);
     debug(0, 1) ("internalStart: %s requesting '%s'\n",
        inet_ntoa(request->client_addr), upath);
     if (0 == strcmp(upath, "/squid-internal-dynamic/netdb"))
        netdbBinaryExchange(entry);
-    else
+    else {
        debug(0, 0) ("internalStart: unknown request '%s'\n", upath);
+       err = errorCon(ERR_INVALID_REQ, HTTP_NOT_FOUND);
+       err->request = requestLink(request);
+       errorAppendEntry(entry, err);
+    }
 }
 
 int