All Projects → puzza007 → Katipo

puzza007 / Katipo

Licence: other
HTTP2 client for Erlang based on libcurl and libevent

Programming Languages

erlang
1774 projects

Projects that are alternatives of or similar to Katipo

Node Libcurl
libcurl bindings for Node.js
Stars: ✭ 447 (+396.67%)
Mutual labels:  http-client, http2, curl, libcurl
Curlsharp
CurlSharp - .Net binding and object-oriented wrapper for libcurl.
Stars: ✭ 153 (+70%)
Mutual labels:  http-client, http2, curl, libcurl
request-extra
⚡️ Extremely stable HTTP request module built on top of libcurl with retries, timeouts and callback API
Stars: ✭ 14 (-84.44%)
Mutual labels:  curl, http-client, libcurl
curly.hpp
Simple cURL C++17 wrapper
Stars: ✭ 48 (-46.67%)
Mutual labels:  curl, http-client, libcurl
Kurly
kurly is an alternative to the widely popular curl program, written in Golang.
Stars: ✭ 319 (+254.44%)
Mutual labels:  http-client, http2, curl
Guzzle
Guzzle, an extensible PHP HTTP client
Stars: ✭ 21,384 (+23660%)
Mutual labels:  http-client, curl
Curlcpp
An object oriented C++ wrapper for CURL (libcurl)
Stars: ✭ 462 (+413.33%)
Mutual labels:  curl, libcurl
Urllib
Request HTTP(s) URLs in a complex world
Stars: ✭ 600 (+566.67%)
Mutual labels:  http-client, curl
Curlie
The power of curl, the ease of use of httpie.
Stars: ✭ 877 (+874.44%)
Mutual labels:  http-client, curl
Yii2 Httpclient
Yii 2 HTTP client
Stars: ✭ 406 (+351.11%)
Mutual labels:  http-client, curl
Gun
HTTP/1.1, HTTP/2 and Websocket client for Erlang/OTP.
Stars: ✭ 710 (+688.89%)
Mutual labels:  http-client, http2
Piaf
Client library for HTTP/1.X / HTTP/2 written entirely in OCaml.
Stars: ✭ 86 (-4.44%)
Mutual labels:  http-client, http2
Curl
A command line tool and library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP. libcurl offers a myriad of powerful features
Stars: ✭ 22,875 (+25316.67%)
Mutual labels:  curl, libcurl
Fast Android Networking
🚀 A Complete Fast Android Networking Library that also supports HTTP/2 🚀
Stars: ✭ 5,346 (+5840%)
Mutual labels:  http-client, http2
Httpdirfs
A filesystem which allows you to mount HTTP directory listings, with a permanent cache. Now with Airsonic / Subsonic support!
Stars: ✭ 443 (+392.22%)
Mutual labels:  http-client, libcurl
Everything Curl
The book documenting the curl project, the curl tool, libcurl and everything related to this.
Stars: ✭ 885 (+883.33%)
Mutual labels:  curl, libcurl
Http Client
A high-performance, high-stability, cross-platform HTTP client.
Stars: ✭ 86 (-4.44%)
Mutual labels:  http-client, curl
Gmod Chttp
A HTTP()-compatible wrapper for curl in Garry's Mod.
Stars: ✭ 39 (-56.67%)
Mutual labels:  curl, libcurl
Lush Http
Smart Http Client for PHP
Stars: ✭ 60 (-33.33%)
Mutual labels:  http-client, curl
Restclient Cpp
C++ client for making HTTP/REST requests
Stars: ✭ 1,206 (+1240%)
Mutual labels:  http-client, libcurl

katipo

An HTTP/HTTP2 client library for Erlang built around libcurl-multi and libevent.

Status

Beta

Build Status Hex pm Coverage Status

Usage

{ok, _} = application:ensure_all_started(katipo).
Pool = api_server,
{ok, _} = katipo_pool:start(Pool, 2, [{pipelining, multiplex}]).
Url = <<"https://example.com">>.
ReqHeaders = [{<<"User-Agent">>, <<"katipo">>}].
Opts = #{headers => ReqHeaders,
         body => <<"0d5cb3c25b0c5678d5297efa448e1938">>,
         connecttimeout_ms => 5000,
         proxy => <<"http://127.0.0.1:9000">>,
         sslverifyhost => false,
         sslverifypeer => false},
{ok, #{status := 200,
       headers := RespHeaders,
       cookiejar := CookieJar,
       body := RespBody}} = katipo:post(Pool, Url, Opts).

Or passing the entire request as a map

