Skip to content

thinkiny/libevent_http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

libevent_http

Example:

    //loop in another thread
    auto loop = http::EventLoop::New();
    loop->RunInBackground();
    auto resp = http::Get("http://www.baidu.com", loop).SetTimeout(1000).Execute();
    printf("%d:%lu\n", resp.GetResponseCode(), resp.GetBody().length);

    //callback
    http::Get("http://www.baidu.com")
        .AddHeader("Connection", "keep-alive")
        .SetTimeout(1000)
        .Execute([](http::Response&& r) {
                printf("%d:%lu\n", r.GetResponseCode(), r.GetBody().length);
        });

    //promise
    std::promise<http::Response> p;
    auto future = http::Get("http://www.baidu.com").SetTimeout(1000).Execute(p);
    auto resp = future.get();
    printf("%d:%lu\n", resp.GetResponseCode(), resp.GetBody().length);

About

user friendly libevent http api

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages