summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/SAPI.c7
-rw-r--r--main/SAPI.h1
-rw-r--r--sapi/aolserver/aolserver.c5
-rw-r--r--sapi/apache/mod_php4.c6
-rw-r--r--sapi/cgi/cgi_main.c5
-rw-r--r--sapi/isapi/php4isapi.c5
-rw-r--r--sapi/nsapi/nsapi.c6
-rw-r--r--sapi/phttpd/phttpd.c5
-rw-r--r--sapi/pi3web/pi3web_sapi.c5
-rw-r--r--sapi/roxen/roxen.c5
-rw-r--r--sapi/servlet/servlet.c5
-rw-r--r--sapi/thttpd/thttpd.c5
12 files changed, 8 insertions, 52 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
index 14ddf856c5..8e838c526e 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -277,17 +277,14 @@ SAPI_API void sapi_activate(SLS_D)
SG(request_info).current_user = NULL;
SG(request_info).current_user_length = 0;
-#if 0
- /* This can't be done here. We need to do that in the individual SAPI
- * modules because you can actually have a GET request that is only
- * allowed to send back headers.
+ /* It's possible to override this general case in the activate() callback, if
+ * necessary.
*/
if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) {
SG(request_info).headers_only = 1;
} else {
SG(request_info).headers_only = 0;
}
-#endif
if (SG(server_context)) {
if (SG(request_info).request_method
diff --git a/main/SAPI.h b/main/SAPI.h
index 52f41864f0..18fcbbff66 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -100,6 +100,7 @@ typedef struct {
struct stat global_stat;
char *default_mimetype;
char *default_charset;
+ HashTable *rfc_1867_uploaded_files;
} sapi_globals_struct;
diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c
index 0a8a33397a..8e18fa48f4 100644
--- a/sapi/aolserver/aolserver.c
+++ b/sapi/aolserver/aolserver.c
@@ -458,11 +458,6 @@ php_ns_request_ctor(NSLS_D SLS_DC)
index = Ns_SetIFind(NSG(conn)->headers, "content-type");
SG(request_info).content_type = index == -1 ? NULL :
Ns_SetValue(NSG(conn)->headers, index);
- if (!strcmp(NSG(conn)->request->method, "HEAD")) {
- SG(request_info).headers_only = 1;
- } else {
- SG(request_info).headers_only = 0;
- }
SG(sapi_headers).http_response_code = 200;
tmp = Ns_ConnAuthUser(NSG(conn));
diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c
index 9999e0fdaa..0d2fbecc7a 100644
--- a/sapi/apache/mod_php4.c
+++ b/sapi/apache/mod_php4.c
@@ -305,6 +305,11 @@ static int php_apache_sapi_activate(SLS_D)
block_alarms();
register_cleanup(((request_rec *) SG(server_context))->pool, NULL, php_apache_request_shutdown, php_request_shutdown_for_exec);
unblock_alarms();
+
+ /* Override the default headers_only value - sometimes "GET" requests should actually only
+ * send headers.
+ */
+ SG(request_info).headers_only = r->header_only;
return SUCCESS;
}
@@ -379,7 +384,6 @@ static void init_request_info(SLS_D)
SG(request_info).request_method = (char *)r->method;
SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
- SG(request_info).headers_only = r->header_only;
SG(sapi_headers).http_response_code = r->status;
if (r->headers_in) {
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 6b57cffba4..5240c4ac44 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -316,11 +316,6 @@ static void init_request_info(SLS_D)
SG(request_info).content_type = getenv("CONTENT_TYPE");
SG(request_info).content_length = (content_length?atoi(content_length):0);
SG(sapi_headers).http_response_code = 200;
- if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) {
- SG(request_info).headers_only = 1;
- } else {
- SG(request_info).headers_only = 0;
- }
/* CGI does not support HTTP authentication */
SG(request_info).auth_user = NULL;
SG(request_info).auth_password = NULL;
diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c
index 75c2d50e07..61450d0d24 100644
--- a/sapi/isapi/php4isapi.c
+++ b/sapi/isapi/php4isapi.c
@@ -475,11 +475,6 @@ static void init_request_info(sapi_globals_struct *sapi_globals, LPEXTENSION_CON
SG(request_info).content_type = lpECB->lpszContentType;
SG(request_info).content_length = lpECB->cbTotalBytes;
SG(sapi_headers).http_response_code = 200; /* I think dwHttpStatusCode is invalid at this stage -RL */
- if (!strcmp(lpECB->lpszMethod, "HEAD")) {
- SG(request_info).headers_only = 1;
- } else {
- SG(request_info).headers_only = 0;
- }
if (!bFilterLoaded) { /* we don't have valid ISAPI Filter information */
SG(request_info).auth_user = SG(request_info).auth_password = NULL;
}
diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c
index 210ac1766f..70b002b6c3 100644
--- a/sapi/nsapi/nsapi.c
+++ b/sapi/nsapi/nsapi.c
@@ -479,12 +479,6 @@ nsapi_request_ctor(NSLS_D SLS_DC)
SG(request_info).content_type = nsapi_strdup(content_type);
SG(request_info).content_length = (content_length == NULL) ? 0 : strtoul(content_length, 0, 0);
SG(sapi_headers).http_response_code = 200;
- if (!strcmp(request_method, "HEAD")) {
- SG(request_info).headers_only = 1;
- } else {
- SG(request_info).headers_only = 0;
- }
-
}
static void
diff --git a/sapi/phttpd/phttpd.c b/sapi/phttpd/phttpd.c
index 72d81f401a..4bedea5675 100644
--- a/sapi/phttpd/phttpd.c
+++ b/sapi/phttpd/phttpd.c
@@ -203,11 +203,6 @@ php_phttpd_request_ctor(PHLS_D SLS_DC)
SG(request_info).request_method = PHG(cip)->hip->method;
SG(request_info).path_translated = malloc(MAXPATHLEN+1);
SG(sapi_headers).http_response_code = 200;
- if (!strcmp(PHG(cip)->hip->method, "HEAD")) {
- SG(request_info).headers_only = 1;
- } else {
- SG(request_info).headers_only = 0;
- }
if (url_expand(PHG(cip)->hip->url, SG(request_info).path_translated, MAXPATHLEN, &PHG(sb), NULL, NULL) == NULL) {
/* handle error */
}
diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c
index bd89121457..0f148f632a 100644
--- a/sapi/pi3web/pi3web_sapi.c
+++ b/sapi/pi3web/pi3web_sapi.c
@@ -319,11 +319,6 @@ static void init_request_info(sapi_globals_struct *sapi_globals, LPCONTROL_BLOCK
SG(request_info).auth_user = lpCB->lpszUser;
SG(request_info).auth_password = lpCB->lpszPassword;
SG(sapi_headers).http_response_code = 200;
- if (!strcmp(lpCB->lpszMethod, "HEAD")) {
- SG(request_info).headers_only = 1;
- } else {
- SG(request_info).headers_only = 0;
- }
}
static void hash_pi3web_variables(ELS_D SLS_DC)
diff --git a/sapi/roxen/roxen.c b/sapi/roxen/roxen.c
index b2c0dbf8e5..594ca16819 100644
--- a/sapi/roxen/roxen.c
+++ b/sapi/roxen/roxen.c
@@ -660,11 +660,6 @@ void f_php_roxen_request_handler(INT32 args)
SG(request_info).content_length = lookup_integer_header("HTTP_CONTENT_LENGTH", 0);
SG(request_info).content_type = lookup_string_header("HTTP_CONTENT_TYPE", NULL);
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 = 0;
- }
/* FIXME: Check for auth stuff needs to be fixed... */
SG(request_info).auth_user = NULL;
diff --git a/sapi/servlet/servlet.c b/sapi/servlet/servlet.c
index edea63bb67..1227a79f68 100644
--- a/sapi/servlet/servlet.c
+++ b/sapi/servlet/servlet.c
@@ -357,11 +357,6 @@ JNIEXPORT void JNICALL Java_net_php_servlet_send
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 = 0;
- }
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) {
diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c
index 81a22a7f44..1dc2b11b2f 100644
--- a/sapi/thttpd/thttpd.c
+++ b/sapi/thttpd/thttpd.c
@@ -234,11 +234,6 @@ 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;