]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #19207 by adding cgi.rfc2616_headers config directive.
authorEdin Kadribasic <edink@php.net>
Fri, 22 Nov 2002 10:16:36 +0000 (10:16 +0000)
committerEdin Kadribasic <edink@php.net>
Fri, 22 Nov 2002 10:16:36 +0000 (10:16 +0000)
php.ini-dist
php.ini-recommended
sapi/cgi/cgi_main.c

index 05e78f8cffee75c8a09c9442751b6b18908ded9d..5c85cc8c41fb0b28b93d5aa6542ff7e2bd9b09fb 100644 (file)
@@ -446,6 +446,14 @@ enable_dl = On
 ; Set to 1 if running under IIS.  Default is zero.
 ; fastcgi.impersonate = 1;
 
+; cgi.rfc2616_headers configuration option tells PHP what type of headers to
+; use when sending HTTP response code. If it's set 0 PHP sends Status: header that
+; is supported by Apache. When this option is set to 1 PHP will send
+; RFC2616 compliant header.
+; Set to 1 if running under IIS.  Default is zero.
+;cgi.rfc2616_headers = 0 
+
 ;;;;;;;;;;;;;;;;
 ; File Uploads ;
 ;;;;;;;;;;;;;;;;
index 8a59a5e95479e020e4793d835dd096621cfb0401..49430c148be8c859e1609245b546102623d0dc8d 100644 (file)
@@ -461,6 +461,14 @@ enable_dl = On
 ; Set to 1 if running under IIS.  Default is zero.
 ; fastcgi.impersonate = 1;
 
+; cgi.rfc2616_headers configuration option tells PHP what type of headers to
+; use when sending HTTP response code. If it's set 0 PHP sends Status: header that
+; is supported by Apache. When this option is set to 1 PHP will send
+; RFC2616 compliant header.
+; Set to 1 if running under IIS.  Default is zero.
+;cgi.rfc2616_headers = 0 
+
+
 ;;;;;;;;;;;;;;;;
 ; File Uploads ;
 ;;;;;;;;;;;;;;;;
index fe0748f8656fa4d6da5cd0ce4adbc1486f814b81..a647f6a26e30786e89478afafa7057cda3ed5dad 100644 (file)
@@ -241,8 +241,23 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
        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) {