也許是一個愚蠢的做事方式,但在這裏。我想分割處理響應的HTTP請求發送/接收。管道獲取Network.Socket.ByteString.recv:失敗(未知錯誤)
import Pipes
import qualified Pipes.HTTP as HTTP
import Pipes.Core
import qualified Pipes.ByteString as PB
import Network.Socket (withSocketsDo)
fetch m url = do
req <- lift $ HTTP.parseUrl url
resp <- lift $ HTTP.withHTTP req m return
url' <- respond $ HTTP.responseBody resp
fetch m url'
client :: Client String (Producer PB.ByteString IO()) IO()
client = do
b <- request "http://www.google.com"
lift $ runEffect $ b >-> PB.stdout
main = withSocketsDo $ HTTP.withManager HTTP.tlsManagerSettings $ \m ->
runEffect $ fetch m +>> client
似乎是合法的。但我得到部分響應打印和「Network.Socket.ByteString.recv:失敗(未知錯誤)」。我需要做什麼改變?
相關類別:http://stackoverflow.com/questions/9406463/withfile-vs-openfile – user3237465 2014-12-07 04:50:10