]> granicus.if.org Git - php/commitdiff
Fixed bug #41378 (fastcgi protocol lacks support for Reason-Phrase in "Status:"...
authorDmitry Stogov <dmitry@php.net>
Tue, 15 May 2007 08:17:08 +0000 (08:17 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 15 May 2007 08:17:08 +0000 (08:17 +0000)
NEWS
sapi/cgi/cgi_main.c

diff --git a/NEWS b/NEWS
index 9d7c215d3e757aaa930d2ccddc1b0547f3e0b2a8..4b979d573a9d5285a0820ae986dda8f83ecaa232 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,8 @@ PHP                                                                        NEWS
 - Fixed altering $this via argument named "this". (Dmitry)
 - Fixed PHP CLI to use the php.ini from the binary location. (Hannes)
 - Fixed segfault in strripos(). (Tony, Joxean Koret)
+- Fixed bug #41378 (fastcgi protocol lacks support for Reason-Phrase in 
+  "Status:" header). (Dmitry)
 - Fixed bug #41374 (wholetext concats values of wrong nodes). (Rob)
 - Fixed bug #41353 (crash in openssl_pkcs12_read() on invalid input). (Ilia)
 - Fixed bug #41351 (Invalid opcode with foreach ($a[] as $b)). (Dmitry, Tony)
index 473a074231998dbfdb004f8e4669546db18eaf49..b59a3994aa42e4b093c0377e9843efa9ced360da 100644 (file)
@@ -331,7 +331,16 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
                        }
 
                } else {
-                       len = slprintf(buf, sizeof(buf), "Status: %d\r\n", SG(sapi_headers).http_response_code);
+                       char *s;
+
+                       if (SG(sapi_headers).http_status_line &&
+                           (s = strchr(SG(sapi_headers).http_status_line, ' ')) != 0 &&
+                           (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);
+                       } else {
+                               len = slprintf(buf, sizeof(buf), "Status: %d\r\n", SG(sapi_headers).http_response_code);
+                       }
                }
 
                PHPWRITE_H(buf, len);