[Qt-interest] Ftp with QNetworkAccessManager: Aborting when SIZE fails

Karl Krach mailinglists at blueSpirit.la
Sun Mar 15 10:48:17 CET 2009


Hi everybody,

I ve created a small app which stores data on a ftp server.

I had problems using QFtp on windows, so I tried the new
QNetworkAccessManager. Now I have two scenarios:

###########################

First accessing the local ftp server (running on the DSL router). When
accessing a existing or not existing file or directory, the
errorString() of QNetworkReply tells me:

"Error while downloading
ftp://ftpuser:XXXXX@fritz.box/Generic-USBFlashDisk-01/index.html:
/Generic-USBFlashDisk-01/index.html: No such file or directory."

With wireshark I get the following background information:

USER ftpuser
-> 331 Password required for ftpuser.
PASS XXXXXX
-> 230 User ftpuser logged in.
HELP
-> 214 The following commands are reco [...]

SIZE /Generic-USBFlashDisk-01/index.html
-> 550 /Generic-USBFlashDisk-01/index.html:
   No such file or directory.

When analyzing the ftpaccess of the firefox browser, it ignores the
failed SIZE command and continues with
   RETR /Generic-USBFlashDisk-01/index.html
which is successful.

###########################

Second: Now I accessed my hosted ftp server:

"Error while downloading: ftp://u13223:XXXXX@bluespirit.la/.htaccess:
SIZE not allowed in ASCII mode"

When analyzing the firefox traffic here, the browser opens a passive
connection, SIZE is successful, and it downloads all files in binary mode.

###########################

Question: How can I handle this with the QNetworkAccessManager? The
easierst thing would be, to be able to use QFtp::passive and
QFtp::Binary with the new framework too :-)

Thanks,

Charly




More information about the Qt-interest-old mailing list