http-enumerator 0.6.4.3 → 0.6.5
raw patch · 2 files changed
+19/−1 lines, 2 filesdep +base64-bytestringPVP ok
version bump matches the API change (PVP)
Dependencies added: base64-bytestring
API changes (from Hackage documentation)
+ Network.HTTP.Enumerator: applyBasicAuth :: ByteString -> ByteString -> Request m -> Request m
Files
- Network/HTTP/Enumerator.hs +17/−0
- http-enumerator.cabal +2/−1
Network/HTTP/Enumerator.hs view
@@ -69,6 +69,7 @@ , withManager -- * Utility functions , parseUrl+ , applyBasicAuth , semiParseUrl , lbsIter -- * Request bodies@@ -112,6 +113,7 @@ import Control.Applicative ((<$>)) import Data.Certificate.X509 (X509) import Network.TLS.Extra (certificateVerifyChain, certificateVerifyDomain)+import qualified Data.ByteString.Base64 as B64 getSocket :: String -> Int -> IO NS.Socket getSocket host' port' = do@@ -191,6 +193,21 @@ | RequestBodyBS S.ByteString | RequestBodyBuilder Int64 Blaze.Builder | RequestBodyEnum Int64 (Enumerator Blaze.Builder m ())+++-- | Add a Basic Auth header (with the specified user name and password) to the+-- given Request. Ignore error handling:+--+-- applyBasicAuth "user" "pass" $ fromJust $ HE.parseUrl url++applyBasicAuth :: S8.ByteString -> S8.ByteString -> Request m -> Request m+applyBasicAuth user passwd req =+ req { requestHeaders = authHeader : requestHeaders req }+ where+ authHeader = (CI.mk "Authorization", basic)+ basic = S8.append "Basic " (B64.encode $ S8.concat [ user, ":", passwd ])++ -- | A simple representation of the HTTP response created by 'lbsIter'. data Response = Response
http-enumerator.cabal view
@@ -1,5 +1,5 @@ name: http-enumerator-version: 0.6.4.3+version: 0.6.5 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -39,6 +39,7 @@ , containers >= 0.2 && < 0.5 , certificate >= 0.7 && < 0.10 , case-insensitive >= 0.2 && < 0.3+ , base64-bytestring >= 0.1 && < 0.2 if flag(network-bytestring) build-depends: network >= 2.2.1 && < 2.2.3 , network-bytestring >= 0.1.3 && < 0.1.4