cvs: php4 /ext/standard http_fopen_wrapper.c
| From: | Wez Furlong | Date: | Mon, 28 Apr 2003 14:41:36 +0000 |
| Subject: | cvs: php4 /ext/standard http_fopen_wrapper.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20534@lists.php.net to get a copy of this message | ||
wez Mon Apr 28 10:41:36 2003 EDT
Modified files:
/php4/ext/standard http_fopen_wrapper.c
Log:
Fix for #23340; fopen on multiple urls from the same server crashes.
Index: php4/ext/standard/http_fopen_wrapper.c
diff -u php4/ext/standard/http_fopen_wrapper.c:1.71 php4/ext/standard/http_fopen_wrapper.c:1.72
--- php4/ext/standard/http_fopen_wrapper.c:1.71 Mon Apr 14 09:55:34 2003
+++ php4/ext/standard/http_fopen_wrapper.c Mon Apr 28 10:41:36 2003
@@ -18,7 +18,7 @@
| Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: http_fopen_wrapper.c,v 1.71 2003/04/14 13:55:34 iliaa Exp $ */
+/* $Id: http_fopen_wrapper.c,v 1.72 2003/04/28 14:41:36 wez Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -305,14 +305,21 @@
location[0] = '\0';
+ if (!header_init && FAILURE == zend_hash_find(EG(active_symbol_table),
+ "http_response_header", sizeof("http_response_header"), (void **)
&response_header)) {
+ header_init = 1;
+ }
+
if (header_init) {
zval *tmp;
MAKE_STD_ZVAL(tmp);
array_init(tmp);
ZEND_SET_SYMBOL(EG(active_symbol_table), "http_response_header", tmp);
+
+ zend_hash_find(EG(active_symbol_table),
+ "http_response_header", sizeof("http_response_header"), (void **)
&response_header);
}
- zend_hash_find(EG(active_symbol_table), "http_response_header",
sizeof("http_response_header"), (void **) &response_header);
if (!php_stream_eof(stream)) {
/* get response header */
@@ -322,6 +329,8 @@
int response_code;
MAKE_STD_ZVAL(http_response);
+ ZVAL_NULL(http_response);
+
response_code = atoi(tmp_line + 9);
switch(response_code) {
case 200:
@@ -365,6 +374,7 @@
int http_header_line_length;
http_header_line[HTTP_HEADER_BLOCK_SIZE-1] = '\0';
+
p = http_header_line;
while(*p) {
while(*p == '\n' || *p == '\r') {
@@ -478,6 +488,7 @@
if (stream) {
if (header_init) {
stream->wrapperdata = *response_header;
+ zval_add_ref(response_header);
}
php_stream_notify_progress_init(context, 0, file_size);
/* Restore original chunk size now that we're done with headers */