Re: [PHP-DEV] Fix for bug 19207 (change of cgi behaviour in PHP 4.3.0)

2002-11-22 Thread Edin Kadribasic
On Friday 22 November 2002 04:18, Jani Taskinen wrote:
 I can't remember that discussion..but why do we need
 yet another ini option? If the current behaviour is incorrect,
 and you can fix it..why do you even ask here? :)

FYI:
http://www.phpbuilder.com/mail/php-developer-list/2002092/0238.php
http://bugs.php.net/bug.php?id=19207

Edin

P.S. I don't like adding ini setting either, but I see no other way of solving 
the issue.

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




[PHP-DEV] Fix for bug 19207 (change of cgi behaviour in PHP 4.3.0)

2002-11-21 Thread Edin Kadribasic
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 -  1.190.2.2
+++ cgi_main.c  22 Nov 2002 00:12:20 -
@@ -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