From: wessels <> Date: Fri, 5 Apr 1996 00:46:39 +0000 (+0000) Subject: add http_code arg to cached_error_url X-Git-Tag: SQUID_3_0_PRE1~6291 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f98fc6723cff1c13887f1356967111c1674f58d1;p=thirdparty%2Fsquid.git add http_code arg to cached_error_url --- diff --git a/src/errorpage.cc b/src/errorpage.cc index ba99282576..05233ea0d8 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -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\ \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;