summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2007-05-15 08:17:08 +0000
committerDmitry Stogov <dmitry@php.net>2007-05-15 08:17:08 +0000
commit633aff55410ddaea32fb28547b5655c8f7bffc11 (patch)
treede4b2691be1326b827c563a2a6f5ebbc7c9c45ad /sapi
parent727109283d60b296bb0dbf91dcf4a0996a42b286 (diff)
downloadphp-git-633aff55410ddaea32fb28547b5655c8f7bffc11.tar.gz
Fixed bug #41378 (fastcgi protocol lacks support for Reason-Phrase in "Status:" header)
Diffstat (limited to 'sapi')
-rw-r--r--sapi/cgi/cgi_main.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 473a074231..b59a3994aa 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -331,7 +331,16 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
}
} else {
- len = slprintf(buf, sizeof(buf), "Status: %d\r\n", SG(sapi_headers).http_response_code);
+ char *s;
+
+ if (SG(sapi_headers).http_status_line &&
+ (s = strchr(SG(sapi_headers).http_status_line, ' ')) != 0 &&
+ (s - SG(sapi_headers).http_status_line) >= 5 &&
+ strncasecmp(SG(sapi_headers).http_status_line, "HTTP/", 5) == 0) {
+ len = slprintf(buf, sizeof(buf), "Status:%s\r\n", s);
+ } else {
+ len = slprintf(buf, sizeof(buf), "Status: %d\r\n", SG(sapi_headers).http_response_code);
+ }
}
PHPWRITE_H(buf, len);