diff options
author | Sascha Schumann <sas@php.net> | 2002-07-03 11:44:48 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 2002-07-03 11:44:48 +0000 |
commit | 99cfb41da0c11b417cb276ed240c749524d356d6 (patch) | |
tree | e2102f89e44812bbb30a78ae994c7869cd0cff7f | |
parent | 9dcfbf41fa9cd92c38dd550e9e4afa6a48fe082d (diff) | |
download | php-git-99cfb41da0c11b417cb276ed240c749524d356d6.tar.gz |
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
-rw-r--r-- | sapi/cgi/cgi_main.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index c51c2c59c2..cfd69d9f2b 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -201,12 +201,24 @@ static void sapi_cgibin_flush(void *server_context) } -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 @@ static sapi_module_struct cgi_sapi_module = { 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 */ |