A cross-platform HTTP client library with a focus on usability and speed

Overview

EasyHttp

Job Status Build Status Build status

A cross-platform HTTP client library with a focus on usability and speed. Under its hood, EasyHttp uses POCO C++ Libraries and derives many of its design inspirations from okHttp, a well known HTTP client for Android and Java applications. Please check out Wiki for details.

Why another HTTP client?

Modern network applications need a powerful HTTP client. While we already have many well known C++ HTTP clients like, Poco::Net, Boost.Asio, cpprestsdk to name a few, they often lack features like a powerful response cache, HTTP connection pooling, debuggability etc which we all take it for granted for libraries targeted towards Android or iOS platforms. EasyHttp tries to fill that gap.

Features

  • Powerful and easy to use HTTP client with synchronous and asynchronous apis.
  • HTTP connection pooling support to reduce latency.
  • HTTP response caching to optimize repeat requests.
  • Hackable HTTP request/response with a concept of okHttp style Interceptors.
  • Cross-platform and highly portable to many platforms.
  • Automatic recovery during faulty network connections.
  • Secure by default. Obsolete protocols like SSLv2, SSLv3 are disabled by default.
  • Comprehensibly tested and is used internally in various Sony projects.

Getting Started

Installation

See Installing EasyHttp.

Samples

See samples. Also checkout common use-cases.

Api doc

See wiki for building api doc.

Library build options

See Build options.

License

This library is distributed under The MIT license. See LICENSE and NOTICE for more information.

