[erlang-questions] HTTP client for OAuth

Benoit Chesneau <>
Wed Feb 24 17:49:08 CET 2016


On Wed, Feb 24, 2016 at 4:49 PM Garrett Smith <> wrote:

> I'm taking time off from typing -module attributes to focus on my backlog
> of other important problems...
>
> I'm interfacing with various OAuth providers within an Erlang application
> and I need a simple HTTP client. I've poked around the ecosystem and have
> learned that HTTP clients are the new MySQL clients in terms of
> which-one-to-freakin-use.
>
> As I'm using this for user auth, memory and performance are
> considerations, though far behind stability and actual-workingness.
>
> (In the interest of the later, I'd traditionally wrap OS curl processes
> because curl is known to actually work, but that _might_ not be feasible as
> the application grows. Come to think of it, I'm going to start with a curl
> wrapper and iterate by measuring, so never mind.)
>
> I'd love to learn from the field experience of others. Is anyone really,
> really happy with the HTTP client he or she is using for semi-heavy loads
> like user auth?
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions


Well I would advise hackney of course :) The pool part is completely
optional  and it will be gone in the week release anyway. It's used as a
large scale in some companies handing millions of connections. It provides
you a REST client API, streaming (transparent or not) and so on.

If you want to do in a minimal way, I extracted the parser in a library:
https://github.com/benoitc/nplib/blob/master/src/nplib_http.erl

and then uses it with gen_tcp.

It provides same kind of API than you find with erlang:decode_parser/3 but
with less issue. For example decode_parser is not able to parse this:
https://friendpaste.com/6w5CeBKwYZnMInCRZadlIX

(not sure why yet, investigating it).

Hope it's useful, any feedback is welcome. I  would be interested to know
what your choice at then end and why. I always enjoy to improve hackney
when it's possible.

- benoît
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160224/b2e063a5/attachment.html>


More information about the erlang-questions mailing list