ID: 33057 User updated by: cboitel at lfdj dot com Reported By: cboitel at lfdj dot com Status: Closed Bug Type: Apache related Operating System: Solaris/Linux PHP Version: 5.0.4, 4.3.11 Assigned To: rasmus New Comment:
I found the patch hasn't been applied to sapi/apache_hooks/mod_php5.c for both 5.0x and 5.1x branches ? Is this normal ? Previous Comments: ------------------------------------------------------------------------ [2005-05-19 21:39:52] [EMAIL PROTECTED] Fixed in CVS ------------------------------------------------------------------------ [2005-05-19 17:18:57] [EMAIL PROTECTED] Your patch is upside down, but the idea is sound. I'll have a look. ------------------------------------------------------------------------ [2005-05-19 09:04:54] cboitel at lfdj dot com Unified diff below: --- mod_php4.c 2005-05-18 15:33:58.000000000 +0200 +++ mod_php4.c.original 2003-06-03 07:41:49.000000000 +0200 @@ -209,21 +209,12 @@ */ static int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { - request_rec *r; - if(SG(server_context) == NULL) { /* server_context is not here anymore */ return SAPI_HEADER_SEND_FAILED; } - r = (request_rec *) SG(server_context); - r->status = SG(sapi_headers).http_response_code; - if( r-> status==304 ) - { - send_error_response( r, 0 ); - } - else - { - send_http_header((request_rec *) SG(server_context)); - } + + ((request_rec *) SG(server_context))->status = SG(sapi_headers).http_response_code; + send_http_header((request_rec *) SG(server_context)); return SAPI_HEADER_SENT_SUCCESSFULLY; } /* }}} */ ------------------------------------------------------------------------ [2005-05-18 17:04:07] [EMAIL PROTECTED] Please generate unified diff (`diff -u`), put it somewhere and give us it's URL. ------------------------------------------------------------------------ [2005-05-18 16:23:49] cboitel at lfdj dot com I have patched the mod_php4.c file to use send_error_response apache function instead of send_http_headers for 304 responses. You should also check if send_error_response shall also be used for non-200 responses and if its second param (recursive call) shall be set to 0 or 1. static int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { request_rec *r; if(SG(server_context) == NULL) { /* server_context is not here anymore */ return SAPI_HEADER_SEND_FAILED; } r = (request_rec *) SG(server_context); r->status = SG(sapi_headers).http_response_code; if( r-> status==304 ) { send_error_response( r, 0 ); } else { send_http_header((request_rec *) SG(server_context)); } return SAPI_HEADER_SENT_SUCCESSFULLY; } ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/33057 -- Edit this bug report at http://bugs.php.net/?id=33057&edit=1