cleanup
This commit is contained in:
parent
3b37b9e53f
commit
6e3d35744d
1 changed files with 8 additions and 14 deletions
22
P2P/Http.hs
22
P2P/Http.hs
|
@ -237,24 +237,18 @@ clientGet clientenv ver k cu su bypass af o auth =
|
||||||
Header h -> h
|
Header h -> h
|
||||||
_ -> error "missing data length header"
|
_ -> error "missing data length header"
|
||||||
liftIO $ print ("datalength", dl :: Integer)
|
liftIO $ print ("datalength", dl :: Integer)
|
||||||
b <- S.unSourceT (getResponse respheaders) gatherbytestring
|
b <- S.unSourceT (getResponse respheaders) gatherByteString
|
||||||
liftIO $ print "got it all, writing to file 'got'"
|
liftIO $ print "got it all, writing to file 'got'"
|
||||||
L.writeFile "got" b
|
L.writeFile "got" b
|
||||||
|
|
||||||
gatherbytestring :: S.StepT IO B.ByteString -> IO L.ByteString
|
gatherByteString :: S.StepT IO B.ByteString -> IO L.ByteString
|
||||||
gatherbytestring x = do
|
gatherByteString = unsafeInterleaveIO . go
|
||||||
l <- unsafeInterleaveIO $ go x
|
|
||||||
return l
|
|
||||||
where
|
where
|
||||||
go S.Stop = return LI.Empty
|
go S.Stop = return LI.Empty
|
||||||
go (S.Error err) = error $ show ("ERROR", err)
|
go (S.Error err) = giveup err
|
||||||
go (S.Skip s) = do
|
go (S.Skip s) = go s
|
||||||
go s
|
go (S.Effect ms) = ms >>= go
|
||||||
go (S.Effect ms) = do
|
go (S.Yield v s) = LI.Chunk v <$> unsafeInterleaveIO (go s)
|
||||||
ms >>= go
|
|
||||||
go (S.Yield v s) = do
|
|
||||||
liftIO $ print ("chunk", B.length v)
|
|
||||||
LI.Chunk v <$> unsafeInterleaveIO (go s)
|
|
||||||
|
|
||||||
clientGet'
|
clientGet'
|
||||||
:: ProtocolVersion
|
:: ProtocolVersion
|
||||||
|
|
Loading…
Add table
Reference in a new issue