<div dir="ltr">On Sat, Aug 18, 2012 at 8:52 PM, Michael Orlitzky <span dir="ltr">&lt;<a href="mailto:michael@orlitzky.com" target="_blank">michael@orlitzky.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Curl is making the request, but if I remove the (hPutStrLn stderr<br>
response_body), it doesn&#39;t work! What&#39;s even more insane is, this works:<br>
<br>
  hPutStrLn stderr response_body<br>
<br>
and this doesn&#39;t:<br>
<br>
  hPutStrLn stdout response_body<br>
<br>
whaaaaaaatttttttt? I really don&#39;t want to dump the response body to<br></blockquote><div><br></div><div>At a guess, this is laziness and buffering interacting:  stderr is usually unbuffered since it&#39;s error or log output that one usually wants to see immediately; stdout is usually line buffered unless redirected, in which case it&#39;s block buffered.</div>
<div><br></div><div>The real issue is that you (or perhaps Curl) is being too lazy and not running the log_in until the result is actually needed; hPutStrLn is forcing it, but incompletely when it&#39;s buffered.  (Which strikes me as weird unless Curl is using unsafeInterleaveIO somewhere....)  You will need to force it or hold the handle open until the content is fully evaluated; if it&#39;s in the half-closed state that hGetContents sets, it&#39;s usually best to not close the handle explicitly but let the implicit lazy close do it.</div>
<div><br></div></div>-- <br>brandon s allbery                                      <a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><br>wandering unix systems administrator (available)     (412) 475-9364 vm/sms<br>
<br>
</div>