1
1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## no_error_truncation.dpatch by Tim Retout <tim@retout.co.uk>
2
## no_error_truncation.dpatch
3
## http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_cgi.c?r1=541926&r2=541990
4
5
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: Patch to stop errors being truncated when using mod_cgi. Taken from
6
## DP: Patch to stop errors being truncated when using mod_cgi. See
6
7
## DP: http://issues.apache.org/bugzilla/show_bug.cgi?id=39710
8
## DP: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_cgi.c?r1=541926&r2=541990
10
diff -ru apache2-2.2.3.orig/modules/generators/mod_cgi.c apache2-2.2.3/modules/generators/mod_cgi.c
11
--- apache2-2.2.3.orig/modules/generators/mod_cgi.c 2006-07-12 04:38:44.000000000 +0100
12
+++ apache2-2.2.3/modules/generators/mod_cgi.c 2007-04-27 23:43:20.000000000 +0100
11
diff -urNad apache2-work~/modules/generators/mod_cgi.c apache2-work/modules/generators/mod_cgi.c
12
--- apache2-work~/modules/generators/mod_cgi.c 2007-06-11 20:00:30.000000000 +0200
13
+++ apache2-work/modules/generators/mod_cgi.c 2007-06-11 20:04:38.000000000 +0200
16
15
if ((ret = ap_scan_script_header_err_brigade(r, bb, sbuf))) {
17
- ret = log_script(r, conf, ret, dbuf, sbuf, bb, script_err);
16
ret = log_script(r, conf, ret, dbuf, sbuf, bb, script_err);
19
18
- /* Set our status. */
24
23
- b = apr_bucket_eos_create(c->bucket_alloc);
25
24
- APR_BRIGADE_INSERT_TAIL(bb, b);
26
25
- ap_pass_brigade(r->output_filters, bb);
29
+ return log_script(r, conf, ret, dbuf, sbuf, bb, script_err);
27
+ * ret could be HTTP_NOT_MODIFIED in the case that the CGI script
28
+ * does not set an explicit status and ap_meets_conditions, which
29
+ * is called by ap_scan_script_header_err_brigade, detects that
30
+ * the conditions of the requests are met and the response is
32
+ * In this case set r->status and return OK in order to prevent
33
+ * running through the error processing stack as this would
34
+ * break with mod_cache, if the conditions had been set by
35
+ * mod_cache itself to validate a stale entity.
36
+ * BTW: We circumvent the error processing stack anyway if the
37
+ * CGI script set an explicit status code (whatever it is) and
38
+ * the only possible values for ret here are:
40
+ * HTTP_NOT_MODIFIED (set by ap_meets_conditions)
41
+ * HTTP_PRECONDITION_FAILED (set by ap_meets_conditions)
42
+ * HTTP_INTERNAL_SERVER_ERROR (if something went wrong during the
43
+ * processing of the response of the CGI script, e.g broken headers
44
+ * or a crashed CGI process).
46
+ if (ret == HTTP_NOT_MODIFIED) {
32
location = apr_table_get(r->headers_out, "Location");