[erlang-questions] HTTP client for OAuth

Kenneth Lakin <>
Wed Feb 24 17:25:19 CET 2016


On 02/24/2016 07:49 AM, Garrett Smith wrote:
> 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?

I'm not sure what request volume you're dealing with, but I'm _fairly_
pleased with shotgun <https://github.com/inaka/shotgun>. However -unlike
httpc- It doesn't do connection pooling of any sort, so you've got to
handle that yourself if it's something you need.

Be warned that it uses gun under the hood, and gun's purpose in life is
to keep your HTTP connection open forever and always. So, if you're
connecting to Other People's Servers(tm) maybe think about being nice
and calling shotgun:close/1 when you expect that you're not going to use
the connection for an extended period of time.

Additionally, gun does what it calls "HTTP keepalive", which is to send
a <CR><LF> after five seconds of idle time on an open connection. The
length of idle time before a keepalive is sent *is* configurable, but
shotgun doesn't currently let you pass in the options required to change
this. These keepalives cause trouble with _some_ HTTP servers (such as
the server that serves erlang.org). If you get request failures after
five seconds of idle time, this might be the culprit. If need be, I can
send along a patch that will effectively disable HTTP keepalives by
setting gun's keepalive timeout to something absurdly large.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160224/79e9c1c7/attachment.bin>


More information about the erlang-questions mailing list