cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: How to make curl to download file over an already opened socket descriptor ???

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Fri, 29 Apr 2005 09:00:53 +0200 (CEST)

On Thu, 28 Apr 2005, tony vong wrote:

> I was using something like system("/usr/local/bin/curl url name ..."). This
> works well only if the server does not require any session information. In
> other words, the mechanism wont work if I try to intercept some download
> via, for example, mail.yahoo.com because the curl will open a fresh tcp
> connection, about which the server has not session information.

HTTP is stateless, and servers do not have session information based on TCP
connections (the only and single exception to this rule that I know of is when
you use NTLM auth). I think you are confusing things. mail.yahoo.com does not
require the client to use a single connection over multipe requests. It is
more likely to check for cookies and referer etc.

Of course, using a single connection is a lot smarter since it'll be much
faster.

> So I am wondering whether it is possible to make curl talk to the server via
> an already opened socket descriptor.

No, it isn't. But if you'd use libcurl directly instead, you could just keep
handles alive and re-use them on subsequent requests.

> That way I can just pass the socket descriptor to the curl instead of
> calling system("curl ...") !!!

Just out of curiousity, if curl would ever support this, how would you pass
the socket descriptor to curl?

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-04-29