Bug #15296 Updated: ftp_getresp()'s bug when ftp server returns multiple response code
| From: | sniper@php.net | Date: | Thu, 11 Jul 2002 03:18:35 +0000 |
| Subject: | Bug #15296 Updated: ftp_getresp()'s bug when ftp server returns multiple response code | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-13803@lists.php.net to get a copy of this message | ||
ID: 15296
Updated by: sniper@php.net
Reported By: yiwakiri@st.rim.or.jp
-Status: Open
+Status: Closed
Bug Type: FTP related
Operating System: Maybe All platform
PHP Version: 4.1.1
New Comment:
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a
documentation
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2002-01-30 04:59:32] yiwakiri@st.rim.or.jp
Hello.
When ftp-server returns multiple response code, ftp_nlist() and
ftp_rawlist() is hung.
First response code is set normaly.
but second response code isn't set and ftp_get_resp() triing call
ftp_readline() until ftp-timeout.
I change ftp_getresp in ftp.c
int
ftp_getresp(ftpbuf_t *ftp)
{
char *buf;
if (ftp == NULL) return 0;
buf = ftp->inbuf;
ftp->resp = 0;
while (1) {
if (!ftp_readline(ftp)) {
return 0;
}
/* Break out when the end-tag is found */
if (isdigit(ftp->inbuf[0]) &&
isdigit(ftp->inbuf[1]) &&
isdigit(ftp->inbuf[2]) &&
ftp->inbuf[3] == ' ') {
break;
}
}
/* translate the tag */
if (!isdigit(ftp->inbuf[0]) ||
!isdigit(ftp->inbuf[1]) ||
!isdigit(ftp->inbuf[2]))
{
return 0;
}
ftp->resp = 100 * (ftp->inbuf[0] - '0') +
10 * (ftp->inbuf[1] - '0') +
(ftp->inbuf[2] - '0');
memmove(ftp->inbuf, ftp->inbuf + 4, FTP_BUFSIZE - 4);
if(ftp->extra)
ftp-extra -= 4;
return 1;
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15296&edit=1