summaryrefslogtreecommitdiff
path: root/sapi/thttpd/thttpd.c
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2000-08-02 22:48:45 +0000
committerRasmus Lerdorf <rasmus@php.net>2000-08-02 22:48:45 +0000
commit76a2d2538c42934341a6257f0ba54723048116df (patch)
tree14d2b166c0d75444a9ec6d3be15d45c5154c6c15 /sapi/thttpd/thttpd.c
parentf896b9a354af45508431900a70f7af9ce943aba4 (diff)
downloadphp-git-76a2d2538c42934341a6257f0ba54723048116df.tar.gz
Heads up! I have moved the headers_only and response_code checks out of
SAPI and down into the individual SAPI modules. I have made the appropriate changes in all the SAPI modules, but please verify these. The reason for this change is that Apache sometimes will feed PHP a request_method of GET but have r->header_only set to true. This happens in an ErrorDocument redirect. In this same scenario we want to preserve the status code as well instead of just overwriting it with a 200 and losing this information. For now the other sapi modules act exactly as before since they probably do not make this distinction, and they may not even have a valid response code this early in the request. @ Fix HEAD request bug on an Apache ErrorDocument redirect and preserve @ the status code across the redirect as well. (Rasmus)
Diffstat (limited to 'sapi/thttpd/thttpd.c')
-rw-r--r--sapi/thttpd/thttpd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c
index a9fe305b03..daef768dfc 100644
--- a/sapi/thttpd/thttpd.c
+++ b/sapi/thttpd/thttpd.c
@@ -245,7 +245,12 @@ static void thttpd_request_ctor(TLS_D SLS_DC)
snprintf(buf, 1023, "/%s", TG(hc)->origfilename);
SG(request_info).request_uri = strdup(buf);
SG(request_info).request_method = httpd_method_str(TG(hc)->method);
-
+ if (!strcmp(SG(request_info).request_method, "HEAD")) {
+ SG(request_info).headers_only = 1;
+ } else {
+ SG(request_info).headers_only = 0;
+ }
+ SG(sapi_headers).http_response_code = 200;
SG(request_info).content_type = TG(hc)->contenttype;
SG(request_info).content_length = TG(hc)->contentlength;