summaryrefslogtreecommitdiff
path: root/ext/standard/http_fopen_wrapper.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2002-04-30 00:30:00 +0000
committerWez Furlong <wez@php.net>2002-04-30 00:30:00 +0000
commit501ed6ccb2a47ba3354b2881e08ffbcc0bf4809b (patch)
treeed30e40d6353d0cbc87549538ff8661db7489de1 /ext/standard/http_fopen_wrapper.c
parent760573695c00921198363f16b4ac414954e66478 (diff)
downloadphp-git-501ed6ccb2a47ba3354b2881e08ffbcc0bf4809b.tar.gz
Make use of new flag so that we can buffer http headers when we know that
the stream is not intended to be used in require/include.
Diffstat (limited to 'ext/standard/http_fopen_wrapper.c')
-rw-r--r--ext/standard/http_fopen_wrapper.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index c356191d1c..54cc329ad4 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -104,7 +104,8 @@ php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, ch
goto out;
/* avoid buffering issues while reading header */
- chunk_size = php_stream_sock_set_chunk_size(stream, 1 TSRMLS_CC);
+ if (options & STREAM_WILL_CAST)
+ chunk_size = php_stream_sock_set_chunk_size(stream, 1 TSRMLS_CC);
php_stream_context_set(stream, context);
@@ -199,10 +200,12 @@ php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, ch
} else {
switch(response_code) {
case 403:
- php_stream_notify_error(context, PHP_STREAM_NOTIFY_AUTH_RESULT, tmp_line, response_code);
+ php_stream_notify_error(context, PHP_STREAM_NOTIFY_AUTH_RESULT,
+ tmp_line, response_code);
break;
default:
- php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE, tmp_line, response_code);
+ php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE,
+ tmp_line, response_code);
}
}
@@ -332,7 +335,8 @@ out:
if (stream) {
stream->wrapperdata = response_header;
php_stream_notify_progress_init(context, 0, file_size);
- php_stream_sock_set_chunk_size(stream, chunk_size TSRMLS_CC);
+ if (options & STREAM_WILL_CAST)
+ php_stream_sock_set_chunk_size(stream, chunk_size TSRMLS_CC);
}
if (response_header) {
@@ -342,7 +346,6 @@ out:
zval_copy_ctor(sym);
ZEND_SET_SYMBOL(EG(active_symbol_table), "http_response_header", sym);
}
-
return stream;
}