wez             Thu Feb 13 08:42:32 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php4/ext/standard  http_fopen_wrapper.c 
  Log:
  partial MFH: avoid problems with auto_detect_line_endings.
  
  
Index: php4/ext/standard/http_fopen_wrapper.c
diff -u php4/ext/standard/http_fopen_wrapper.c:1.53.2.5 
php4/ext/standard/http_fopen_wrapper.c:1.53.2.6
--- php4/ext/standard/http_fopen_wrapper.c:1.53.2.5     Wed Feb 12 19:42:06 2003
+++ php4/ext/standard/http_fopen_wrapper.c      Thu Feb 13 08:42:31 2003
@@ -18,7 +18,7 @@
    |          Wez Furlong <[EMAIL PROTECTED]>                          |
    +----------------------------------------------------------------------+
  */
-/* $Id: http_fopen_wrapper.c,v 1.53.2.5 2003/02/13 00:42:06 pollita Exp $ */ 
+/* $Id: http_fopen_wrapper.c,v 1.53.2.6 2003/02/13 13:42:31 wez Exp $ */ 
 
 #include "php.h"
 #include "php_globals.h"
@@ -100,6 +100,7 @@
        char *http_header_line = NULL;
        char tmp_line[128];
        size_t chunk_size = 0, file_size = 0;
+       int eol_detect;
 
        if (strchr(mode, 'a') || strchr(mode, '+') || strchr(mode, 'w')) {
                php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP wrapper 
does not support writeable connections.");
@@ -127,6 +128,11 @@
           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);
+       stream->flags &= ~(PHP_STREAM_FLAG_DETECT_EOL | PHP_STREAM_FLAG_EOL_MAC);
        
        php_stream_context_set(stream, context);
 
@@ -405,6 +411,10 @@
                /* Restore original chunk size now that we're done with headers (if 
applicable) */
                if (options & STREAM_WILL_CAST)
                        php_stream_set_chunk_size(stream, chunk_size);
+
+               /* restore the users auto-detect-line-endings setting */
+               stream->flags |= eol_detect;
+
                /* as far as streams are concerned, we are now at the start of
                 * the stream */
                stream->position = 0;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to