[web-devel] http-enumerator connecting via a http proxy

Erik de Castro Lopo mle+hs at mega-nerd.com
Wed May 11 13:02:20 CEST 2011


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'm now 
working on the CONNECT method for connecting to HTTPS.

Once I get CONNECT working as well, I'm going to try and share as
much code between the proxy and non-proxy versions as possible.

I'm currently doing this in a local branch so I can merge upstream
and rebase as needed.

Cheers,
Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/



More information about the web-devel mailing list