com php-src: increase the internal post data buffer: main/php_variables.c

From: Date: Sat, 23 May 2015 16:44:39 +0000
Subject: com php-src: increase the internal post data buffer: main/php_variables.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-86889@lists.php.net to get a copy of this message
Commit: f3cec08e65ef956785bffd918ce867bfb7dd436a Author: Anatol Belski <ab@php.net> Sat, 23 May 2015 18:44:39 +0200 Parents: 0bc3a74334473c2371b7a9bb427783588290badd Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f3cec08e65ef956785bffd918ce867bfb7dd436a Log: 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. Changed paths: M main/php_variables.c Diff: diff --git a/main/php_variables.c b/main/php_variables.c index 049770e..fa7d559 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) {

« previous php.cvs (#86889) next »