Loading p/haskell-http-client/debian/changelog +7 −0 Original line number Diff line number Diff line haskell-http-client (0.5.13.1-3) unstable; urgency=medium * Backport upstream commit 503d88f0f165453c295f530d74f27f8f689ace2d as ignore-malformed-headers.diff (Closes: #931715). -- Sean Whitton <spwhitton@spwhitton.name> Tue, 09 Jul 2019 19:55:33 +0100 haskell-http-client (0.5.13.1-2) unstable; urgency=medium * Remove build dependency on libghc-text-dev (provided by ghc-8.4.3) Loading p/haskell-http-client/debian/patches/ignore-malformed-headers.diff 0 → 100644 +31 −0 Original line number Diff line number Diff line Backported from upstream commit 503d88f0f165453c295f530d74f27f8f689ace2d. See #931715. --- a/Network/HTTP/Client/Headers.hs +++ b/Network/HTTP/Client/Headers.hs @@ -84,13 +84,20 @@ parseStatusHeaders conn timeout' cont 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) p/haskell-http-client/debian/patches/series +1 −0 Original line number Diff line number Diff line disable-external-network-connection-test.diff ignore-malformed-headers.diff Loading
p/haskell-http-client/debian/changelog +7 −0 Original line number Diff line number Diff line haskell-http-client (0.5.13.1-3) unstable; urgency=medium * Backport upstream commit 503d88f0f165453c295f530d74f27f8f689ace2d as ignore-malformed-headers.diff (Closes: #931715). -- Sean Whitton <spwhitton@spwhitton.name> Tue, 09 Jul 2019 19:55:33 +0100 haskell-http-client (0.5.13.1-2) unstable; urgency=medium * Remove build dependency on libghc-text-dev (provided by ghc-8.4.3) Loading
p/haskell-http-client/debian/patches/ignore-malformed-headers.diff 0 → 100644 +31 −0 Original line number Diff line number Diff line Backported from upstream commit 503d88f0f165453c295f530d74f27f8f689ace2d. See #931715. --- a/Network/HTTP/Client/Headers.hs +++ b/Network/HTTP/Client/Headers.hs @@ -84,13 +84,20 @@ parseStatusHeaders conn timeout' cont 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)
p/haskell-http-client/debian/patches/series +1 −0 Original line number Diff line number Diff line disable-external-network-connection-test.diff ignore-malformed-headers.diff