cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: socket connect prior to actual get

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 19 Jan 2006 23:10:12 +0100 (CET)

On Thu, 19 Jan 2006, Calin wrote:

> I'd like to use the library to preconnect to the server, and have the actual
> fetch done via a separate library call... Or perhaps not at all, allowing
> the server to disconnect the socket.
>
> From looking at the easy/multi apis, I don't see a way to do this, is that
> correct? Looks like the connect has to happen at time of fetch.

That's correct. At the time of the _first_ fetch to be specific, if you do
more fetches over the same proxy...

> The rationale is, I have a program that's a kind of proxy frontend to an
> internal backend server (it heavily modifies the backend response), and it
> often won't need to perform gets because it will be utilizing data from its
> cache to answer requests.

So why "pre-connect" if you end up not having to use the server at all?

> But for cases where it does have to perform a get to the backend server, I
> want the connect phase to already be completed, via a separate thread, to
> eliminate the delay.

If you use libcurl as it works today, you'd only have a delay the first time
you use the proxy and after the proxy has closed the connection due to
inactivity or similar.

We're also currently discussing about a new connect-only feature, but I don't
think that is exactly what you want...

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-01-19