]> granicus.if.org Git - php/commitdiff
Restore the headers_only test to the centralized SAPI startup. If necessary, it can
authorZeev Suraski <zeev@php.net>
Fri, 8 Sep 2000 14:43:57 +0000 (14:43 +0000)
committerZeev Suraski <zeev@php.net>
Fri, 8 Sep 2000 14:43:57 +0000 (14:43 +0000)
be overriden in the activate() callback.

12 files changed:
main/SAPI.c
main/SAPI.h
sapi/aolserver/aolserver.c
sapi/apache/mod_php4.c
sapi/cgi/cgi_main.c
sapi/isapi/php4isapi.c
sapi/nsapi/nsapi.c
sapi/phttpd/phttpd.c
sapi/pi3web/pi3web_sapi.c
sapi/roxen/roxen.c
sapi/servlet/servlet.c
sapi/thttpd/thttpd.c

index 14ddf856c582d0a17ed6abe296f55fe9a1fdd2eb..8e838c526e350ef10928b5ecdd2e9923b7067b8d 100644 (file)
@@ -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 
index 52f41864f0b5205a78c53e2104b20b709fccd5f0..18fcbbff66b128dec0f1431673df58373b22e5fd 100644 (file)
@@ -100,6 +100,7 @@ typedef struct {
        struct stat global_stat;
        char *default_mimetype;
        char *default_charset;
+       HashTable *rfc_1867_uploaded_files;
 } sapi_globals_struct;
 
 
index 0a8a33397aeb6d1c3349519a480b97be3842fcf5..8e18fa48f4a268fa9b1b2db8b9d5271ca3fce3e9 100644 (file)
@@ -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));
index 9999e0fdaa67aefe45c68c53ad272507ccff2c0c..0d2fbecc7a48e2a5979203332d8614a4b8931230 100644 (file)
@@ -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) {
index 6b57cffba46df5750a943ee533f2bedd83fe6d80..5240c4ac446d68b8e8953c0ef2b3aadec5ca6fc2 100644 (file)
@@ -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;
index 75c2d50e07b763fc94cbb73030a71af74d54dab8..61450d0d248894bbf63211f58f22a6fcabc5e6b0 100644 (file)
@@ -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;
        }
index 210ac1766f6328da96a8db748ac6aff7364c93cf..70b002b6c30fbd331c23f347342f8623a6427b60 100644 (file)
@@ -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
index 72d81f401af5823d952619e6dcf3f3cb4575ef34..4bedea56755a98f220a42507ea279e5993105f5f 100644 (file)
@@ -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 */
        }
index bd89121457bb5b49075c8ea03d65575d73f50bf7..0f148f632a24c9995499d8b8590648a5507382c7 100644 (file)
@@ -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)
index b2c0dbf8e59b63c4d72331d3ba847fa231804950..594ca16819afdf44538bee8ac00b50186c15de84 100644 (file)
@@ -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; 
index edea63bb67c53e49b9838a28612df0d89048194f..1227a79f68f15a192191688e7a2527fd6a4c29a5 100644 (file)
@@ -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) {
index 81a22a7f44a34b9dd1f0be8f509b0214ac13f2e0..1dc2b11b2f54872c23c68965c1bcdd7069671752 100644 (file)
@@ -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;