Attached is a patch that fixes bug #19207 in accordance with previous 
discussion on php-dev. It add cgi.rfc2616_headers ini option which is by 
default set to off and mimics current 4.3.0 behaviour. If its set to on the 
HTTP status line is sent in accordance to RFC2616 which was default  for PHP 
4.2.3 and earlier.

Any objections to commiting this fix?

Edin
diff -u -3 -p -r1.190.2.2 cgi_main.c
--- cgi_main.c  15 Nov 2002 00:33:18 -0000      1.190.2.2
+++ cgi_main.c  22 Nov 2002 00:12:20 -0000
@@ -241,8 +241,23 @@ static int sapi_cgi_send_headers(sapi_he
        int len;
        sapi_header_struct *h;
        zend_llist_position pos;
-
-       len = sprintf(buf, "Status: %d\r\n", SG(sapi_headers).http_response_code);
+       long rfc2616_headers = 0;
+
+       /* Check wheater to send RFC2616 style headers compatible with
+        * PHP versions 4.2.3 and earlier compatible with web servers
+        * such as IIS. Default is informal CGI RFC header compatible
+        * with Apache.
+        */
+       if (cfg_get_long("cgi.rfc2616_headers", &rfc2616_headers) == FAILURE) {
+        rfc2616_headers = 0;
+       }
+
+       if (rfc2616_headers && SG(sapi_headers).http_status_line) {
+               len = sprintf(buf, "%s\r\n", SG(sapi_headers).http_status_line);
+       } else {
+               len = sprintf(buf, "Status: %d\r\n", 
+SG(sapi_headers).http_response_code);
+       }
+
        PHPWRITE_H(buf, len);

        if (SG(sapi_headers).send_default_content_type) {

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to