/hackney_lib

WEB toolkit including miscellaneous modules to play with HTTP and Web protocols

Primary LanguageErlangOtherNOASSERTION

hackney_lib - Web toolkit

Copyright (c) 2013 Benoît Chesneau.

Version: 0.2.2

hackney

hackney_lib is a WEB toolkit including miscellaneous modules to play with HTTP and Web protocols

Main features:

  • low memory usage
  • binary only
  • Full HTTP parser in Erlang for clients and servers
  • HTTP dates parsing
  • Cookie encoding/decoding
  • HTTP headers parsing
  • Multipart encoding/Idecoding
  • Miscellaneous functions to handle URIs

Coming:

  • SPDY protocol support
  • Websocket protocol support

Useful modules are:

  • hackney_http: HTTP parser in pure Erlang. This parser is able to parse HTTP responses and requests in a streaming fashion. If not set it will be autodetect if it's a request or a response if needed.

  • hackney_headers Module to manipulate HTTP headers

  • hackney_cookie: Module to manipulate cookies.

  • hackney_multipart: Module to encode/decode multipart.

  • hackney_url: Module to parse and create URIs.

  • hackney_date: Module to parse HTTP dates.

Read the NEWS file to get last changelog.

Installation

Download the sources from our Github repository

To build the application simply run 'make'. This should build .beam, .app files and documentation.

To run tests run 'make test'. To generate doc, run 'make doc'.

Or add it to your rebar config

{deps, [
    ....
    {hackney_lib, ".*", {git, "git://github.com/benoitc/hackney_lib.git", {branch, "master"}}}
]}.

Basic usage

The basic usage of hackney is:

Start hackney_lib

hackney is an OTP application. You have to start it first before using any of the functions. The hackney application will start the default socket pool for you.

To start in the console run:

$ erl -pa ebin -pa deps/mimetypes/ebin

It will start hackney_lib and all of the application it depends on:

application:start(mimetypes),
application:start(hackney_lib).

Or add hackney_lib to the applications property of your .app in a release

Contribute

For issues, comments or feedback please create an issue.

Notes for developers

If you want to contribute patches or improve the docs, you will need to build hackney using the rebar_dev.config file. It can also be built using the Makefile:

$ make dev ; # compile & get deps
$ make devclean ; # clean all files

Modules

hackney_bstr
hackney_cookie
hackney_date
hackney_headers
hackney_http
hackney_multipart
hackney_url