{ok, _} = application:ensure_all_started(katipo).
Pool = api_server,
{ok, _} = katipo_pool:start(Pool, 2, [{pipelining, multiplex}]).
ReqHeaders = [{<<"User-Agent">>, <<"katipo">>}].
Req = #{url => <<"https://example.com">>.
        method => post,
        headers => ReqHeaders,
        body => <<"0d5cb3c25b0c5678d5297efa448e1938">>,
        connecttimeout_ms => 5000,
        proxy => <<"http://127.0.0.1:9000">>,
        ssl_verifyhost => false,
        ssl_verifypeer => false},
{ok, #{status := 200,
       headers := RespHeaders,
       cookiejar := CookieJar,
       body := RespBody}} = katipo:req(Pool, Req).

Session interface. Cookies handled automatically and options merged. Inspired by Requests sessions.

{ok, _} = application:ensure_all_started(katipo).
Pool = api_server,
{ok, _} = katipo_pool:start(Pool, 2, [{pipelining, multiplex}]).
ReqHeaders = [{<<"User-Agent">>, <<"katipo">>}].
Opts = #{url => <<"https://example.com">>.
         method => post,
         headers => ReqHeaders,
         connecttimeout_ms => 5000,
         proxy => <<"http://127.0.0.1:9000">>,
         sslverifyhost => false,
         sslverifypeer => false}.
{ok, Session} = katipo_session:new(Pool, Opts).
{{ok, #{status := 200}}, Session2} =
    katipo_session:req(#{body => <<"some data">>}, Session).
{{ok, #{status := 200}}, Session3} =
    katipo_session:req(#{body => <<"different payload data">>}, Session2).

Why

We wanted a compatible and high-performance HTTP client so took advantage of the 15+ years of development that has gone into libcurl. To allow large numbers of simultaneous connections libevent is used along with the libcurl-multi interface.

Documentation

API

-type method() :: get | post | put | head | options.
katipo_pool:start(Name :: atom(), size :: pos_integer(), PoolOptions :: proplist()).
katipo_pool:stop(Name :: atom()).

katipo:req(Pool :: atom(), Req :: map()).
katipo:Method(Pool :: atom(), URL :: binary()).
katipo:Method(Pool :: atom(), URL :: binary(), ReqOptions :: map()).

Application Config

Option Values Default Notes
mod_metrics folsom | exometer | noop noop see erlang-metrics

Request options

Option Type Default Notes
headers [{binary(), iodata()}] []
cookiejar opaque (returned in response) []
body iodata() <<>>
connecttimeout_ms pos_integer() 30000 docs
followlocation boolean() false docs
ssl_verifyhost boolean() true docs
ssl_verifypeer boolean() true docs
capath binary() undefined
cacert binary() undefined
timeout_ms pos_integer() 30000
maxredirs non_neg_integer() 9
proxy binary() undefined docs
return_metrics boolean() false
tcp_fastopen boolean() false docs curl >= 7.49.0
interface binary() undefined docs
unix_socket_path binary() undefined docs curl >= 7.40.0
lock_data_ssl_session boolean() false docs curl >= 7.23.0
doh_url binary() undefined docs curl >= 7.62.0
http_version curl_http_version_none
curl_http_version_1_0
curl_http_version_1_1
curl_http_version_2_0
curl_http_version_2tls
curl_http_version_2_prior_knowledge
curl_http_version_none docs curl >= 7.62.0

Responses

{ok, #{status := pos_integer(),
       headers := headers(),
       cookiejar := cookiejar(),
       body := body(),
       metrics => proplist()}}

{error, #{code := atom(), message := binary()}}

Pool Options

Option Type Default Note
pipelining `nothing http1 multiplex`
max_pipeline_length non_neg_integer() 100
max_total_connections non_neg_integer() 0 (no limit) docs

Metrics

  • ok
  • error
  • status.XXX
  • total_time
  • curl_time
  • namelookup_time
  • connect_time
  • appconnect_time
  • pretransfer_time
  • redirect_time
  • starttransfer_time

Dependencies

Ubuntu Trusty

sudo apt-get install git libwxgtk2.8-0 libwxbase2.8-0 libevent-dev libcurl4-openssl-dev libcurl4-openssl-dev

wget http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_esl/esl-erlang_18.0-1~ubuntu~trusty_amd64.deb

sudo dpkg -i esl-erlang_18.0-1~ubuntu~trusty_amd64.deb

Fedora

sudo dnf install libevent.x86_64 libcurl.x86_64 libevent-devel.x86_64

OSX

brew install --with-c-ares --with-nghttp2 curl
brew install libevent

Building

rebar3 compile

TODO

  • A more structured way to ifdef features based on curl version
  • Better session interface
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].