Skip to content
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: Passive transfer fails because curl tries only a single IP address #1508

Closed
mkauf opened this issue May 24, 2017 · 1 comment
Closed

Comments

@mkauf
Copy link
Contributor

mkauf commented May 24, 2017

I did this

./curl -v -x http://localhost:3128 -p ftp://mirror.switch.ch/doc/standard/rfc/26xx/2616.txt

Output:

* STATE: INIT => CONNECT handle 0xc74768; line 1410 (connection #-5000)
* Added connection 0. The cache now contains 1 members
*   Trying ::1...
* TCP_NODELAY set
* STATE: CONNECT => WAITCONNECT handle 0xc74768; line 1462 (connection #0)
* connect to ::1 port 3128 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 3128 (#0)
* STATE: WAITCONNECT => WAITPROXYCONNECT handle 0xc74768; line 1579 (connection #0)
* Marked for [keep alive]: HTTP default
* Establish HTTP proxy tunnel to mirror.switch.ch:21
> CONNECT mirror.switch.ch:21 HTTP/1.1
> Host: mirror.switch.ch:21
> User-Agent: curl/7.54.1-DEV
> Proxy-Connection: Keep-Alive
>
* Read response immediately from proxy CONNECT
< HTTP/1.0 200 Connection established
<
* Proxy replied OK to CONNECT request
* STATE: WAITPROXYCONNECT => SENDPROTOCONNECT handle 0xc74768; line 1558 (connection #0)
* FTP 0xc830b8 (line 3105) state change from STOP to WAIT220
* STATE: SENDPROTOCONNECT => PROTOCONNECT handle 0xc74768; line 1593 (connection #0)
< 220-SWITCHmirror welcomes you!
< 220
> USER anonymous
* FTP 0xc830b8 (line 799) state change from WAIT220 to USER
< 331 Please specify the password.
> PASS ftp@example.com
* FTP 0xc830b8 (line 2536) state change from USER to PASS
< 230- Welcome to SWITCHmirror                     ftp://mirror.switch.ch/
< 230- -----------------------                    http://mirror.switch.ch/
< 230-
< 230- SWITCHmirror is located in Zurich, Switzerland and
< 230- operated by SWITCH:                           http://www.switch.ch/
< 230-
< 230- If you have problems downloading and are seeing "Access denied"
< 230- or "Permission denied", please make sure that you started your
< 230- FTP client in a directory to which you have write permission.
< 230-
< 230- Contact address: switchmirror@switch.ch
< 230-
< 230- NOTE: ALL transfers are logged and any misuse will be acted upon.
< 230-
< 230 Login successful.
> PWD
* FTP 0xc830b8 (line 811) state change from PASS to PWD
< 257 "/"
* Entry path is '/'
* FTP 0xc830b8 (line 2857) state change from PWD to STOP
* protocol connect phase DONE
* STATE: PROTOCONNECT => DO handle 0xc74768; line 1614 (connection #0)
* DO phase starts
> CWD doc
* FTP 0xc830b8 (line 904) state change from STOP to CWD
* ftp_perform ends with SECONDARY: 0
* STATE: DO => DOING handle 0xc74768; line 1663 (connection #0)
< 250 Directory successfully changed.
> CWD standard
< 250 Directory successfully changed.
> CWD rfc
< 250 Directory successfully changed.
> CWD 26xx
< 250 Directory successfully changed.
> EPSV
* FTP 0xc830b8 (line 1339) state change from CWD to PASV
* Connect data stream passively
< 229 Entering Extended Passive Mode (|||59386|).
* Hostname localhost was found in DNS cache
*   Trying ::1...
* TCP_NODELAY set
* Connecting to mirror.switch.ch (::1) port 3128
* FTP 0xc830b8 (line 1995) state change from PASV to STOP
* DO phase is complete2
* STATE: DOING => DO_MORE handle 0xc74768; line 1752 (connection #0)
* connect to ::1 port 3128 failed: Connection refused
* Failed to connect to localhost port 3128: Connection refused
* Failed EPSV attempt, exiting

* multi_done
* Marked for [closure]: FTP ended with bad error code
* Closing connection 0
* The cache now contains 0 members
* Expire cleared
curl: (8) Failed to connect to localhost port 3128: Connection refused

Squid 2.7.STABLE9 runs on localhost:3128. This old version does not support IPv6.

I expected the following

The download should succeed. After switching to passive mode (EPSV), curl should try all IP addresses for "localhost". Currently it tries ::1, but it should also try 127.0.0.1.

curl/libcurl version

curl 7.54.1-DEV

operating system

Linux

@jay
Copy link
Member

jay commented May 24, 2017

bisected to c431274 when easy vs multi internal separation was removed but I don't think that's so relevant at this point

@bagder bagder closed this as completed in 72be6ab Apr 30, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants