]> granicus.if.org Git - php/commitdiff
Fix URL reading
authorSascha Schumann <sas@php.net>
Tue, 6 May 2003 11:04:42 +0000 (11:04 +0000)
committerSascha Schumann <sas@php.net>
Tue, 6 May 2003 11:04:42 +0000 (11:04 +0000)
ext/standard/http_fopen_wrapper.c

index 1276e0dcb5ba6b1d86838b435937d9a52dfd0de0..0a4d7f5682cc73c8581926eb116f4ccc51eae9e9 100644 (file)
@@ -136,12 +136,6 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
        if (stream == NULL)     
                goto out;
 
-       /* Ordinarily we'd always reduce chunk_size to 1 to avoid filter problems.
-          However, since 4.3 filter support is extremely limited and will be completely rewritten in 5.0
-          we'll accept the unexpected behavior of filtered http streams in favor of improved performance. */
-       if (options & STREAM_WILL_CAST)
-               chunk_size = php_stream_set_chunk_size(stream, 1);
-
        /* avoid problems with auto-detecting when reading the headers -> the headers
         * are always in canonical \r\n format */
        eol_detect = stream->flags & (PHP_STREAM_FLAG_DETECT_EOL | PHP_STREAM_FLAG_EOL_MAC);
@@ -267,6 +261,15 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
 
        location[0] = '\0';
 
+       /* 
+        * We need to read the HTTP response header one-by-one, because
+        * the original author did not know about MSG_PEEK.
+        * The chunk_size will be reset later, once we have read the
+        * header completely.
+        */
+       if (options & STREAM_WILL_CAST)
+               chunk_size = php_stream_set_chunk_size(stream, 1);
+
        if (!header_init && FAILURE == zend_hash_find(EG(active_symbol_table),
                                "http_response_header", sizeof("http_response_header"), (void **) &response_header)) {
                header_init = 1;