You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2002/07/12 18:50:29 UTC
DO NOT REPLY [Bug 10747] New: -
ftp SIZE command and 'smart' ftp servers results in wrong Content-Length value
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10747>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10747
ftp SIZE command and 'smart' ftp servers results in wrong Content-Length value
Summary: ftp SIZE command and 'smart' ftp servers results in
wrong Content-Length value
Product: Apache httpd-1.3
Version: 1.3.26
Platform: PC
OS/Version: Linux
Status: NEW
Severity: Major
Priority: Other
Component: mod_proxy
AssignedTo: bugs@httpd.apache.org
ReportedBy: ast@domdv.de
mod_proxy issues the SIZE command for ftp transfers to determine the size
of the object to be transferred and sends this as the Content-Length to the
client. Unfortunately 'smart' ftp servers use the current transfer type
to determine the file size. In case of the default type which is ASCII after
login these servers include a LF to CRLF conversion in the length
calculation.
The result is a hanging transfer as the amount of bytes advertised in the
Content-Length header is larger than the amount of bytes delivered by the
ftp server.
Example with a command line ftp client:
$ runsocks ftp ftp.hu-berlin.de
Connected to vinus.rz.hu-berlin.de.
220-===========================================================================
220- Welcome to the Humboldt-University of Berlin
220- ftp.hu-berlin.de
220-===========================================================================
220-
220 ftp.hu-berlin.de FTP server ready.
Name (ftp.hu-berlin.de:ast): ftp
331 Guest login ok, send your complete e-mail address as password.
Password:
230-
230-All logins and traffic are logged and analysed, if you
230-do not accept this policy, do not log in!
230-
230-hello user at p5084739E.dip.t-dialin.net
230-local time is Fri Jul 12 17:52:31 2002
230-session number 95 in this class
230-current session limit 120
230-
230-contact: ftpadm@rz.hu-berlin.de
230-
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> quote SIZE
/pub/www/opera/linux/602/final/en/qt_shared/opera-6.02-20020701.2-shared-qt.i386.tar.bz2
213 2824953
ftp> bin
200 Type set to I.
ftp> quote SIZE
/pub/www/opera/linux/602/final/en/qt_shared/opera-6.02-20020701.2-shared-qt.i386.tar.bz2
213 2814231
ftp> bye
221-You have transferred 0 bytes in 0 files.
221-Total traffic for this session was 1057 bytes in 0 transfers.
221-Thank you for using the FTP service on ftp.hu-berlin.de.
221 Goodbye.
$
Thus mod_proxy must set the transfer type prior to issuing of the SIZE
command to assert, that the SIZE command returns the proper object size.
The following one line patch asserts this:
--- proxy_ftp.c.orig Fri Jul 12 18:19:04 2002
+++ proxy_ftp.c Fri Jul 12 18:22:50 2002
@@ -1072,6 +1072,7 @@
get_dirlisting = 1;
}
else {
+ ftp_set_TYPE(r, ctrl, xfer_type);
ap_bvputs(ctrl, "SIZE ", path, CRLF, NULL);
ap_bflush(ctrl);
ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, r->server,
"FTP: SIZE %s", path);
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org