hxt-http 9.0.0 → 9.1.0
raw patch · 3 files changed
+27/−21 lines, 3 filesdep ~hxtPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: hxt
API changes (from Hackage documentation)
Files
- hxt-http.cabal +8/−7
- src/Text/XML/HXT/Arrow/LibHTTPInput.hs +7/−4
- src/Text/XML/HXT/IO/GetHTTPNative.hs +12/−10
hxt-http.cabal view
@@ -1,6 +1,6 @@ -- arch-tag: Haskell XML Toolbox main description file Name: hxt-http-Version: 9.0.0+Version: 9.1.0 Synopsis: Interface to native Haskell HTTP package HTTP Description: Interface to native Haskell HTTP package HTTP. This package can be used as alternative for the hxt-curl package@@ -27,13 +27,14 @@ hs-source-dirs: src ghc-options: -Wall+ ghc-prof-options: -auto-all -caf-all extensions: - build-depends: base >= 4 && < 5,- haskell98 >= 1 && < 2,- parsec >= 2.1 && < 4,- bytestring >= 0.9 && < 1,- network >= 2.1 && < 3,+ build-depends: base >= 4 && < 5,+ haskell98 >= 1 && < 2,+ parsec >= 2.1 && < 4,+ bytestring >= 0.9 && < 1,+ network >= 2.1 && < 3, HTTP >= 4000 && < 5000,- hxt >= 9 && < 10+ hxt >= 9.1 && < 10
src/Text/XML/HXT/Arrow/LibHTTPInput.hs view
@@ -26,6 +26,9 @@ import Control.Arrow.ArrowTree import Control.Arrow.ArrowIO +import qualified Data.ByteString.Lazy as B+-- import qualified Data.ByteString.Lazy.Char8 as C+ import System.Console.GetOpt import Text.XML.HXT.Arrow.DocumentInput ( addInputError )@@ -64,11 +67,11 @@ ) ) -addContent :: (Attributes, String) -> IOSArrow XmlTree XmlTree-addContent (al, c)- = replaceChildren (txt c) -- add the contents+addContent :: (Attributes, B.ByteString) -> IOSArrow XmlTree XmlTree+addContent (al, bc)+ = replaceChildren (blb bc) -- add the contents >>>- seqA (map (uncurry addAttr) al) -- add the meta info (HTTP headers, ...)+ seqA (map (uncurry addAttr) al) -- add the meta info (HTTP headers, ...) -- ------------------------------------------------------------
src/Text/XML/HXT/IO/GetHTTPNative.hs view
@@ -34,6 +34,8 @@ import Text.ParserCombinators.Parsec ( parse ) +import qualified Data.ByteString.Lazy as B+ import Data.Char ( isDigit ) import Data.Maybe ( fromJust@@ -47,7 +49,7 @@ import Network.Browser ( Proxy(..) , BrowserAction , browse- , defaultGETRequest+ , defaultGETRequest_ , request , setOutHandler , setErrHandler@@ -77,8 +79,8 @@ -- the http protocol handler, haskell implementation getCont :: Bool -> String -> String -> Bool -> Attributes ->- IO (Either ([(String, String)], String)- ([(String, String)], String)+ IO (Either ([(String, String)], String)+ ([(String, String)], B.ByteString) ) getCont strictInput proxy uri redirect options = do@@ -102,8 +104,8 @@ processResponse response | rc >= 200 && rc < 300 = if strictInput- then length cs `seq` return res- else return res+ then B.length cs `seq` return res+ else return res | otherwise = return $@@ -126,7 +128,7 @@ rsh = convertResponseHeaders response cs = rspBody response - getHttp :: Bool -> URI -> String -> Bool -> Attributes -> IO (Response String)+ getHttp :: Bool -> URI -> String -> Bool -> Attributes -> IO (Response B.ByteString) getHttp trc' uri' proxy' redirect' options' = withSocketsDo $ browse ( do@@ -135,11 +137,11 @@ return rsp ) where- theRequest :: Request String+ theRequest :: Request B.ByteString theRequest- = configHeaders $ defaultGETRequest uri' + = configHeaders $ defaultGETRequest_ uri' - configHeaders :: Request String -> Request String+ configHeaders :: Request B.ByteString -> Request B.ByteString configHeaders = foldr (>>>) id . map (uncurry replaceHeader) . concatMap (uncurry setHOption) $ options @@ -163,7 +165,7 @@ convertResponseStatus (a, b, c) = 100 * a + 10 * b + c - convertResponseHeaders :: Response String -> [(String, String)]+ convertResponseHeaders :: Response B.ByteString -> [(String, String)] convertResponseHeaders r' = cvResponseCode (rspCode r') ++