cvs: php4 / php.ini-dist php.ini-recommended /sapi/cgi cgi_main.c
| From: | Edin Kadribasic | Date: | Fri, 22 Nov 2002 10:15:47 +0000 |
| Subject: | cvs: php4 / php.ini-dist php.ini-recommended /sapi/cgi cgi_main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-16537@lists.php.net to get a copy of this message | ||
edink Fri Nov 22 05:15:47 2002 EDT
Modified files:
/php4 php.ini-dist php.ini-recommended
/php4/sapi/cgi cgi_main.c
Log:
Fixed bug #19207 by adding cgi.rfc2616_headers configuration directive.
Index: php4/php.ini-dist
diff -u php4/php.ini-dist:1.171 php4/php.ini-dist:1.172
--- php4/php.ini-dist:1.171 Mon Nov 11 08:40:30 2002
+++ php4/php.ini-dist Fri Nov 22 05:15:46 2002
@@ -446,6 +446,14 @@
; 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: php4/php.ini-recommended
diff -u php4/php.ini-recommended:1.119 php4/php.ini-recommended:1.120
--- php4/php.ini-recommended:1.119 Mon Nov 11 08:40:30 2002
+++ php4/php.ini-recommended Fri Nov 22 05:15:47 2002
@@ -461,6 +461,14 @@
; 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: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.193 php4/sapi/cgi/cgi_main.c:1.194
--- php4/sapi/cgi/cgi_main.c:1.193 Thu Nov 14 19:32:42 2002
+++ php4/sapi/cgi/cgi_main.c Fri Nov 22 05:15:47 2002
@@ -241,8 +241,23 @@
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) {