Permalink
Browse files

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)
  • Loading branch information...
1 parent 6bd084c commit 9bc97ac865c74495622d4d71c3a84c9d65c8baf7 @rlerdorf rlerdorf committed Jul 17, 2001
Showing with 8 additions and 1 deletion.
  1. +4 −0 main/SAPI.c
  2. +1 −0 main/main.c
  3. +1 −1 main/php_content_types.c
  4. +2 −0 main/php_globals.h
View
4 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);
+ }
}
View
1 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()
/* }}} */
View
2 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);
}
View
2 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;
};

0 comments on commit 9bc97ac

Please sign in to comment.