cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: socket connect prior to actual get

From: Calin <thecodemachine_at_gmail.com>
Date: Fri, 20 Jan 2006 06:28:46 -0800

Hi, thanks for the reply.

> > 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?

Well because this program is just going to be bombed with requests,
and the additional delay caused by the connect start up is noticeable.
Given the traffic it will do it has to be as fast as possible.

> > 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.

Unfortunately the backend server I'm connecting to is a proprietary
appliance, and not very friendly ;/. No persistent connections of any
type and it closes the connection after every request to it. So
that's why I'm trying to dance around a bit and keep an always open
connected socket at the ready.

Glancing through the source it looks like I might be able to expose
Curl_connect_host and then just call it every few seconds, with a
static handle, but I need to look closer at the source.

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

Cool sounds neat regardless, I'll look forward to it.

cheers
Calin
Received on 2006-01-20