diff --git a/cabal.project.freeze b/cabal.project.freeze new file mode 100644 index 00000000..769a98e6 --- /dev/null +++ b/cabal.project.freeze @@ -0,0 +1,210 @@ +active-repositories: hackage.haskell.org:merge +constraints: any.Cabal ==3.10.3.0, + any.Cabal-syntax ==3.10.3.0, + any.HUnit ==1.6.2.0, + any.HsOpenSSL ==0.11.7.8, + HsOpenSSL -fast-bignum -homebrew-openssl -macports-openssl -use-pkg-config, + any.HsOpenSSL-x509-system ==0.1.0.4, + any.OneTuple ==0.4.2, + any.QuickCheck ==2.15.0.1, + QuickCheck -old-random +templatehaskell, + any.StateVar ==1.2.2, + any.aeson ==2.2.3.0, + aeson +ordered-keymap, + any.ansi-terminal ==1.1.2, + ansi-terminal -example, + any.ansi-terminal-types ==1.1, + any.appar ==0.1.8, + any.array ==0.5.6.0, + any.asn1-encoding ==0.9.6, + any.asn1-parse ==0.9.5, + any.asn1-types ==0.3.4, + any.assoc ==1.1.1, + assoc -tagged, + any.async ==2.2.5, + async -bench, + any.attoparsec ==0.14.4, + attoparsec -developer, + any.attoparsec-aeson ==2.2.2.0, + any.auto-update ==0.1.6, + any.base ==4.18.2.1, + any.base-orphans ==0.9.3, + any.base16-bytestring ==1.0.2.0, + any.base64-bytestring ==1.2.1.0, + any.basement ==0.0.16, + any.bifunctors ==5.6.2, + bifunctors +tagged, + any.binary ==0.8.9.1, + any.bitvec ==1.1.5.0, + bitvec +simd, + any.blaze-builder ==0.4.2.3, + any.bsb-http-chunked ==0.0.0.4, + any.byteorder ==1.0.4, + any.bytestring ==0.11.5.3, + any.call-stack ==0.4.0, + any.case-insensitive ==1.2.1.0, + any.cborg ==0.2.10.0, + cborg +optimize-gmp, + any.cereal ==0.5.8.3, + cereal -bytestring-builder, + any.character-ps ==0.1, + any.clock ==0.8.4, + clock -llvm, + any.colour ==2.3.6, + any.comonad ==5.0.9, + comonad +containers +distributive +indexed-traversable, + any.conduit ==1.3.6, + any.conduit-extra ==1.3.6, + any.containers ==0.6.7, + any.contravariant ==1.5.5, + contravariant +semigroups +statevar +tagged, + any.cookie ==0.5.0, + any.crypto-token ==0.1.2, + any.crypton ==1.0.1, + crypton -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq +support_pclmuldq +support_rdrand -support_sse +use_target_attributes, + any.crypton-connection ==0.4.3, + any.crypton-x509 ==1.7.7, + any.crypton-x509-store ==1.6.9, + any.crypton-x509-system ==1.6.7, + any.crypton-x509-validation ==1.6.13, + any.data-default ==0.8.0.0, + any.data-default-class ==0.2.0.0, + any.data-fix ==0.3.4, + any.deepseq ==1.4.8.1, + any.directory ==1.3.8.5, + any.distributive ==0.6.2.1, + distributive +semigroups +tagged, + any.dlist ==1.0, + dlist -werror, + any.exceptions ==0.10.7, + any.filepath ==1.4.300.1, + any.gauge ==0.2.5, + gauge +analysis, + any.generically ==0.1.1, + any.ghc-bignum ==1.3, + any.ghc-boot-th ==9.6.6, + any.ghc-prim ==0.10.0, + any.half ==0.3.2, + any.hashable ==1.5.0.0, + hashable -arch-native -random-initial-seed, + any.haskell-lexer ==1.1.2, + any.hourglass ==0.2.12, + any.hsc2hs ==0.68.10, + hsc2hs -in-ghc-tree, + any.hspec ==2.11.10, + any.hspec-core ==2.11.10, + any.hspec-discover ==2.11.10, + any.hspec-expectations ==0.8.4, + http-client +network-uri, + http-client-openssl -test-proxy, + http-conduit +aeson, + any.http-date ==0.0.11, + any.http-types ==0.12.4, + any.http2 ==4.2.2, + http2 -devel -h2spec, + any.indexed-traversable ==0.1.4, + any.indexed-traversable-instances ==0.1.2, + any.integer-conversion ==0.1.1, + any.integer-gmp ==1.1, + any.integer-logarithms ==1.0.3.1, + integer-logarithms -check-bounds +integer-gmp, + any.iproute ==1.7.15, + any.memory ==0.18.0, + memory +support_bytestring +support_deepseq, + any.mime-types ==0.1.2.0, + any.monad-control ==1.0.3.1, + any.mono-traversable ==1.0.20.0, + any.mtl ==2.3.1, + any.network ==3.2.7.0, + network -devel, + any.network-byte-order ==0.1.7, + any.network-uri ==2.6.4.2, + any.old-locale ==1.0.0.7, + any.old-time ==1.1.0.4, + any.optparse-applicative ==0.18.1.0, + optparse-applicative +process, + any.os-string ==2.0.7, + any.parsec ==3.1.16.1, + any.pem ==0.2.4, + any.pretty ==1.1.3.6, + any.prettyprinter ==1.7.1, + prettyprinter -buildreadme +text, + any.prettyprinter-ansi-terminal ==1.1.3, + any.primitive ==0.9.0.0, + any.process ==1.6.19.0, + any.psqueues ==0.2.8.0, + any.quickcheck-io ==0.2.0, + any.random ==1.2.1.2, + any.recv ==0.1.0, + any.resourcet ==1.3.0, + any.rts ==1.0.2, + any.safe-exceptions ==0.1.7.4, + any.scientific ==0.3.8.0, + scientific -integer-simple, + any.semialign ==1.3.1, + semialign +semigroupoids, + any.semigroupoids ==6.0.1, + semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers, + any.serialise ==0.2.6.1, + serialise +newtime15, + any.simple-sendfile ==0.2.32, + simple-sendfile +allow-bsd -fallback, + any.socks ==0.6.1, + any.split ==0.2.5, + any.splitmix ==0.1.0.5, + splitmix -optimised-mixer, + any.stm ==2.5.1.0, + any.streaming-commons ==0.2.2.6, + streaming-commons -use-bytestring-builder, + any.strict ==0.5.1, + any.tagged ==0.8.9, + tagged +deepseq +transformers, + any.tasty ==1.5.2, + tasty +unix, + any.template-haskell ==2.20.0.0, + any.temporary ==1.3, + any.text ==2.0.2, + any.text-iso8601 ==0.1.1, + any.text-short ==0.1.6, + text-short -asserts, + any.tf-random ==0.5, + any.th-abstraction ==0.7.1.0, + any.th-compat ==0.1.6, + any.these ==1.2.1, + any.time ==1.12.2, + any.time-compat ==1.9.7, + any.time-manager ==0.0.1, + any.tls ==2.1.5, + tls -devel, + any.tls-session-manager ==0.0.6, + any.transformers ==0.6.1.0, + any.transformers-base ==0.4.6, + transformers-base +orphaninstances, + any.transformers-compat ==0.7.2, + transformers-compat -five +five-three -four +generic-deriving +mtl -three -two, + any.typed-process ==0.2.12.0, + any.unix ==2.8.4.0, + any.unix-time ==0.4.16, + any.unliftio ==0.2.25.0, + any.unliftio-core ==0.2.1.0, + any.unordered-containers ==0.2.20, + unordered-containers -debug, + any.utf8-string ==1.0.2, + any.uuid-types ==1.0.6, + any.vault ==0.3.1.5, + vault +useghc, + any.vector ==0.13.2.0, + vector +boundschecks -internalchecks -unsafechecks -wall, + any.vector-algorithms ==0.9.0.3, + vector-algorithms +bench +boundschecks -internalchecks -llvm +properties -unsafechecks, + any.vector-stream ==0.1.0.1, + any.wai ==3.2.4, + any.wai-conduit ==3.0.0.4, + any.warp ==3.3.30, + warp +allow-sendfilefd -network-bytestring -warp-debug +x509, + any.warp-tls ==3.4.12, + any.witherable ==0.5, + any.word8 ==0.1.3, + any.zlib ==0.7.1.0, + zlib -bundled-c-zlib +non-blocking-ffi +pkg-config +index-state: hackage.haskell.org 2024-12-12T16:18:37Z diff --git a/http-client/Network/HTTP/Client.hs b/http-client/Network/HTTP/Client.hs index e6a3c7a5..4182ee58 100644 --- a/http-client/Network/HTTP/Client.hs +++ b/http-client/Network/HTTP/Client.hs @@ -323,14 +323,14 @@ managerSetProxy :: ProxyOverride -> ManagerSettings -> ManagerSettings managerSetProxy po = managerSetInsecureProxy po . managerSetSecureProxy po -- @since 0.7.17 -managerSetMaxHeaderLength :: Int -> ManagerSettings -> ManagerSettings +managerSetMaxHeaderLength :: Word -> ManagerSettings -> ManagerSettings managerSetMaxHeaderLength l manager = manager { managerMaxHeaderLength = MaxHeaderLength l } -- @since 0.7.18 -managerSetMaxNumberHeaders :: Int -> ManagerSettings -> ManagerSettings -managerSetMaxNumberHeaders l manager = manager - { managerMaxNumberHeaders = MaxNumberHeaders l } +managerSetMaxNumberHeaders :: Word -> ManagerSettings -> ManagerSettings +managerSetMaxNumberHeaders n manager = manager + { managerMaxNumberHeaders = MaxNumberHeaders n } -- $example1 -- = Example Usage diff --git a/http-client/Network/HTTP/Client/Connection.hs b/http-client/Network/HTTP/Client/Connection.hs index e846f3ee..99a3502e 100644 --- a/http-client/Network/HTTP/Client/Connection.hs +++ b/http-client/Network/HTTP/Client/Connection.hs @@ -50,12 +50,12 @@ connectionReadLineWith mhl conn bs0 = go bs front total = case S.break (== charLF) bs of (_, "") -> do - when (total >= unMaxHeaderLength mhl) $ do + when (total >= unMaxHeaderLength mhl && total /= 0) $ do -- We reached the maximum length for an header field. throwHttp OverlongHeaders bs' <- connectionRead conn when (S.null bs') $ throwHttp IncompleteHeaders - go bs' (front . (bs:)) (total + S.length bs) + go bs' (front . (bs:)) (total + fromIntegral (S.length bs)) (x, S.drop 1 -> y) -> do unless (S.null y) $! connectionUnread conn y return $! killCR $! S.concat $! front [x] diff --git a/http-client/Network/HTTP/Client/Headers.hs b/http-client/Network/HTTP/Client/Headers.hs index 7bb8012a..82badf87 100644 --- a/http-client/Network/HTTP/Client/Headers.hs +++ b/http-client/Network/HTTP/Client/Headers.hs @@ -91,13 +91,13 @@ parseStatusHeaders mhl mnh conn timeout' onEarlyHintHeaders cont Just (i, "") -> Just i _ -> Nothing - guardMaxNumberHeaders :: Int -> IO () + guardMaxNumberHeaders :: Word -> IO () guardMaxNumberHeaders count = - when (count >= unMaxNumberHeaders mnh) $ do + when (count >= unMaxNumberHeaders mnh && count /= 0) $ do -- We reached the maximum number of header fields. throwHttp OverlongHeaders - parseHeaders :: Int -> ([Header] -> [Header]) -> IO [Header] + parseHeaders :: Word -> ([Header] -> [Header]) -> IO [Header] parseHeaders count front = do guardMaxNumberHeaders count line <- connectionReadLine mhl conn @@ -112,7 +112,7 @@ parseStatusHeaders mhl mnh conn timeout' onEarlyHintHeaders cont -- an exception, ignore it for robustness. parseHeaders count front - parseEarlyHintHeadersUntilFailure :: Int -> ([Header] -> [Header]) -> IO [Header] + parseEarlyHintHeadersUntilFailure :: Word -> ([Header] -> [Header]) -> IO [Header] parseEarlyHintHeadersUntilFailure count front = do guardMaxNumberHeaders count line <- connectionReadLine mhl conn diff --git a/http-client/Network/HTTP/Client/Types.hs b/http-client/Network/HTTP/Client/Types.hs index 71077975..7b740a41 100644 --- a/http-client/Network/HTTP/Client/Types.hs +++ b/http-client/Network/HTTP/Client/Types.hs @@ -826,14 +826,14 @@ data ManagerSettings = ManagerSettings -- Since 0.4.7 , managerMaxHeaderLength :: MaxHeaderLength -- ^ Configure the maximum size, in bytes, of an HTTP header field. - -- Set it to a negative number to remove this limit (eg: for debugging purposes). + -- Set it to 0 to remove this limit (eg: for debugging purposes). -- -- Default: 4096 -- -- @since 0.7.17 , managerMaxNumberHeaders :: MaxNumberHeaders -- ^ Configure the maximum number of HTTP header fields. - -- Set it to a negative number to remove this limit (eg: for debugging purposes). + -- Set it to 0 to remove this limit (eg: for debugging purposes). -- -- Default: 100 -- @@ -922,20 +922,20 @@ data StreamFileStatus = StreamFileStatus -- -- @since 0.7.14 newtype MaxHeaderLength = MaxHeaderLength - { unMaxHeaderLength :: Int + { unMaxHeaderLength :: Word } deriving (Eq, Show, Ord, Num, T.Typeable) noMaxHeaderLength :: MaxHeaderLength -noMaxHeaderLength = - 1 +noMaxHeaderLength = 0 -- | The maximum number of header fields. -- -- @since 0.7.18 newtype MaxNumberHeaders = MaxNumberHeaders - { unMaxNumberHeaders :: Int + { unMaxNumberHeaders :: Word } deriving (Eq, Show, Ord, Num, T.Typeable) noMaxNumberHeaders :: MaxNumberHeaders -noMaxNumberHeaders = - 1 +noMaxNumberHeaders = 0