From 501ed6ccb2a47ba3354b2881e08ffbcc0bf4809b Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 30 Apr 2002 00:30:00 +0000 Subject: [PATCH] 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. --- ext/standard/http_fopen_wrapper.c | 13 ++++++++----- 1 file 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; } -- 2.40.0