On Fri, 22 Nov 2002, Edin Kadribasic wrote:

> On Fri, 22 Nov 2002, Sascha Schumann wrote:
>
> > > + if (rfc2616_headers && SG(sapi_headers).http_status_line) {
> > > +         len = sprintf(buf, "%s\r\n", SG(sapi_headers).http_status_line);
> >
> >     So, if the user specifies that he wants to have
> >     rfc2616_headers, but http_status_line is not set, he gets the
> >     Status: line nevertheless?
>
> What should the correct behavior be. Send no default header (sending
> status: amounts to this for a server that does not support it)? Send
> "HTTP/1.0 200 OK"?

    The attached patch looks promising and restores the pre-4.3
    behaviour for the standard status 200 case.  It also
    continues to provide a solution for non-200 status codes.

    - Sascha
Index: cgi_main.c
===================================================================
RCS file: /repository/php4/sapi/cgi/cgi_main.c,v
retrieving revision 1.194
diff -u -r1.194 cgi_main.c
--- cgi_main.c  22 Nov 2002 10:15:47 -0000      1.194
+++ cgi_main.c  22 Nov 2002 10:52:38 -0000
@@ -238,7 +238,6 @@
 static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
 {
        char buf[1024];
-       int len;
        sapi_header_struct *h;
        zend_llist_position pos;
        long rfc2616_headers = 0;
@@ -252,13 +251,15 @@
                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);
-       }
+       if (SG(sapi_headers).http_response_code != 200) {
+               int len;
+               
+               len = sprintf(buf, 
+                               rfc2616_headers ? "HTTP/1.0 %d Code\r\n" : "Status: 
+%d\r\n", 
+                                       SG(sapi_headers).http_response_code);
 
-       PHPWRITE_H(buf, len);
+               PHPWRITE_H(buf, len);
+       }
 
        if (SG(sapi_headers).send_default_content_type) {
                char *hd;
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to