source: trunk/server/common/patches/httpd-304s.patch @ 2625

Last change on this file since 2625 was 2591, checked in by achernya, 10 years ago
Reintegrate fc20-dev into trunk
File size: 1.8 KB
  • server/util_script.c

    From f4d66a13e385c6fa2026e2da1119ad080928c1f5 Mon Sep 17 00:00:00 2001
    From: Alexander Chernyakhovsky <achernya@mit.edu>
    Date: Fri, 3 May 2013 21:40:07 -0400
    Subject: [PATCH] Fix "the-bug" (non-empty content in 304s)
    
    PHP should not produce any output, even if zlib.output_compression is
    on, if the HTTP response code is 204 or 304 (no content or not modified).
    
    ixes PHP bug #42362 with php.cvs #56693, see:
    http://bugs.php.net/bug.php?id=42362
    http://news.php.net/php.cvs/56693
    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
    
    Apache should discard any body provided by a script (in any language, not
    just PHP) when the status is "no content" or "not modified".
    Addresses part of Apache bug #40953, see:
    https://issues.apache.org/bugzilla/show_bug.cgi?id=40953#c7
    
    Solves scripts.mit.edu support issue #773060, see:
    https://help.mit.edu/Ticket/UpdateCallCenter.html?id=773060
    https://diswww.mit.edu/charon/scripts/24018
    ---
     server/util_script.c | 5 +++++
     1 file changed, 5 insertions(+)
    
    diff --git a/server/util_script.c b/server/util_script.c
    index 12a056f..dd83337 100644
    a b AP_DECLARE(int) ap_scan_script_header_err_core_ex(request_rec *r, char *buffer, 
    503503            if ((cgi_status == HTTP_UNSET) && (r->method_number == M_GET)) {
    504504                cond_status = ap_meets_conditions(r);
    505505            }
     506            else if ((cgi_status == HTTP_NO_CONTENT) ||
     507                     (cgi_status == HTTP_NOT_MODIFIED) ||
     508                     ap_is_HTTP_INFO(cgi_status)) {
     509                r->header_only = 1; /* discard any body */
     510            }
    506511            apr_table_overlap(r->err_headers_out, merge,
    507512                APR_OVERLAP_TABLES_MERGE);
    508513            if (!apr_is_empty_table(cookie_table)) {
Note: See TracBrowser for help on using the repository browser.