cvs: php4 /sapi/cgi cgi_main.c

From: Date: Wed, 03 Jul 2002 11:44:48 +0000
Subject: cvs: php4 /sapi/cgi cgi_main.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-12686@lists.php.net to get a copy of this message
sas Wed Jul 3 07:44:48 2002 EDT Modified files: /php4/sapi/cgi cgi_main.c Log: Use "Status: %d" instead of "HTTP/1.0 %d X" in the CGI SAPI module as per the CGI RFC. The status notation is incompatible with Apache's non-parsed-header mode "nph-*", but that has never worked before anyway. One could make the format string configurable. Noticed by: Sebastian Bergmann Index: php4/sapi/cgi/cgi_main.c diff -u php4/sapi/cgi/cgi_main.c:1.174 php4/sapi/cgi/cgi_main.c:1.175 --- php4/sapi/cgi/cgi_main.c:1.174 Sat Jun 22 09:59:13 2002 +++ php4/sapi/cgi/cgi_main.c Wed Jul 3 07:44:48 2002 @@ -201,12 +201,24 @@ } -static void sapi_cgi_send_header(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC) +static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { - if (sapi_header) { - PHPWRITE_H(sapi_header->header, sapi_header->header_len); + char buf[1024]; + int len; + sapi_header_struct *h; + zend_llist_position pos; + + len = sprintf(buf, "Status: %d\r\n", SG(sapi_headers).http_response_code); + PHPWRITE_H(buf, len); + + h = zend_llist_get_first_ex(&sapi_headers->headers, &pos); + while (h) { + PHPWRITE_H(h->header, h->header_len); + PHPWRITE_H("\r\n", 2); + h = zend_llist_get_next_ex(&sapi_headers->headers, &pos); } - PHPWRITE_H("\r\n", 2); + + return SAPI_HEADER_SENT_SUCCESSFULLY; } @@ -297,8 +309,8 @@ php_error, /* error handler */ NULL, /* header handler */ - NULL, /* send headers handler */ - sapi_cgi_send_header, /* send header handler */ + sapi_cgi_send_headers, /* send headers handler */ + NULL, /* send header handler */ sapi_cgi_read_post, /* read POST data */ sapi_cgi_read_cookies, /* read Cookies */

« previous php.cvs (#12686) next »