cURL / Mailing Lists / curl-library / Single Mail

curl-library

Multi-handle hanging up immediately after creating FTP data socket (using GCD)

From: Bill Doyle <vilhalmer_at_gmail.com>
Date: Tue, 6 Aug 2013 21:55:16 -0400

Hi! I'm in the process of building a simple libcurl FTP wrapper for a
Cocoa app, and I'm using Grand Central Dispatch as the backing for a
multi-handle. I've got the easy-handle configured properly, as it will
upload fine when run with curl_easy_perform. However, when the
multi-handle attempts the upload, it gets as far as opening the data
socket to the server and then immediately gives up and closes the
control socket. I've been poking at this for several days with no
success, so I was hoping that someone here would be able to offer a
bit of assistance. Here are the logs as provided by my
CURLOPT_DEBUGFUNCTION, plus a few extras:
-----

new timeout = 1
[CURLInterface] Added handle to curlMulti.
About to connect() to unsquared.co port 21 (#0)
  Trying 205.134.239.195...
Adding handle: conn: 0x103811000
Adding handle: send: 0
Adding handle: recv: 0
Curl_addHandleToPipeline: length: 1
- Conn 0 (0x103811000) send_pipe: 1, recv_pipe: 0
Creating CurlSocketContext_S for 5
CURL_POLL_OUT for 5
new timeout = 1
new timeout = 1
Connected to unsquared.co (205.134.239.195) port 21 (#0)
CURL_POLL_IN for 5
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 150 allowed.
220-Local time is now 17:40. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 30 minutes of inactivity.
220-You are user number 1 of 150 allowed.
220-Local time is now 17:40. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 30 minutes of inactivity.
220-Local time is now 17:40. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 30 minutes of inactivity.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 30 minutes of inactivity.
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 30 minutes of inactivity.
220 You will be disconnected after 30 minutes of inactivity.
USER sphere6
331 User sphere6 OK. Password required
nutes of inactivity.

220-You are user number 1 of 150 allowed.
220-Local time is now 17:40. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 30 minutes of inactivity.
PASS **************
230 OK. Current restricted directory is /
es of inactivity.

220-You are user number 1 of 150 allowed.
220-Local time is now 17:40. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 30 minutes of inactivity.
PWD
257 "/" is your current location
ry is /
Entry path is '/'
CWD public_html
250 OK. Current directory is /public_html
es of inactivity.

220-You are user number 1 of 150 allowed.
220-Local time is now 17:40. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 30 minutes of inactivity.
CWD files
250 OK. Current directory is /public_html/files
inactivity.

220-You are user number 1 of 150 allowed.
220-Local time is now 17:40. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 30 minutes of inactivity.
EPSV
Connect data stream passively
229 Extended Passive mode OK (|||31818|)
files
  Trying 205.134.239.195...
Connecting to 205.134.239.195 (205.134.239.195) port 31818
TYPE I
200 TYPE is now 8-bit binary
|||31818|)
STOR test.jpg
Creating CurlSocketContext_S for 7
CURL_POLL_IN for 7
CURL_POLL_REMOVE for 5
cancelling 5
cancelling 5

-----
The duplicated messages, especially after the initial login, along
with the small fragments of previous messages that are interspersed,
lead me to believe that this is threading related, but I can't pick
out what I've done wrong.

I based the code on the existing GCD "crash-test" example
(http://curl.haxx.se/mail/lib-2013-03/att-0309/multi-gcd-crashtest.c),
and I've tried several variations on it. For example, it makes no
difference whether my CURLOPT_SOCKOPTFUNCTION is present. I've
attached the relevant Objective-C implementation file. Another
interesting note is that libcurl never asks to adjust the timeout
value (CURLOPT_TIMERFUNCTION), though that may just be due to the lack
of any uploading actually happening. I'm not exactly sure when that's
meant to happen. (You can see the timeout being set to the initial 1ms
to kick things off at the beginning of the logs.)

It's entirely possible that this is more of a GCD issue than a libcurl
issue, and if that's the case, I'd be happy to move this question
elsewhere. Either way, thanks in advance for any help you can provide!
Bill

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2013-08-07