cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLOPT_CONNECT_ONLY doesn't seem to work

From: Nico Williams <nico_at_cryptonector.com>
Date: Tue, 4 Jun 2013 02:41:57 -0500

I'm trying to get a variant of the sendrecv.c example (one that sets
proxy authentication options) to work. It doesn't.
curl_easy_perform() always fails, evidently because of this:

1229 case CURLM_STATE_DO:
1230 if(data->set.connect_only) {
1231 /* keep connection open for application to use the socket */
1232 easy->easy_conn->bits.close = FALSE;
1233 multistate(easy, CURLM_STATE_DONE);
1234 easy->result = CURLE_OK;
1235 result = CURLM_CALL_MULTI_PERFORM;
1236 }

or perhaps here:

1595 /* post-transfer command */
1596 easy->result = Curl_done(&easy->easy_conn, CURLE_OK, FALSE);

or perhaps in Curl_done():

5611 /* this calls the protocol-specific function pointer previously set */
5612 if(conn->handler->done)
5613 result = conn->handler->done(conn, status, premature);
5614 else
5615 result = CURLE_OK;

Perhaps it should just not call conn->handler->done() nor
Curl_disconnect() when data->set.connect_only.

The point is to unwind from here and return successfully from
curl_multi_perform() and curl_easy_perform() without calling
conn->handler->done() nor Curl_disconnect(), so the application can
curl_easy_getinfo(CURLINFO_LASTSOCKET) then enter an event loop and
servicing the socket with curl_easy_send() and curl_easy_recv(), as in
the docs/examples/sendrecv.c example.

Is my analysis correct? Did this feature use to work? What should a
correct fix look like here?

Later today I'll attempt a fix in Curl_done() first, but I'm not yet
very familiar with the internals -- any hints would be most welcomed.

Thanks!

Nico

--
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-06-04