cURL / Mailing Lists / curl-library / Single Mail


Re: Question about proxying using curl

From: Dan Fandrich <>
Date: Fri, 2 Aug 2013 23:03:41 +0200

On Fri, Aug 02, 2013 at 04:29:01PM -0400, Howard wrote:
> I would like to use libcurl essentially to proxy an incoming connection. I
> have a process that is sending my process a series of buffers to be written and
> I want to use libcurl to write these buffers to a single file on the other side
> of an http connection. It seems to me that I need some way to have libcurl not
> close the connection in between writes so I can assure that the file is written
> correctly on the other side. The device I am writing to is an object store
> device with a restful web interface, but the API does not include a provision
> to extend a file. That's why I need to keep the connection open. Has anyone
> done this or something similar? Is there example code around?

I assume you're talking about keeping the HTTP request open and not the TCP
connection itself; HTTP is stateless, so keeping the socket open between
requests should make no difference except for performance. libcurl has the
capability of doing chunked uploads, which allows an app to send data without
knowing the size in advance. Such an application would start a PUT or POST and
send as much data as it has, then simply stop sending more until more becomes
available. The HTTP session stays open as long as the upload doesn't
complete, but that also means that the request doesn't complete either, which
may also mean that the file doesn't become available on the remote server.
But, it does seem to satisfy your requirements as I read them.

>>> Dan
List admin:
Received on 2013-08-02