[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Writing a basic http client


Here it is a sample HTTP GET client with redirection (301/302) support.

I suppose download.c enough to get the idea how to implement more
complex http client.

On Mon, Sep 20, 2010 at 2:44 PM, Bas Verhoeven <libevent@xxxxxxxxxx> wrote:
> Hi,
> I'm looking into using a simple HTTP client library for a project that
> already uses libevent2.
> I tried using libcurl in combination with libevent. Unfortunately libcurl
> won't work for me at the moment because its "multi" backend has timeout
> issues (requests without any data received never time out) and integration
> with libevent is pretty much confusing.
> I remember reading on this list that 'evhttp' isn't really mature yet so I
> initally avoided it, but I might want to give it a chance now. Unfortunately
> I can't really find any documentation on using evhttp (especially not for
> libevent2), except for the header file and the regression tests. A lot of
> functions appear to be aimed at the server part of evhttp which I am not
> interested in.
> All I want to do is send a basic POST request
> (application/x-www-form-urlencoded) to a remote host (over http/https) and
> process the response received. All this while honoring up to <x> redirects,
> with a timeout of <y> seconds.
> Is this something I can easily do with evhttp? Is the evhttp (client) code
> stable enough? Is there some example code on using evhttp as a client?
> Cheers,
> Bas Verhoeven
> ***********************************************************************
> To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
> unsubscribe libevent-users    in the body.

Pavel Plesov

Attachment: download.c
Description: Binary data