<div dir="ltr"><br><br><div class="gmail_quote">On Sun, Mar 22, 2015 at 10:01 AM Jos van den Oever <<a href="mailto:jos@vandenoever.info">jos@vandenoever.info</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sunday 08 March 2015 07:28:30 you wrote:<br>
> I've updated that Gist to be compatible with WAI 3.0. The basic changes I<br>
> made were:<br>
><br>
> 1. Change the way Warp settings are applied (no longer use record syntax,<br>
> but explicit set* functions).<br>
> 2. conduit is no longer the standard streaming interface for WAI, so<br>
> imported Network.Wai.Conduit and used helper functions from there.<br>
> 3. The specific question you asked about: the semantics for how to do<br>
> resource allocation in an application have changed. There were some holes<br>
> in the previous approach that allowed async exceptions to leak in at the<br>
> wrong time. Instead, WAI 3.0 uses a similar interface to most resource<br>
> allocation functions in Haskell (like bracket or withFile). Specifically,<br>
> this looks like:<br>
><br>
><br>
> HCl.withResponse req2 man $ \res -> do<br>
> let body = mapOutput (Chunk . fromByteString) $<br>
> HCC.bodyReaderSource $ HCl.responseBody res<br>
> headers = filter safeResHeader $ HCl.responseHeaders res<br>
> respond $ responseSource (HCl.responseStatus res) headers body<br>
<br>
I'd like my proxy to be a caching proxy so each request shoule be saved to a<br>
file. I've tried adding an additional sink, (sinkFile) or conduit (conduitFie)<br>
to the HCC.bodyReaderSource, but cannot it right. What would be a good way to<br>
do this?<br>
<br><br></blockquote><div><br></div><div>What have you tried so far?</div><div><br></div><div>Michael </div></div></div>