]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
add http_code arg to cached_error_url
authorwessels <>
Fri, 5 Apr 1996 00:46:39 +0000 (00:46 +0000)
committerwessels <>
Fri, 5 Apr 1996 00:46:39 +0000 (00:46 +0000)
src/errorpage.cc

index ba99282576aae4f627bc4ab06d544f852b5a8da5..05233ea0d8d5313986ec8a4c67542500bd373d50 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: errorpage.cc,v 1.11 1996/04/04 01:30:42 wessels Exp $ */
+/* $Id: errorpage.cc,v 1.12 1996/04/04 17:46:39 wessels Exp $ */
 
 /* DEBUG: Section 4             cached_error: Error printing routines */
 
@@ -129,16 +129,19 @@ void cached_error_entry(entry, type, msg)
        getMyHostname());
     strcat(tmp_error_buf, tbuf);
     entry->mem_obj->abort_code = type;
+    if (entry->mem_obj->http_code == 0)
+        entry->mem_obj->http_code = 400;
     storeAbort(entry, tmp_error_buf);
 }
 
 
 
-char *cached_error_url(url, method, type, address, msg)
+char *cached_error_url(url, method, type, address, code, msg)
      char *url;
      int method;
      int type;
      char *address;
+     int code;
      char *msg;
 {
     int index;
@@ -147,11 +150,12 @@ char *cached_error_url(url, method, type, address, msg)
     if (type == ERR_MIN || type > ERR_MAX)
        fatal_dump("cached_error_url: type out of range.");
     index = (int) (type - ERR_MIN);
-    sprintf(tmp_error_buf, CACHED_ERROR_MSG_P1,
+    sprintf(tmp_error_buf, "HTTP/1.0 %d Cache Detected Error\r\nContent-type: text/html\r\n\r\n", code);
+    sprintf(tbuf, CACHED_ERROR_MSG_P1,
        url,
        url,
        ErrorData[index].shrt);
-
+    strcat(tmp_error_buf, tbuf);
     if (msg) {
        sprintf(tbuf, CACHED_ERROR_MSG_P2, msg);
        strcat(tmp_error_buf, tbuf);
@@ -179,10 +183,11 @@ Generated by cached/%s@%s\n\
 </ADDRESS>\n\
 \n"
 
-char *cached_error_request(request, type, address)
+char *cached_error_request(request, type, address, code)
      char *request;
      int type;
      char *address;
+     int code;
 {
     int index;
 
@@ -191,10 +196,12 @@ char *cached_error_request(request, type, address)
        fatal_dump("cached_error_url: type out of range.");
     index = (int) (type - ERR_MIN);
 
-    sprintf(tmp_error_buf, CACHED_REQUEST_ERROR_MSG,
+    sprintf(tmp_error_buf, "HTTP/1.0 %d Cache Detected Error\r\nContent-type: text/html\r\n\r\n", code);
+    sprintf(tbuf, CACHED_REQUEST_ERROR_MSG,
        request,
        SQUID_VERSION,
        getMyHostname());
+    strcat(tmp_error_buf, tbuf);
     if (!log_errors)
        return tmp_error_buf;
     return tmp_error_buf;