<div dir="ltr">Looking through the code and experimenting, using the 'Expect: 100-continue' header resulted in the desired behavior - having the response headers checked before the request body was streamed.<div><br></div><div>Mark</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 28, 2016 at 2:20 PM, Mark Fine <span dir="ltr"><<a href="mailto:mark.fine@gmail.com" target="_blank">mark.fine@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm running into a problem handling requests with streaming request bodies that fail - using http-client, the failure takes a long time (potentially never) to propagate. Simple code (runnable project <a href="https://github.com/mfine/streamy" target="_blank">here</a>):<div><pre style="color:rgb(0,0,0)">{-# LANGUAGE OverloadedStrings #-}
import Control.Monad
import Data.Conduit.Combinators
import Network.HTTP.Conduit
import System.Environment
a :: IO ()
a = do
manager <- newManager tlsManagerSettings
request <- parseUrl "<a href="http://httpbin.org/status/409" target="_blank">http://httpbin.org/status/409</a>"
void $ httpLbs request manager
b :: IO ()
b = do
manager <- newManager tlsManagerSettings
request <- parseUrl "<a href="http://httpbin.org/status/409" target="_blank">http://httpbin.org/status/409</a>"
void $ flip httpLbs manager request
{ requestBody = requestBodySourceChunked $ repeatM $ return "a"
}</pre></div><div>Running "a" above works as expected (propagating the error immediately). Running "b" has variable results, mostly never propagating the error. Looking at the wire, I can see that the 409 status comes back, but the exception does not propagate.</div><div><br></div><div>Is there something I can do here to get quicker failure? Thanks!</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Mark</div></font></span></div>
</blockquote></div><br></div>