http-conduit 1.6.1.1 → 1.6.1.2
raw patch · 3 files changed
+32/−14 lines, 3 filesdep ~lifted-basedep ~network-conduitPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: lifted-base, network-conduit
API changes (from Hackage documentation)
Files
- Network/HTTP/Conduit/Parser.hs +5/−4
- http-conduit.cabal +3/−3
- test/main.hs +24/−7
Network/HTTP/Conduit/Parser.hs view
@@ -32,7 +32,7 @@ newline return (k, v) -notNewlineColon, isSpace, notNewline :: Word8 -> Bool+notNewlineColon, isSpace, isNumber, notNewline :: Word8 -> Bool notNewlineColon 10 = False -- LF notNewlineColon 13 = False -- CR@@ -42,6 +42,8 @@ isSpace 32 = True isSpace _ = False +isNumber i = 0x30 <= i && i <= 0x39+ notNewline 10 = False notNewline 13 = False notNewline _ = True@@ -77,13 +79,12 @@ _ <- manyTill (take 1 >> return ()) (try $ string "HTTP/") <?> "HTTP/" ver <- takeWhile1 $ not . isSpace _ <- word8 32 -- space- statCode <- takeWhile1 $ not . isSpace+ statCode <- takeWhile1 isNumber statCode' <- case reads $ S8.unpack statCode of [] -> fail $ "Invalid status code: " ++ S8.unpack statCode (x, _):_ -> return x- _ <- word8 32- statMsg <- takeWhile1 $ notNewline+ statMsg <- try (word8 32 >> takeWhile notNewline) <|> return "" newline if (statCode == "100") then newline >> parseStatus
http-conduit.cabal view
@@ -1,5 +1,5 @@ name: http-conduit-version: 1.6.1.1+version: 1.6.1.2 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -43,7 +43,7 @@ , data-default , text , transformers-base >= 0.4 && < 0.5- , lifted-base >= 0.1 && < 0.2+ , lifted-base >= 0.1 , socks >= 0.4 && < 0.5 , time , cookie >= 0.4 && < 0.5@@ -112,7 +112,7 @@ , http-types , cookie , regex-compat- , network-conduit+ , network-conduit >= 0.6 , resourcet , void , deepseq
test/main.hs view
@@ -15,8 +15,8 @@ import Control.Exception.Lifted (try, SomeException) import Network.HTTP.Conduit.ConnInfo import CookieTest (cookieTest)-import Data.Conduit.Network (runTCPServer, ServerSettings (..), HostPreference (HostAny))-import Data.Conduit (($$))+import Data.Conduit.Network (runTCPServer, serverSettings, HostPreference (HostAny), appSink, appSource)+import Data.Conduit (($$), yield) import Control.Monad.Trans.Resource (register) import Control.Monad.IO.Class (liftIO) import Data.ByteString.UTF8 (fromString)@@ -252,17 +252,28 @@ [ ["hello", "world"] , replicate 500 "foo\003\n\r" ]+ describe "no status message" $ do+ it "works" $ do+ tid <- forkIO noStatusMessage+ threadDelay 1000000+ withManager $ \manager -> do+ _ <- register $ killThread tid+ req <- parseUrl "http://127.0.0.1:3008"+ res <- httpLbs req manager+ liftIO $ do+ Network.HTTP.Conduit.responseStatus res `shouldBe` status200+ responseBody res `shouldBe` "foo" overLongHeaders :: IO ()-overLongHeaders = runTCPServer (ServerSettings 3004 HostAny) $ \_ sink ->- src $$ sink+overLongHeaders = runTCPServer (serverSettings 3004 HostAny) $ \app ->+ src $$ appSink app where src = sourceList $ "HTTP/1.0 200 OK\r\nfoo: " : repeat "bar" notOverLongHeaders :: IO ()-notOverLongHeaders = runTCPServer (ServerSettings 3005 HostAny) $ \src' sink -> do- src' $$ CL.drop 1- src $$ sink+notOverLongHeaders = runTCPServer (serverSettings 3005 HostAny) $ \app -> do+ appSource app $$ CL.drop 1+ src $$ appSink app where src = sourceList $ [S.concat $ "HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\nContent-Length: 16384\r\n\r\n" : ( take 16384 $ repeat "x")] @@ -304,3 +315,9 @@ echo = run 3007 $ \req -> do bss <- Network.Wai.requestBody req $$ CL.consume return $ responseLBS status200 [] $ L.fromChunks bss++noStatusMessage :: IO ()+noStatusMessage = runTCPServer (serverSettings 3008 HostAny) $ \app ->+ src $$ appSink app+ where+ src = yield "HTTP/1.0 200\r\nContent-Length: 3\r\n\r\nfoo: barbazbin"