iliaa Thu Feb 17 10:38:08 2005 EDT
Modified files: (Branch: PHP_5_0)
/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.1760.2.247&r2=1.1760.2.248&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1760.2.247 php-src/NEWS:1.1760.2.248
--- php-src/NEWS:1.1760.2.247 Wed Feb 16 23:46:09 2005
+++ php-src/NEWS Thu Feb 17 10:38:06 2005
@@ -117,6 +117,7 @@
- Fixed bug #28074 (FastCGI: stderr should be written in a FCGI stderr stream).
(chris at ex-parrot dot com)
- Fixed bug #28041 (SOAP HTTP Digest Access Authentication). (Dmitry)
+- Fixed bug #27633 (Double \r problem on ftp_get in ASCII mode on Win32).
(Ilia)
15 Dec 2004, PHP 5.0.3
- Added the %F modifier to *printf to render a non-locale-aware representation
http://cvs.php.net/diff.php/php-src/ext/ftp/ftp.c?r1=1.103.2.3&r2=1.103.2.4&ty=u
Index: php-src/ext/ftp/ftp.c
diff -u php-src/ext/ftp/ftp.c:1.103.2.3 php-src/ext/ftp/ftp.c:1.103.2.4
--- php-src/ext/ftp/ftp.c:1.103.2.3 Wed Jan 5 04:40:49 2005
+++ php-src/ext/ftp/ftp.c Thu Feb 17 10:38:07 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ftp.c,v 1.103.2.3 2005/01/05 09:40:49 hyanantha Exp $ */
+/* $Id: ftp.c,v 1.103.2.4 2005/02/17 15:38:07 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -846,16 +846,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