From 49de3e701c6e1a1de2bd8336645b6595fa4fe72e Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Thu, 10 Mar 2005 23:38:18 +0000 Subject: [PATCH] MFH: Final set of fixes for bug #27633. --- ext/ftp/ftp.c | 21 ++------------------- ext/ftp/php_ftp.c | 4 ++++ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 6427974faf..e2ce52db6f 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -713,25 +713,8 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, * Everything Else \n */ #ifdef PHP_WIN32 - while ((s = strpbrk(ptr, "\r\n")) && (s < e)) { - php_stream_write(outstream, ptr, (s - ptr)); - 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_stream_write(outstream, ptr, (e - ptr)); + ptr = e; #else while (e > ptr && (s = memchr(ptr, '\r', (e - ptr)))) { php_stream_write(outstream, ptr, (s - ptr)); diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 6474115cb8..092b818730 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -602,6 +602,10 @@ PHP_FUNCTION(ftp_get) RETURN_FALSE; } +#ifdef PHP_WIN32 + mode = FTPTYPE_IMAGE; +#endif + if (ftp->autoseek && resumepos) { if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? "rt+" : "rb+", CHECKUID_CHECK_MODE_PARAM))) { RETURN_FALSE; -- 2.50.1