[web-devel] http-enumerator connecting via a http proxy
Erik de Castro Lopo
mle+hs at mega-nerd.com
Thu May 12 05:08:10 CEST 2011
Erik de Castro Lopo wrote:
> Erik de Castro Lopo wrote:
>
> > Clues? Would this need a new http-enumerator function something
> > like:
>
> This is mainly an FYI. I've been doing a little hacking on this.
> I've defined a Proxy data type as:
>
> data Proxy = Proxy
> { proxyHost :: W.Ascii -- ^ The host name of the HTTP proxy.
> , proxyPort :: Int -- ^ The port numner of the HTTP proxy.
> } deriving (Show)
>
> I then copied the http function to produce a function proxyHttp:
>
> proxyHttp
> :: MonadIO m
> => Proxy
> -> Request m
> -> (W.Status -> W.ResponseHeaders -> Iteratee S.ByteString m a)
> -> Manager
> -> Iteratee S.ByteString m a
>
> which can now do a GET via a Squid proxy to HTTP server.
I've implemented four functions; proxyHttp, proxyHttpLbs,
proxyHttpRedirect and proxyHttpLbsRedirect but it occurs
to me that if we added a field of type 'Maybe Proxy' to the
'Request m' data type, the fucntionality of the four functions
I have hacked up could be merged with the original versions
of these.
Does that sound like a sane approach?
Cheers,
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
More information about the web-devel
mailing list