diff options
author | Anatol Belski <ab@php.net> | 2015-05-23 18:44:39 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2015-05-23 18:44:39 +0200 |
commit | f3cec08e65ef956785bffd918ce867bfb7dd436a (patch) | |
tree | c75d64ad669ee19e0f628d68111ce24d78af6eaa /main | |
parent | 0bc3a74334473c2371b7a9bb427783588290badd (diff) | |
download | php-git-f3cec08e65ef956785bffd918ce867bfb7dd436a.tar.gz |
increase the internal post data buffer
This brings speedup and fixes issues with var parsing. Default BUFSIZ
on Windows is 512 bytes which causes too much reallocation work.
Diffstat (limited to 'main')
-rw-r--r-- | main/php_variables.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/main/php_variables.c b/main/php_variables.c index 049770ebe1..fa7d5591df 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -310,6 +310,11 @@ static inline int add_post_vars(zval *arr, post_var_data_t *vars, zend_bool eof return SUCCESS; } +#ifdef PHP_WIN32 +#define SAPI_POST_HANDLER_BUFSIZ 16384 +#else +# define SAPI_POST_HANDLER_BUFSIZ BUFSIZ +#endif SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler) { zval *arr = (zval *) arg; @@ -320,8 +325,8 @@ SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler) memset(&post_data, 0, sizeof(post_data)); while (!php_stream_eof(s)) { - char buf[BUFSIZ] = {0}; - size_t len = php_stream_read(s, buf, BUFSIZ); + char buf[SAPI_POST_HANDLER_BUFSIZ] = {0}; + size_t len = php_stream_read(s, buf, SAPI_POST_HANDLER_BUFSIZ); if (len && len != (size_t) -1) { smart_str_appendl(&post_data.str, buf, len); @@ -334,7 +339,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler) } } - if (len != BUFSIZ){ + if (len != SAPI_POST_HANDLER_BUFSIZ){ break; } } @@ -345,6 +350,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler) } } } +#undef SAPI_POST_HANDLER_BUFSIZ SAPI_API SAPI_INPUT_FILTER_FUNC(php_default_input_filter) { |