[Haskell-cafe] How to use http-enumerator with hoauth?

Jeremy Fitzhardinge jeremy at goop.org
Wed Feb 16 01:05:52 CET 2011

On 02/15/2011 02:14 PM, Vincent Hanquez wrote:
> Clearly, http-enumerator is the best package for doing http/https. however
> since it's pretty new, lots of package still uses their own abstraction for
> doing things.
> While it may be possible to retrofit hoauth to use http-enumerator, using the
> httpclient typeclass, that's going to be hard to fit the full enumerator
> interface on it, so you won't benefit of streaming; You may as well just use
> network.curl for now, which is what i've seen used with hoauth.

I don't really see why hoauth needs to make its own http requests at
all, except perhaps as a convenience.  At heart, doesn't it just need to
set up requests and parse certain responses?  It could almost be pure,
aside from needing to get timestamps and generate nonces (which, btw,
doesn't seem to be using a cryptographically strong RNG).  But that
suffers from not having standard request/response types.

> you should check the twidge twitter utility and/or yesod-auth-oauth, that both
> uses curl/hoauth.

Thanks for the pointers.  Does Network.Curl support interleaved
processing on infinite streams?

> It would be really useful to see an hoauth fully using enumerator and
> http-enumerator (and not redefining a boat load of stuff), but IMO you'll need
> to understand enumerators before tackling such a challenge.
> Also Wai is for abstracting server side "transport" (cgi/fastcgi/others),

Yes, that's what I thought, but http-enumerator dips into it for its
http response types.

> the HTTP package doesn't do TLS.

That's unfortunate, but it seems like it could have been a fairly easy
thing to address.  Or does it have other deficiencies?


More information about the Haskell-Cafe mailing list