1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

* Prevent running through the error stack by returning OK and setting r->status

accordingly if ret is HTTP_NOT_MODIFIED as this breaks mod_cache validating a
  stale entity.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@541990 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ruediger Pluem
2007-05-27 13:57:46 +00:00
parent bd03736495
commit 5ebab647ff
2 changed files with 56 additions and 2 deletions

View File

@@ -929,7 +929,34 @@ static int cgi_handler(request_rec *r)
int ret;
if ((ret = ap_scan_script_header_err_brigade(r, bb, sbuf))) {
return log_script(r, conf, ret, dbuf, sbuf, bb, script_err);
ret = log_script(r, conf, ret, dbuf, sbuf, bb, script_err);
/*
* ret could be HTTP_NOT_MODIFIED in the case that the CGI script
* does not set an explicit status and ap_meets_conditions, which
* is called by ap_scan_script_header_err_brigade, detects that
* the conditions of the requests are met and the response is
* not modified.
* In this case set r->status and return OK in order to prevent
* running through the error processing stack as this would
* break with mod_cache, if the conditions had been set by
* mod_cache itself to validate a stale entity.
* BTW: We circumvent the error processing stack anyway if the
* CGI script set an explicit status code (whatever it is) and
* the only possible values for ret here are:
*
* HTTP_NOT_MODIFIED (set by ap_meets_conditions)
* HTTP_PRECONDITION_FAILED (set by ap_meets_conditions)
* HTTP_INTERNAL_SERVER_ERROR (if something went wrong during the
* processing of the response of the CGI script, e.g broken headers
* or a crashed CGI process).
*/
if (ret == HTTP_NOT_MODIFIED) {
r->status = ret;
return OK;
}
return ret;
}
location = apr_table_get(r->headers_out, "Location");