+ writeBodyChunk itr
+ = do willDiscardBody <- atomically $ readItr itr itrWillDiscardBody id
+ willChunkBody <- atomically $ readItr itr itrWillChunkBody id
+ chunk <- atomically $ do chunk <- readItr itr itrBodyToSend id
+ writeItr itr itrBodyToSend B.empty
+ return chunk
+ unless willDiscardBody
+ $ do if willChunkBody then
+ do hPrintf h "%x\r\n" (toInteger $ B.length chunk)
+ B.hPut h chunk
+ hPutStr h "\r\n"
+ else
+ B.hPut h chunk
+ hFlush h
+ awaitSomethingToWrite