]> granicus.if.org Git - php/commitdiff
Add always_populate_raw_post_data ini directive and default it to 0 to
authorRasmus Lerdorf <rasmus@php.net>
Tue, 17 Jul 2001 16:46:07 +0000 (16:46 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Tue, 17 Jul 2001 16:46:07 +0000 (16:46 +0000)
maintain current behaviour.  If this is turned on then $HTTP_RAW_POST_DATA
is always populated with a copy of the raw post data.
@ - Add config option (always_populate_raw_post_data) which when enabled
@   will always populate $HTTP_RAW_POST_DATA regardless of the post mime
@   type (Rasmus)

main/SAPI.c
main/main.c
main/php_content_types.c
main/php_globals.h

index 499a2f682d54aa8a0a0000ee77e3b0cb0a680f5b..edab6bbe56d400033ca95d1d79896d5fce81e96d 100644 (file)
@@ -125,6 +125,7 @@ static void sapi_read_post_data(SLS_D)
        char *p;
        char oldchar=0;
        void (*post_reader_func)(SLS_D);
+       PLS_FETCH();
 
 
        /* dedicated implementation for increased performance:
@@ -162,6 +163,9 @@ static void sapi_read_post_data(SLS_D)
        }
        post_reader_func(SLS_C);
        SG(request_info).content_type_dup = content_type;
+       if(PG(always_populate_raw_post_data) && sapi_module.default_post_reader) {
+               sapi_module.default_post_reader(SLS_C);
+       }
 }
 
 
index 3b340f6f2ac99c8eec17635b40e417277b7e0664..7b5fcef09b2c844683bfe60832a8a3058757a9a8 100644 (file)
@@ -259,6 +259,7 @@ PHP_INI_BEGIN()
        PHP_INI_ENTRY("disable_functions",                      "",                     PHP_INI_SYSTEM,         NULL)
 
        STD_PHP_INI_ENTRY("allow_url_fopen",            "1",            PHP_INI_ALL,            OnUpdateBool,                   allow_url_fopen,                        php_core_globals,       core_globals)
+       STD_PHP_INI_ENTRY("always_populate_raw_post_data",              "0",            PHP_INI_ALL,            OnUpdateBool,                   always_populate_raw_post_data,                  php_core_globals,       core_globals)
 
 PHP_INI_END()
 /* }}} */
index a9c8b1d781ccde57e0df6e591f5b95296f3d4702..23ca6397b35bc82f43d83f53cef5b9be3f612035 100644 (file)
@@ -40,7 +40,7 @@ SAPI_POST_READER_FUNC(php_default_post_reader)
        char *data;
        ELS_FETCH();
 
-       sapi_read_standard_form_data(SLS_C);
+       if(!SG(request_info).post_data) sapi_read_standard_form_data(SLS_C);
        data = estrndup(SG(request_info).post_data,SG(request_info).post_data_length);
        SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, SG(request_info).post_data_length);
 }
index 56de68d7e1aefd4682e67b1bb457734f16c6c16e..bdcf3acc6056dd84ed97c44d2724febd81230821 100644 (file)
@@ -136,6 +136,8 @@ struct _php_core_globals {
        zend_bool during_request_startup;
 
        zend_bool allow_url_fopen;
+
+       zend_bool always_populate_raw_post_data;
 };