[erlang-questions] HTTP client with sessions support
Fri Jun 12 15:31:22 CEST 2015
One of the reasons I like (and extensively use) Gun is precisely because it does NOT automatically do stuff like track cookies for you or follow redirects.
In the past we have used a seemingly endless train of Erlang HTTP clients and been tripped up when they try to be too helpful (retrying requests under the covers etc.) There is plenty of room for helper libraries on top of things like gun (such as shotgun - internally we have one called spud_gun), but I’m always nervous when the low level library tries to “help”. Already gun by default sends keep alive messages that break e.g. API calls to AWS (Amazon terminates the tcp connection when it notices it has inbound data that its API says should not be there).
I could just about see cookie handling as falling the right side of the “does too much for you” line, but have a strong preference that helper functionality is clearly separated from the underlying core.
Big fan of Gun / Cowboy so absolutely no criticism intended - but you did say “suggestions welcome”.
On Friday, Jun 12, 2015 at 1:44 pm, Loïc Hoguin <essen@REDACTED>, wrote:
On 06/12/2015 02:19 PM, Mikl Kurkov wrote:
> On Fri, Jun 12, 2015 at 1:39 AM, Loïc Hoguin <essen@REDACTED
> <mailto:essen@REDACTED>> wrote:
> Right we do want to have a cookie store later on. I am not sure how
> this is supposed to look yet though. Suggestions welcome, I believe
> there is a ticket for it.
> I'm afraid it will not be easy to find solution that will fit all user
> Someone need few huge client sessions, keeping cookies for many sites in
> ETS or even SQL database.
> It seems httpc optimized for this use case.
> In my case I need many tiny isolated sessions, so it is possible to have
> session store in state.
> That's why I like xhttpc approach - you get some stable API and can use
> different implementations for
> say cookie store that fits your needs.
The way I see it is that Gun needs to keep track of cookies for the
current connection *and* send cookies to the user process if any other
kind of tracking is required. Feeding cookies back into the Gun process
should be a function call or option away.
erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions