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

Michael Snoyman michael at snoyman.com
Thu May 12 06:15:00 CEST 2011


On Thu, May 12, 2011 at 6:08 AM, Erik de Castro Lopo
<mle+hs at mega-nerd.com>wrote:

> 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?
>
> Yes, I think that sounds good. Just let me know when I should look at the
code; I'm impressed how quickly you're getting this done!

Michael


> Cheers,
> Erik
> --
> ----------------------------------------------------------------------
> Erik de Castro Lopo
> http://www.mega-nerd.com/
>
> _______________________________________________
> web-devel mailing list
> web-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/web-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110512/ca709062/attachment-0001.htm>


More information about the web-devel mailing list