Re: Session support for http-client

Carl Gay <[email protected]> Mon, 1 Jul 2013 18:58:53 -0400
Newsgroups gmane.comp.lang.dylan.gwydion.devel
Message-ID <CALekcH1ODs_OnBEqiF7JaN2eecnnPga7UMAqKaEjvWNzu-nmug@mail.gmail.com>
On Sun, Jun 30, 2013 at 6:18 AM, Francesco Ceccon <[email protected]>wrote:

> Hello,
> I think I reached a point in my work on http where I can start working on
> session support for http-client.
>
> Some ideas were flying around on IRC, but I think the ML is a better place
> to
> discuss it.
>
> In Python's Requests a Session object contains the authentication
> parameters,
> some default headers, event-handling hooks, proxies, a stream were to
> stream
> the response and some query parameters to attach to each request.
> I think we could make a <http-client-session> (any idea for a better name?)
> object with the same slots (at least for the options we support at the
> moment).
> We can pass this object to the http-* methods either as a positional
> parameter
> or as a keyword parameter.
>
> Bruce suggested to use a middleware, but to be honest I don't understand
> what
> he means.
>
> Of course any suggestion is more than welcome.
>
> - Francesco
> _______________________________________________
> hackers mailing list
> [email protected]
> https://lists.opendylan.org/mailman/listinfo/hackers
>

That all sounds reasonable to me.  I think the name <http-client-session>
is fine.

I would just suggest passing the session as a keyword argument to
http-request to make the simple case (no session) easy.  But then have
http-request dispatch on the session object in the right places so that
it's possible to subclass <http-client-session> and add behavior usefully.

On an unrelated note, I'm not sure it's worth having all the
http-{post,get,options,...} entry points.  It's pretty easy to pass the
method string to http-request.

_______________________________________________
hackers mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/hackers