mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
@- Fix a problem when dealing with large POST blocks in CGI mode
This commit is contained in:
parent
eb224c7850
commit
53586378b0
14
main/SAPI.c
14
main/SAPI.c
@ -160,27 +160,27 @@ static void sapi_read_post_data(SLS_D)
|
||||
|
||||
SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
|
||||
{
|
||||
int read_bytes, total_read_bytes=0;
|
||||
int read_bytes;
|
||||
int allocated_bytes=SAPI_POST_BLOCK_SIZE+1;
|
||||
|
||||
SG(request_info).post_data = emalloc(allocated_bytes);
|
||||
|
||||
for (;;) {
|
||||
read_bytes = sapi_module.read_post(SG(request_info).post_data+total_read_bytes, SAPI_POST_BLOCK_SIZE SLS_CC);
|
||||
read_bytes = sapi_module.read_post(SG(request_info).post_data+SG(read_post_bytes), SAPI_POST_BLOCK_SIZE SLS_CC);
|
||||
if (read_bytes<=0) {
|
||||
break;
|
||||
}
|
||||
total_read_bytes += read_bytes;
|
||||
SG(read_post_bytes) += read_bytes;
|
||||
if (read_bytes < SAPI_POST_BLOCK_SIZE) {
|
||||
break;
|
||||
}
|
||||
if (total_read_bytes+SAPI_POST_BLOCK_SIZE >= allocated_bytes) {
|
||||
allocated_bytes = total_read_bytes+SAPI_POST_BLOCK_SIZE+1;
|
||||
if (SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE >= allocated_bytes) {
|
||||
allocated_bytes = SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE+1;
|
||||
SG(request_info).post_data = erealloc(SG(request_info).post_data, allocated_bytes);
|
||||
}
|
||||
}
|
||||
SG(request_info).post_data[total_read_bytes] = 0; /* terminating NULL */
|
||||
SG(request_info).post_data_length = total_read_bytes;
|
||||
SG(request_info).post_data[SG(read_post_bytes)] = 0; /* terminating NULL */
|
||||
SG(request_info).post_data_length = SG(read_post_bytes);
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,7 +95,7 @@ typedef struct {
|
||||
void *server_context;
|
||||
sapi_request_info request_info;
|
||||
sapi_headers_struct sapi_headers;
|
||||
uint read_post_bytes;
|
||||
int read_post_bytes;
|
||||
unsigned char headers_sent;
|
||||
struct stat global_stat;
|
||||
char *default_mimetype;
|
||||
|
Loading…
Reference in New Issue
Block a user