iliaa Fri Oct 17 01:32:59 2008 UTC
Modified files: (Branch: PHP_5_2)
/php-src/sapi/cgi cgi_main.c
/php-src NEWS
Log:
MFB: Fixed bug #46319 (PHP sets default Content-Type header for HTTP 304
response code, in cgi sapi)
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.61&r2=1.267.2.15.2.62&diff_format=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.61
php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.62
--- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.61 Tue Sep 2 13:22:00 2008
+++ php-src/sapi/cgi/cgi_main.c Fri Oct 17 01:32:59 2008
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cgi_main.c,v 1.267.2.15.2.61 2008/09/02 13:22:00 dmitry Exp $ */
+/* $Id: cgi_main.c,v 1.267.2.15.2.62 2008/10/17 01:32:59 iliaa Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -370,6 +370,7 @@
sapi_header_struct *h;
zend_llist_position pos;
zend_bool ignore_status = 0;
+ int response_status = SG(sapi_headers).http_response_code;
if (SG(request_info).no_headers == 1) {
return SAPI_HEADER_SENT_SUCCESSFULLY;
@@ -381,8 +382,11 @@
zend_bool has_status = 0;
if (CGIG(rfc2616_headers) && SG(sapi_headers).http_status_line)
{
- len = slprintf(buf, SAPI_CGI_MAX_HEADER_LENGTH,
- "%s\r\n",
SG(sapi_headers).http_status_line);
+ char *s;
+ len = slprintf(buf, SAPI_CGI_MAX_HEADER_LENGTH,
"%s\r\n", SG(sapi_headers).http_status_line);
+ if ((s = strchr(SG(sapi_headers).http_status_line, '
'))) {
+ response_status = atoi((s + 1));
+ }
if (len > SAPI_CGI_MAX_HEADER_LENGTH) {
len = SAPI_CGI_MAX_HEADER_LENGTH;
@@ -396,6 +400,7 @@
(s - SG(sapi_headers).http_status_line) >= 5 &&
strncasecmp(SG(sapi_headers).http_status_line,
"HTTP/", 5) == 0) {
len = slprintf(buf, sizeof(buf),
"Status:%s\r\n", s);
+ response_status = atoi((s + 1));
} else {
h =
(sapi_header_struct*)zend_llist_get_first_ex(&sapi_headers->headers, &pos);
while (h) {
@@ -440,6 +445,9 @@
PHPWRITE_H(h->header, h->header_len);
PHPWRITE_H("\r\n", 2);
}
+ } else if (response_status == 304 && h->header_len >
sizeof("Content-Type:")-1 &&
+ strncasecmp(h->header, "Content-Type:",
sizeof("Content-Type:")-1) == 0) {
+ continue;
} else {
PHPWRITE_H(h->header, h->header_len);
PHPWRITE_H("\r\n", 2);
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1261&r2=1.2027.2.547.2.1262&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1261 php-src/NEWS:1.2027.2.547.2.1262
--- php-src/NEWS:1.2027.2.547.2.1261 Thu Oct 16 16:20:52 2008
+++ php-src/NEWS Fri Oct 17 01:32:59 2008
@@ -1,6 +1,8 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Oct 2008, PHP 5.2.7RC2
+- Fixed bug #46319 (PHP sets default Content-Type header for HTTP 304
+ response code, in cgi sapi). (Ilia)
- Fixed bug #46292 (PDO::setFetchMode() shouldn't requires the 2nd arg when
using FETCH_CLASSTYPE). (Felipe)
- Fixed bug #46274, #46249 (pdo_pgsql always fill in NULL for empty BLOB and
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php