| [2422] | 1 | From 1ee367569729f9cf153cd1df87e15e05e00d7645 Mon Sep 17 00:00:00 2001 | 
|---|
 | 2 | From: Alexander Chernyakhovsky <achernya@mit.edu> | 
|---|
 | 3 | Date: Fri, 3 May 2013 21:40:07 -0400 | 
|---|
 | 4 | Subject: [PATCH 3/4] Fix "the-bug" (non-empty content in 304s) | 
|---|
 | 5 |  | 
|---|
 | 6 | PHP should not produce any output, even if zlib.output_compression is | 
|---|
 | 7 | on, if the HTTP response code is 204 or 304 (no content or not modified). | 
|---|
 | 8 |  | 
|---|
 | 9 | ixes PHP bug #42362 with php.cvs #56693, see: | 
|---|
 | 10 | http://bugs.php.net/bug.php?id=42362 | 
|---|
 | 11 | http://news.php.net/php.cvs/56693 | 
|---|
 | 12 | http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.183.2.6.2.5.2.9&r2=1.183.2.6.2.5.2.10 | 
|---|
 | 13 |  | 
|---|
 | 14 | Apache should discard any body provided by a script (in any language, not | 
|---|
 | 15 | just PHP) when the status is "no content" or "not modified". | 
|---|
 | 16 | Addresses part of Apache bug #40953, see: | 
|---|
 | 17 | https://issues.apache.org/bugzilla/show_bug.cgi?id=40953#c7 | 
|---|
 | 18 |  | 
|---|
 | 19 | Solves scripts.mit.edu support issue #773060, see: | 
|---|
 | 20 | https://help.mit.edu/Ticket/UpdateCallCenter.html?id=773060 | 
|---|
 | 21 | https://diswww.mit.edu/charon/scripts/24018 | 
|---|
 | 22 | --- | 
|---|
 | 23 |  server/util_script.c |    5 +++++ | 
|---|
 | 24 |  1 file changed, 5 insertions(+) | 
|---|
 | 25 |  | 
|---|
 | 26 | diff --git a/server/util_script.c b/server/util_script.c | 
|---|
 | 27 | index 5708c08..187e30f 100644 | 
|---|
 | 28 | --- a/server/util_script.c | 
|---|
 | 29 | +++ b/server/util_script.c | 
|---|
 | 30 | @@ -503,6 +503,11 @@ AP_DECLARE(int) ap_scan_script_header_err_core_ex(request_rec *r, char *buffer, | 
|---|
 | 31 |              if ((cgi_status == HTTP_UNSET) && (r->method_number == M_GET)) { | 
|---|
 | 32 |                  cond_status = ap_meets_conditions(r); | 
|---|
 | 33 |              } | 
|---|
 | 34 | +            else if ((cgi_status == HTTP_NO_CONTENT) || | 
|---|
 | 35 | +                     (cgi_status == HTTP_NOT_MODIFIED) || | 
|---|
 | 36 | +                     ap_is_HTTP_INFO(cgi_status)) { | 
|---|
 | 37 | +                r->header_only = 1; /* discard any body */ | 
|---|
 | 38 | +            } | 
|---|
 | 39 |              apr_table_overlap(r->err_headers_out, merge, | 
|---|
 | 40 |                  APR_OVERLAP_TABLES_MERGE); | 
|---|
 | 41 |              if (!apr_is_empty_table(cookie_table)) { | 
|---|
 | 42 | --  | 
|---|
 | 43 | 1.7.9.6 (Apple Git-31.1) | 
|---|
 | 44 |  | 
|---|