[prev in list] [next in list] [prev in thread] [next in thread]
List: jakarta-commons-user
Subject: Errorhandling of "bad" FTP Servers
From: Oliver Zemann <oliver.zemann () gmail ! com>
Date: 2017-01-22 9:12:23
Message-ID: e4660f82-037c-48d2-9e74-7cde0a439ead () gmail ! com
[Download RAW message or body]
Hi, i would like to know how to handle FTP Servers that do not behave
like they should (or behave different than most others).
For example, currently i would like to connect to one of those servers
which sends " MODE Z" directly after a login (USER) which is interpreted
wrong by apache commons ftp, as its assumed that there should be \d\d\d
\w* like "220 all good my friend"
But its simply: " MODE Z"
Here is a log from filezilla which can handle this behaviour:
09:58:24 Trace: CFtpControlSocket::SendNextCommand()
09:58:24 Befehl: USER someUser
09:58:24 Trace: CFtpControlSocket::OnReceive()
09:58:24 Antwort: 331 [33m ~wait~ user ok, password?
09:58:24 Trace: CFtpControlSocket::SendNextCommand()
09:58:24 Befehl: PASS *******
09:58:25 Trace: CFtpControlSocket::OnReceive()
09:58:25 Antwort: 230 [32m.::WAIT::. welcome!.
09:58:25 Trace: CFtpControlSocket::SendNextCommand()
09:58:25 Befehl: SYST
09:58:25 Trace: CFtpControlSocket::OnReceive()
09:58:25 Antwort: 215 Java (SE) Platform SE 6.0
09:58:25 Trace: CFtpControlSocket::SendNextCommand()
09:58:25 Befehl: FEAT
09:58:25 Trace: CFtpControlSocket::OnReceive()
09:58:25 Antwort: 211-Extension supported
09:58:25 Antwort: MDTM
09:58:25 Antwort: MDTM
09:58:25 Antwort: MDTM YYYYMMDDHHMMSS[+-TZ];filename
09:58:25 Antwort: SIZE
09:58:25 Antwort: SITE PSWD;EXEC;SET;INDEX;ZONE;CHMOD;MSG
09:58:25 Antwort: XCRC filename;start;end
09:58:25 Antwort: 211 End
09:58:25 Status: Der Server unterstützt keine Nicht-ASCII-Zeichen.
09:58:25 Status: Angemeldet
09:58:25 Antwort: MODE Z
09:58:25 Trace: Unexpected reply, no reply was pending. <----
something like this in apache commons ftp???
09:58:25 Antwort: 211 End
09:58:25 Trace: Unexpected reply, no reply was pending.
09:58:25 Status: Empfange Verzeichnisinhalt...
09:58:25 Trace: CFtpControlSocket::SendNextCommand()
09:58:25 Trace: CFtpControlSocket::ChangeDirSend()
09:58:25 Befehl: PWD
09:58:25 Trace: CFtpControlSocket::OnReceive()
09:58:25 Antwort: 257 "/" [34m<<<>>>OK<<<>>> Logged in ;).
That "MODE Z" is leading to an exception when i use FTPClient::login()
In __getReply(boolean reportReply) i can see that its trying to convert
the first 3 chars to a digit, which is of course impossible if its "Z
MODE" and not a number.
So i am wondering whats the best way to handle such servers? Or is this
a bug in apache commons ftp? Do i have to implement all calls myself and
dont rely on login() logout() etc. from apache commons to be able to
handle such behaviours?
Some information: i dont have control over that server. I dont know what
software the server is running.
Regards
Oli
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic