iliaa Thu Feb 17 10:38:35 2005 EDT Modified files: (Branch: PHP_4_3) /php-src NEWS /php-src/ext/ftp ftp.c Log: MFH: Fixed bug #27633 (Double \r problem on ftp_get in ASCII mode on Win32). http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.837&r2=1.1247.2.838&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.837 php-src/NEWS:1.1247.2.838 --- php-src/NEWS:1.1247.2.837 Wed Feb 16 23:46:52 2005 +++ php-src/NEWS Thu Feb 17 10:38:33 2005 @@ -77,6 +77,7 @@ - Fixed bug #28086 (crash inside overload() function). (Tony) - Fixed bug #28074 (FastCGI: stderr should be written in a FCGI stderr stream). (chris at ex-parrot dot com) +- Fixed bug #27633 (Double \r problem on ftp_get in ASCII mode on Win32). (Ilia) - Fixed bug #7782 (Cannot use PATH_INFO fully with php isapi). (Unknown) 15 Dec 2004, Version 4.3.10 http://cvs.php.net/diff.php/php-src/ext/ftp/ftp.c?r1=1.68.2.18&r2=1.68.2.19&ty=u Index: php-src/ext/ftp/ftp.c diff -u php-src/ext/ftp/ftp.c:1.68.2.18 php-src/ext/ftp/ftp.c:1.68.2.19 --- php-src/ext/ftp/ftp.c:1.68.2.18 Tue Oct 5 19:55:21 2004 +++ php-src/ext/ftp/ftp.c Thu Feb 17 10:38:34 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ftp.c,v 1.68.2.18 2004/10/05 23:55:21 iliaa Exp $ */ +/* $Id: ftp.c,v 1.68.2.19 2005/02/17 15:38:34 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -713,16 +713,22 @@ * Everything Else \n */ #ifdef PHP_WIN32 - while ((s = strpbrk(ptr, "\r\n"))) { - if (*s == '\n') { - php_stream_putc(outstream, '\r'); - } else if (*s == '\r' && *(s + 1) == '\n') { - s++; - } - s++; + while ((s = strpbrk(ptr, "\r\n")) && (s < e)) { php_stream_write(outstream, ptr, (s - ptr)); - if (*(s - 1) == '\r') { - php_stream_putc(outstream, '\n'); + php_stream_write(outstream, "\r\n", sizeof("\r\n")-1); + + if (*s == '\r') { + *s++; + } + /* for some reason some servers prefix a \r before a \n, + * resulting in a \r\r\n in the buffer when + * the remote file already has windoze style line endings. + */ + if (*s == '\r') { + *s++; + } + if (*s == '\n') { + *s++; } ptr = s; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php