ID: 41378 Updated by: [EMAIL PROTECTED] Reported By: anight at eyelinkmedia dot com -Status: Open +Status: Assigned Bug Type: HTTP related Operating System: any PHP Version: 5.2.2 Assigned To: dmitry
Previous Comments: ------------------------------------------------------------------------ [2007-05-12 18:56:49] anight at eyelinkmedia dot com proposed patch: --- sapi/cgi/cgi_main.c 2007-02-16 14:47:20.000000000 +0300 +++ sapi/cgi/cgi_main.c 2007-05-11 16:48:37.000000000 +0400 @@ -329,8 +329,22 @@ } } else { + if (SG(sapi_headers).http_status_line) { + char *ptr; + for (ptr = SG(sapi_headers).http_status_line; *ptr; ptr++) { + if (*ptr == ' ' && *(ptr + 1) != ' ' && *(ptr + 1) != 0) { + len = snprintf(buf, SAPI_CGI_MAX_HEADER_LENGTH, + "Status: %s\r\n", ptr + 1); + if (len > SAPI_CGI_MAX_HEADER_LENGTH) { + len = SAPI_CGI_MAX_HEADER_LENGTH; + } + goto done; + } + } + } len = sprintf(buf, "Status: %d\r\n", SG(sapi_headers).http_response_code); } +done: PHPWRITE_H(buf, len); } ------------------------------------------------------------------------ [2007-05-12 18:52:51] anight at eyelinkmedia dot com Description: ------------ Right now there is no way to set application-defined "Reason-Phrase" (as defined in rfc2616) along with Status-Code in a Status-Line of http response for fastcgi sapi. This affects php-4.4.7 too (fastcgi module based on same code). Fastcgi specs says: http://www.fastcgi.com/devkit/doc/fcgi-spec.html 6.1 Role Protocols [skipped] Role protocols do not support the non-parsed header feature of CGI. FastCGI applications set response status using the Status and Location CGI headers. As I understand, the only way to specify Reason-Phrase is to pass it via Status: header. This header itself will not reach a client, because it is only valid within fastcgi protocol. Reproduce code: --------------- <? header("HTTP/1.0 404 Not Found"); ?> Expected result: ---------------- web server respond with "HTTP/1.1 404 Not Found" status line. Actual result: -------------- web server respond with "HTTP/1.1 404" status line. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41378&edit=1