cvs: /php4 SAPI.c SAPI.h
| From: | Zeev Suraski | Date: | Sat, 01 Apr 2000 01:12:09 +0000 |
| Subject: | cvs: /php4 SAPI.c SAPI.h | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-12967@lists.php.net to get a copy of this message | ||
zeev Fri Mar 31 17:12:09 2000 EDT
Modified files:
/php4 SAPI.c SAPI.h
Log:
@- Fix a problem when dealing with large POST blocks in CGI mode
Index: php4/SAPI.c
diff -u php4/SAPI.c:1.68 php4/SAPI.c:1.69
--- php4/SAPI.c:1.68 Thu Mar 30 09:55:50 2000
+++ php4/SAPI.c Fri Mar 31 17:11:39 2000
@@ -160,27 +160,27 @@
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);
}
Index: php4/SAPI.h
diff -u php4/SAPI.h:1.44 php4/SAPI.h:1.45
--- php4/SAPI.h:1.44 Mon Mar 20 00:19:51 2000
+++ php4/SAPI.h Fri Mar 31 17:11:39 2000
@@ -95,7 +95,7 @@
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;