]> granicus.if.org Git - php/commitdiff
Make use of new flag so that we can buffer http headers when we know that
authorWez Furlong <wez@php.net>
Tue, 30 Apr 2002 00:30:00 +0000 (00:30 +0000)
committerWez Furlong <wez@php.net>
Tue, 30 Apr 2002 00:30:00 +0000 (00:30 +0000)
the stream is not intended to be used in require/include.

ext/standard/http_fopen_wrapper.c

index c356191d1cadcb4ee1b367a503613dd3797cf061..54cc329ad491f588cf06f66c0014a5adc0d9f3a6 100644 (file)
@@ -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;
 }