From 76a2d2538c42934341a6257f0ba54723048116df Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Wed, 2 Aug 2000 22:48:45 +0000 Subject: 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) --- sapi/servlet/servlet.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sapi/servlet/servlet.c') diff --git a/sapi/servlet/servlet.c b/sapi/servlet/servlet.c index 3f5c7d19ff..2661d8fabe 100644 --- a/sapi/servlet/servlet.c +++ b/sapi/servlet/servlet.c @@ -356,6 +356,12 @@ JNIEXPORT void JNICALL Java_net_php_servlet_send SETSTRING( SG(request_info).query_string, queryString ); SETSTRING( SG(request_info).request_uri, requestURI ); SETSTRING( SG(request_info).content_type, contentType ); + SG(sapi_headers).http_response_code = 200; + if (!strcmp(SG(request_info).request_method, "HEAD")) { + SG(request_info).headers_only = 1; + } else { + SG(request_info).headers_only = 1; + } SG(request_info).content_length = contentLength; SG(request_info).auth_password = NULL; if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) { -- cgit v1.2.1