Date: 10/20/98
- Next message: and <email protected>: "[PHP-DEV] Bug #860: dirname() is incorrectly described"
- Previous message: Bug Database: "[PHP-DEV] Bug #853 Updated: doesn't work with apache 1.3.3"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: and <email protected>
Operating system: Digital Unix 3.2D
PHP version: 3.0.5
PHP Bug Type: Feature/Change Request
Bug description: Passive FTP (fopen wrapper) file transfer may fail with NcFTPd server
Using any of the PHP functions to read a file via an FTP URL (fopen, readfile, etc) may fail if the remote FTP server
is operated by NcFTP Software's NcFTPd server (v.2.3.2 and below). Running PHP 3 as an Apache 1.3.3 module, the connection fails because the server doesn't accept the SIZE command while in ASCII file transfer mode (which is the default selected mode using the above combination of OS/HTTP server/PHP module). If the transfer mode is set to BINARY the command is understood and the file transfer takes place.
Since the php3_fopen_url_wrapper() function in fopen_wrappers.c file switches anyway to binary transfer mode before sending the PASV command, but after having sent the SIZE command, changing the order of FTP commands from:
SIZE
TYPE I
PASV
to:
TYPE I
SIZE
PASV
would cure the NcFTPd mis-functionality. This has already been successfully tested modifing the fopen_wrappers.c file in the following way:
...
/* set the connection to be binary */
SOCK_WRITE("TYPE I\n", *socketd);
result = _php3_getftpresult(*socketd);
if (result > 299 || result < 200) {
free_url(resource);
SOCK_FCLOSE(*socketd);
*socketd = 0;
return NULL;
}
/* find out the size of the file (verifying it exists) */
SOCK_WRITE("SIZE ", *socketd);
SOCK_WRITE(resource->path, *socketd);
SOCK_WRITE("\n", *socketd);
...
---Tested case
Having the URL ftp://ftp.server.mydomain/thefile in a readfile() function, with ftp.server.mydomain being an NcFTPd FTP server:
ftp> ascii 200 Type okay. ftp> size /thefile 502 Not implemented for TYPE A. ftp> binary 200 Type okay. ftp> size /thefile 213 481
-- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe <email protected> For help: php-dev-help <email protected>
- Next message: and <email protected>: "[PHP-DEV] Bug #860: dirname() is incorrectly described"
- Previous message: Bug Database: "[PHP-DEV] Bug #853 Updated: doesn't work with apache 1.3.3"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

