[web-devel] Advice on implementing a web proxy

Gregory Collins greg at gregorycollins.net
Tue Nov 29 09:51:52 CET 2011


On Mon, Nov 28, 2011 at 2:36 PM, Kazu Yamamoto <kazu at iij.ad.jp> wrote:
> But I'm talking about relaying for body of HTTP request. In other
> words, my concern is about uploading. In my company, uploading files
> whose size is some giga bytes is quite common. I don't know how to
> relay a uploading huge file with a fixed-size buffer with Warp.

Hi Kazu,

The most straightforward way I know of to do it is through a bounded
channel (http://hackage.haskell.org/package/bounded-tchan or
http://hackage.haskell.org/package/BoundedChan). You'd fork a thread
to enumerate the output end of the socket and feed it request body
chunks through the channel, then do the reverse to proxy the response.

G
-- 
Gregory Collins <greg at gregorycollins.net>



More information about the web-devel mailing list