mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
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.
This commit is contained in:
parent
0bc3a74334
commit
f3cec08e65
1 changed files with 9 additions and 3 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue