Search code examples
c++qtftpftp-client

How to avoid QNetworkRequest to send the RHELP verb to the FTP Server?


The Scenario:
I'm implementing an FTP get functionality in my application, that uses Qt 4.7.x
Qt documentation states that the QFtp class is deprecated, to use QNetworkAccessManager instead, and so I'm doing ;)
I tested the code I wrote with some FTP server out there and it seems to work fine.

The Problem:
When I connect to my local, homebrewed (and quite simple), ftp server using my ftp get class I get the following error: Request: 500 No Help Available. I traced the ftp communication using tcpdump and actually I see that the QNetworkAccessManager/QNetworkRequest sends an HELP verb to the server, once it gets the 230 User Logged In

Unfortunately my server do not support that. Now is there a way to configure the Qt not to send the HELP verb? Reading the Qt Doc online for the involved classes did not helped.


Solution

  • There is probably no way to avoid this, unless you want to reimplement the FTP backend. By browsing the source code for the FTP backend, you can find out that the purpose for sending the HELP command is to find out if the server supports the "SIZE" and "MDTM" commands.

    Probably the easiest solution would be to implement a minimal handler for HELP commands in your FTP server that responds with an appropriate 200/211/214 response.

    EDIT: See http://qt.gitorious.org/qt/qt/blobs/4.8/src/network/access/qnetworkaccessftpbackend.cpp#line350 for what the backend expects from the response. It's not complicated.