Issues
  • Can not build app with easyhttp

    Can not build app with easyhttp

    Hi, I can not set up my makefile, I've tired after all these undefined references to something in Poco::Whatever

    g++ -std=c++14 -DIBPP_LINUX $(INCLUDES) $(SOURCES) -L/usr/local/lib/ -I/usr/local/include/ -o executable -libpp -L. -lonyx -lcurl -lpthread -lboost_system -lboost_filesystem -leasyhttp -lssl -lPocoFoundation -lPocoNet -lPocoNetSSL -lPocoUtil -lPocoCrypto -lPocoJSON

    /usr/local/lib//libeasyhttp.a(SqliteOpenHelper.cpp.o): In function `easyhttpcpp::db::SqliteOpenHelper::SqliteOpenHelper(Poco::Path const&, unsigned int)':
    SqliteOpenHelper.cpp:(.text+0x152): undefined reference to `Poco::Data::SQLite::Connector::registerConnector()'
    

    Am I wrong and doing something wrong? Or there are some tricks about it?

    opened by EZ-Phantom 9
  • Build easyhttpcpp for Android NDK

    Build easyhttpcpp for Android NDK

    Is there any way (existing documentation or script ?) to easily compile this project for Android platform? Is cross-compiling all dependencies one by one (Poco, openssl etc...) and then at the end easyhttpcpp itself manually the only option?

    question 
    opened by MGasztold 7
  • SSL error

    SSL error

    Hello,

    Really this is not an issue, I'm trying to connect to an apache server with a self-signed certificate and I can't find a way to ignore this error.

    Error occurred: EASYHTTPCPP-ERR-100704: SSL error occurred in sendRequest. [scheme=https, host=https://*********.com] message=[error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed]

    Any suggestions on how to solve this?

    Regards and thanks,

    Julian Bolivar

    question 
    opened by BolivarTech 4
  • cmake error

    cmake error

    Brief overview

    Expected behavior

    Could you support windows build

    Actual behavior

    Steps to reproduce

    Specifications like the version of the project, operating system, or hardware etc.

    opened by dry11orange 4
  • Https client sample ??

    Https client sample ??

    Hi there,

    I'm interested in this library but couldn't find any samples of HTTPs (SSL) client in this repository and on the web.

    Do you guys have any plans to provide ? or any hints or tips ??

    Cheers

    opened by tech-a-go-go 3
  • Remove new lines in setting cmake variables.

    Remove new lines in setting cmake variables.

    Attempting to make as is will result in the warning: WARNING: Value of WIN_CXX_SECURE_OVERLOAD_STANDARD_OPTIONS contained a newline and was truncated. I believe this was added in cmake 3.11.

    I haven't actually been able to get this project to compile on Windows, but this looks like a good start.

    opened by VirtualTim 2
  • Response gets cached even if request header has no-store

    Response gets cached even if request header has no-store

    Brief overview

    EasyHttp will cache response for a request even if it has Cache-Control: no-store header. According to RFC this should not be the case.

    Expected behavior

    Response is not cached.

    Actual behavior

    Response is cached.

    Steps to reproduce

    • Create a request with Cache-Control: no-store header.
    • Execute it.
    • Response gets cached.
    bug 
    opened by shekharhimanshu 1
  • Response wont get cached if request header has no-cache

    Response wont get cached if request header has no-cache

    Brief overview

    EasyHttp wont cache a response if the request header contains Cache-Control: no-cache directive inside it. According to RFC, a no-cache request directive means that any available cache response should not be used satisfy the request. Caching the response is allowed however.

    Expected behavior

    Response is cached.

    Actual behavior

    Response is not cached.

    Steps to reproduce

    • Create a request with Cache-Control: no-cache header.
    • Execute it
    • Response is not cached.
    bug 
    opened by shekharhimanshu 1
  • Document logging configuration

    Document logging configuration

    Please add minimum documentation on how to configure logging. Suggested page: https://github.com/sony/easyhttpcpp/wiki/Recipe:-Configuring-EasyHttp

    Example:

    easyhttpcpp::common::CoreLogger::getInstance()->setLoggingLevel(easyhttpcpp::common::LogLevel::LogLevelWarning);
    
    opened by cen1 0
  • executeAsyc relies on passed request data to be valid after returning?

    executeAsyc relies on passed request data to be valid after returning?

    Brief overview

    First of all, apologies if I completely misunderstood this problem, the documentation and online samples are rather thin.

    I am doing a fire-and-forget POST webhook call. I am calling the Postman echo server for testing. When request goes through, Postman reports content length 0 and null json in the response. Sometimes I also get a Poco::Exception occurred. [scheme=https, host=postman-echo.com] message=[Not a valid integer: 18446744073309551616] for content length header or a segfault. Due to this weird behaviour, I suspect that executeAsync tries to use some data that has already been deallocated once the method returns from scope.

    If I add a sleep or pResponseCb->waitForCompletion(); before returning from method everything works as expected.

    Code is almost line by line from async sample, except it is POST instead of GET.

    void post(string body) {
       //init client and stuff...
        easyhttpcpp::MediaType::Ptr pMediaType(new easyhttpcpp::MediaType("application/json; charset=utf-8"));
        easyhttpcpp::RequestBody::Ptr pRequestBody = easyhttpcpp::RequestBody::create(pMediaType, body);
    
        easyhttpcpp::Request::Builder requestBuilder;
    
        easyhttpcpp::Request::Ptr pRequest = requestBuilder.setUrl("https://postman-echo.com/post")
            .httpPost(pRequestBody)
            .build();
        easyhttpcpp::Call::Ptr pCall = pHttpClient->newCall(pRequest);
    
        HttpClientCallback::Ptr pResponseCb = new HttpClientCallback();
    
        pCall->executeAsync(pResponseCb);
        //pResponseCb->waitForCompletion(); //this makes it work
    }
    

    Expected behavior

    executeAsync should make a copy of all the data it needs before returning?

    Actual behavior

    executeAsync seems to rely on the passed data to be valid after returning.

    Steps to reproduce

    The code sample above should be enough.

    Specifications like the version of the project, operating system, or hardware etc.

    Windows 10, VS2019, conan package shared build v2.1.0

    opened by cen1 0
  • Support for custom socket?

    Support for custom socket?

    Hello, I couldn't find the API for this library. Does it support passing my custom socket to it? I see that it supports okhttp3-style interceptors, so maybe it's possible?

    opened by lattice0 0
  • Allow usage as subproject

    Allow usage as subproject

    Hello,

    While creating https://github.com/conan-io/conan-center-index/pull/1537, I noticed that easyhttpcpp cannot be used as a subproject.

    This patch fixes this by replacing global cmake variables with project local ones.

    • ${CMAKE_PROJECT_NAME} -> ${PROJECT_NAME}
    • ${CMAKE_SOURCE_DIR} -> ${PROJECT_SOURCE_DIR}
    • ${CMAKE_BINARY_DIR} -> ${PROJECT_BINARY_DIR}

    I also introduced a cmake variable PROJECT_MODULE_PATH that contains the path to easyhttpcpp's cmake subdirectory.

    opened by madebr 0
  • CMake options - messages lie about default options

    CMake options - messages lie about default options

    Description

    CMakeLists.txt lies about default options here for all 3 options: https://github.com/sony/easyhttpcpp/blob/master/CMakeLists.txt#L42

    Expected

    Default option in the message and actual default setted to the CMake variable shall be equal

    Actual

    Default option in the message and actual default setted to the CMake variable shall are different

    How to reproduce

    Just check https://github.com/sony/easyhttpcpp/blob/master/CMakeLists.txt#L42

    opened by zamazan4ik 0
  • Status of the project

    Status of the project

    Hi!

    Thank you for good http client library! Mostly I am interested in already implemented http client pool.

    But for now I am not sure about the future of the library. Is it alive? is it planned to maintain and improve the library in the future?

    Thank you!

    opened by zamazan4ik 0
Releases(2.1.0)
Owner
Sony
Sony Group Corporation
Sony
Tiny cross-platform HTTP / HTTPS client library in C.

naett /nɛt:/ Tiny HTTP client library in C. Wraps native HTTP client functionality on macOS, Windows, Linux, iOS and Android in a single, simple non-b

Erik Agsjö 17 Aug 4, 2022
H2O - the optimized HTTP/1, HTTP/2, HTTP/3 server

H2O - an optimized HTTP server with support for HTTP/1.x, HTTP/2 and HTTP/3 (experimental) Copyright (c) 2014-2019 DeNA Co., Ltd., Kazuho Oku, Tatsuhi

H2O 10.1k Aug 4, 2022
A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio.

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.

Ole Christian Eidheim 2.3k Aug 12, 2022
Cross-platform, efficient, customizable, and robust asynchronous HTTP/WebSocket server C++14 library with the right balance between performance and ease of use

What Is RESTinio? RESTinio is a header-only C++14 library that gives you an embedded HTTP/Websocket server. It is based on standalone version of ASIO

Stiffstream 871 Aug 9, 2022
Small and fast cross-platform networking library, with support for messaging, IPv6, HTTP, SSL and WebSocket.

frnetlib Frnetlib, is a cross-platform, small and fast networking library written in C++. There are no library dependencies (unless you want to use SS

Fred Nicolson 22 May 16, 2022
XQUIC Library released by Alibaba is a cross-platform implementation of QUIC and HTTP/3 protocol.

XQUIC 简体中文文档 README-zh-CN Introduction XQUIC Library released by Alibaba is … … a client and server implementation of QUIC and HTTP/3 as specified by

Alibaba 1.2k Aug 3, 2022
modern c++(c++17), cross-platform, header-only, easy to use http framework

cinatra--一个高效易用的c++ http框架 English | 中文 目录 使用cinatra常见问题汇总(FAQ) cinatra简介 如何使用 快速示例 性能测试 注意事项 roadmap 联系方式 cinatra简介 cinatra是一个高性能易用的http框架,它是用modern

qicosmos 1.4k Aug 13, 2022
A cross-platform network learning demos. Like high-performance http server

Network-Learn A cross-platform network learning demos (toys). And I try not to use 3rd-party libraries. Welcome to try it out and leave your comments.

Ho 229 23 Jul 6, 2022
Cross-platform, single .h file HTTP server (Windows, Linux, Mac OS X)

EWS - Single .h File C Embeddable Web Server Latest Version: 1.1.4 released September 9, 2021 Supported platforms: Linux, Mac OS X, Windows License: B

Forrest Heller 76 Jul 27, 2022
Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution

CppServer Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and

Ivan Shynkarenka 867 Aug 8, 2022
websocket and http client and server library, coming with ws, a command line swiss army knife utility

Hello world IXWebSocket is a C++ library for WebSocket client and server development. It has minimal dependencies (no boost), is very simple to use an

Machine Zone, Inc. 329 Aug 8, 2022
Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services.

Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services. The project is unique among realtime push solutions in that it is designed to address the needs of API creators. Pushpin is transparent to clients and integrates easily into an API stack.

Fanout 3.1k Aug 4, 2022
Gromox - Groupware server backend with MAPI/HTTP, RPC/HTTP, IMAP, POP3 and PHP-MAPI support for grommunio

Gromox is the central groupware server component of grommunio. It is capable of serving as a replacement for Microsoft Exchange and compatibles. Conne

grommunio 120 Jul 2, 2022
A C++ header-only HTTP/HTTPS server and client library

cpp-httplib A C++11 single-file header-only cross platform HTTP/HTTPS library. It's extremely easy to setup. Just include the httplib.h file in your c

null 7.5k Aug 5, 2022
Neon - neon - an HTTP/1.1 and WebDAV client library with a C API

neon neon is an HTTP and WebDAV client library, with a C language API. Mailing list: [email protected] || Web site: https://notroj.github.io/n

Joe Orton 74 Jul 25, 2022
tiny HTTP parser written in C (used in HTTP::Parser::XS et al.)

PicoHTTPParser Copyright (c) 2009-2014 Kazuho Oku, Tokuhiro Matsuno, Daisuke Murase, Shigeo Mitsunari PicoHTTPParser is a tiny, primitive, fast HTTP r

H2O 1.5k Aug 6, 2022
A collection of C++ HTTP libraries including an easy to use HTTP server.

Proxygen: Facebook's C++ HTTP Libraries This project comprises the core C++ HTTP abstractions used at Facebook. Internally, it is used as the basis fo

Facebook 7.6k Aug 8, 2022
cuehttp is a modern c++ middleware framework for http(http/https)/websocket(ws/wss).

cuehttp 简介 cuehttp是一个使用Modern C++(C++17)编写的跨平台、高性能、易用的HTTP/WebSocket框架。基于中间件模式可以方便、高效、优雅的增加功能。cuehttp基于boost.asio开发,使用picohttpparser进行HTTP协议解析。内部依赖了nl

xcyl 26 Jul 21, 2022
LibVNCServer/LibVNCClient are cross-platform C libraries that allow you to easily implement VNC server or client functionality in your program.

LibVNCServer: A library for easy implementation of a VNC server. Copyright (C) 2001-2003 Johannes E. Schindelin If you already used LibVNCServer, you

null 851 Aug 8, 2022