From 9bc97ac865c74495622d4d71c3a84c9d65c8baf7 Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Tue, 17 Jul 2001 16:46:07 +0000 Subject: [PATCH] Add always_populate_raw_post_data ini directive and default it to 0 to 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 | 4 ++++ main/main.c | 1 + main/php_content_types.c | 2 +- main/php_globals.h | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/main/SAPI.c b/main/SAPI.c index 499a2f682d..edab6bbe56 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -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); + } } diff --git a/main/main.c b/main/main.c index 3b340f6f2a..7b5fcef09b 100644 --- a/main/main.c +++ b/main/main.c @@ -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() /* }}} */ diff --git a/main/php_content_types.c b/main/php_content_types.c index a9c8b1d781..23ca6397b3 100644 --- a/main/php_content_types.c +++ b/main/php_content_types.c @@ -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); } diff --git a/main/php_globals.h b/main/php_globals.h index 56de68d7e1..bdcf3acc60 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -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; }; -- 2.50.1