-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FTP fails when tunneled through HTTP proxy #701
Comments
Although your command line doesn't use a socks proxy at all... |
I've read the "or CONNECT through HTTP proxy" but you're right, I don't have a CONNECT here. Then it's something else, but fairly easy to replicate. |
Hi. I'm making some progress here, after the second EPSV, when we are about to transfer the second file, libcurl doesn't do a CONNECT on the new port indicated by the FTP server (only if there is a proxy), that's why we end up getting a "425 Can't open data connection for transfer of "/bla2.txt" I'm trying to debug, but I'm new to libcurl code. I'll keep updating the thread with my findings, hopefully I'll get a fix at some point. Thanks. |
So, I've followed the code, what happens here is that we're about to upload the second file via the proxy, we enter Curl_proxyCONNECT trying to open the new passive port but conn->tunnel_state[sockindex] == TUNNEL_COMPLETE is true for sockindex==SECONDARYSOCKET cause it has already been opened for the first upload, but it was for a data channel on another port. So we don't do a CONNECT on the new port and the upload can't happen. Not sure I'll be able to come up with a fix though, I don't know libcurl well enough. I guess the second socket data should have been closed after the first STOR, but I'm not sure how to do that, would anyone have any idea how to do that properly? Thanks, |
something like this perhaps?
|
Thanks! I'll give that a try right now. |
It's fixed. Thank you very much. |
Doing further tests, I still have issues related to that. Let me come back to you. |
static CURLcode ftp_dophase_done(struct connectdata *conn, if(connected) { connected is FALSE in my case, coming from ftp_doing:
So the fix isn't called. Not sure I understand the meaning of connected here. Sorry for the confusion, I had a tweak inserted in the code and got confused. |
Right, it wasn't the correct spot. Or perhaps it should be there but not for your case. The
|
It worked fine this time. You saved my day. First time I work on such a project, I should be able to learn more and more about libcurl in the coming months, and I'd like to contribute to the project. I'll be using extensively SFTP/HTTPS over proxies in secure mode (TLS, certificates) and should be able to test quite a few features. Thanks again for your tremendous work and help on this. |
Lovely. I intend to make the real fix slightly larger though, so that we make sure to clear that tunnel state variable at every place we close the second connection so that this problem won't come back too easily. |
I'll test that code as well, thanks. |
Hi.
I think I've found an easy way to replicate known bug 65
"65. When doing FTP over a socks proxy or CONNECT through HTTP proxy and the
multi interface is used, libcurl will fail if the (passive) TCP connection
for the data transfer isn't more or less instant as the code does not
properly wait for the connect to be confirmed. See test case 564 for a first
shot at a test case."
Sharing it with you in case it could help. I'm not very familiar with GitHub and participating on projects, so my apologies if I should have done something else instead of posting here.
Using win32, VS compiled version of the "LIB Release - LIB OpenSSL - LIB LibSSH2" version of the 7.47.1.
FileZilla Server for the FTP server, and I've used CCproxy and FreeProxy as HTTP proxies.
A simple: .\curl.exe -T "{bla.txt,bla2.txt}" ftp://X.X.X.X -u ftpuser:xxx -v -x X.X.X.X:808 -p fails on the upload of the second file (code 425), while the same command works fine without the proxy specified.
Thanks,
daboul
The text was updated successfully, but these errors were encountered: