http-client 0.6.3 → 0.6.4
raw patch · 4 files changed
+26/−9 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +6/−0
- Network/HTTP/Client/Headers.hs +12/−5
- Network/HTTP/Client/Types.hs +7/−3
- http-client.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,11 @@ # Changelog for http-client +## 0.6.4++* Avoid throwing an exception when a malformed HTTP header is received,+ to be as robust as commonly used HTTP clients.+ See [#398](https://github.com/snoyberg/http-client/issues/398)+ ## 0.6.3 * Detect response body termination before reading an extra null chunk
Network/HTTP/Client/Headers.hs view
@@ -89,14 +89,21 @@ if S.null line then return $ front [] else do- header <- parseHeader line- parseHeaders (count + 1) $ front . (header:)+ mheader <- parseHeader line+ case mheader of+ Just header ->+ parseHeaders (count + 1) $ front . (header:)+ Nothing ->+ -- Unparseable header line; rather than throwing+ -- an exception, ignore it for robustness.+ parseHeaders count front - parseHeader :: S.ByteString -> IO Header+ parseHeader :: S.ByteString -> IO (Maybe Header) parseHeader bs = do let (key, bs2) = S.break (== charColon) bs- when (S.null bs2) $ throwHttp $ InvalidHeader bs- return (CI.mk $! strip key, strip $! S.drop 1 bs2)+ if S.null bs2+ then return Nothing+ else return (Just (CI.mk $! strip key, strip $! S.drop 1 bs2)) strip = S.dropWhile (== charSpace) . fst . S.spanEnd (== charSpace)
Network/HTTP/Client/Types.hs view
@@ -518,9 +518,9 @@ -- -- @since 0.5.0 , responseTimeout :: ResponseTimeout- -- ^ Number of microseconds to wait for a response. If- -- @Nothing@, will wait indefinitely. Default: use- -- 'managerResponseTimeout' (which by default is 30 seconds).+ -- ^ Number of microseconds to wait for a response (see 'ResponseTimeout'+ -- for more information). Default: use 'managerResponseTimeout' (which by+ -- default is 30 seconds). -- -- Since 0.1.0 , cookieJar :: Maybe CookieJar@@ -565,8 +565,12 @@ -- @since 0.5.0 data ResponseTimeout = ResponseTimeoutMicro !Int+ -- ^ Wait the given number of microseconds and then throw an exception | ResponseTimeoutNone+ -- ^ Wait indefinitely | ResponseTimeoutDefault+ -- ^ Fall back to the manager setting ('managerResponseTimeout') or, in its+ -- absence, Wait 30 seconds and then throw an exception. deriving (Eq, Show) instance Show Request where
http-client.cabal view
@@ -1,5 +1,5 @@ name: http-client-version: 0.6.3+version: 0.6.4 synopsis: An HTTP client engine description: Hackage documentation generation is not reliable. For up to date documentation, please see: <http://www.stackage.org/package/http-client>. homepage: https://github.com/snoyberg/http-client