summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaelSnoyman <>2012-07-06 12:43:49 (GMT)
committerhdiff <hdiff@luite.com>2012-07-06 12:43:49 (GMT)
commitd6ce28f3dcdbee9699b23bab82158ea948cc0369 (patch)
treee2fa08051410f18666f03c3096a8332bd9068555
parent74faf07348875e85d1fa64cabc8e10e3f02f3fef (diff)
version 1.5.0.11.5.0.1
-rw-r--r--Network/HTTP/Conduit/Cookies.hs21
-rw-r--r--Network/HTTP/Conduit/Manager.hs13
-rw-r--r--Network/HTTP/Conduit/Request.hs8
-rw-r--r--http-conduit.cabal4
4 files changed, 22 insertions, 24 deletions
diff --git a/Network/HTTP/Conduit/Cookies.hs b/Network/HTTP/Conduit/Cookies.hs
index afc6aa6..5ef3519 100644
--- a/Network/HTTP/Conduit/Cookies.hs
+++ b/Network/HTTP/Conduit/Cookies.hs
@@ -1,7 +1,6 @@
-- | This module implements the algorithms described in RFC 6265 for the Network.HTTP.Conduit library.
module Network.HTTP.Conduit.Cookies where
-import qualified Network.HTTP.Types as W
import qualified Data.ByteString as BS
import qualified Data.ByteString.UTF8 as U
import Text.Regex
@@ -20,7 +19,7 @@ import qualified Network.HTTP.Conduit.Response as Res
slash :: Integral a => a
slash = 47 -- '/'
-isIpAddress :: W.Ascii -> Bool
+isIpAddress :: BS.ByteString -> Bool
isIpAddress a = case strs of
Just strs' -> helper strs'
Nothing -> False
@@ -32,7 +31,7 @@ isIpAddress a = case strs of
-- | This corresponds to the subcomponent algorithm entitled \"Domain Matching\" detailed
-- in section 5.1.3
-domainMatches :: W.Ascii -> W.Ascii -> Bool
+domainMatches :: BS.ByteString -> BS.ByteString -> Bool
domainMatches string domainString
| string == domainString = True
| BS.length string < BS.length domainString + 1 = False
@@ -42,7 +41,7 @@ domainMatches string domainString
-- | This corresponds to the subcomponent algorithm entitled \"Paths\" detailed
-- in section 5.1.4
-defaultPath :: Req.Request m -> W.Ascii
+defaultPath :: Req.Request m -> BS.ByteString
defaultPath req
| BS.null uri_path = U.fromString "/"
| BS.singleton (BS.head uri_path) /= U.fromString "/" = U.fromString "/"
@@ -52,7 +51,7 @@ defaultPath req
-- | This corresponds to the subcomponent algorithm entitled \"Path-Match\" detailed
-- in section 5.1.4
-pathMatches :: W.Ascii -> W.Ascii -> Bool
+pathMatches :: BS.ByteString -> BS.ByteString -> Bool
pathMatches requestPath cookiePath
| cookiePath == requestPath = True
| cookiePath `BS.isPrefixOf` requestPath && BS.singleton (BS.last cookiePath) == U.fromString "/" = True
@@ -62,11 +61,11 @@ pathMatches requestPath cookiePath
-- This corresponds to the description of a cookie detailed in Section 5.3 \"Storage Model\"
data Cookie = Cookie
- { cookie_name :: W.Ascii
- , cookie_value :: W.Ascii
+ { cookie_name :: BS.ByteString
+ , cookie_value :: BS.ByteString
, cookie_expiry_time :: UTCTime
- , cookie_domain :: W.Ascii
- , cookie_path :: W.Ascii
+ , cookie_domain :: BS.ByteString
+ , cookie_path :: BS.ByteString
, cookie_creation_time :: UTCTime
, cookie_last_access_time :: UTCTime
, cookie_persistent :: Bool
@@ -123,7 +122,7 @@ removeExistingCookieFromCookieJar cookie cookie_jar' = (mc, CJ lc)
rejectPublicSuffixes :: Bool
rejectPublicSuffixes = True
-isPublicSuffix :: W.Ascii -> Bool
+isPublicSuffix :: BS.ByteString -> Bool
isPublicSuffix _ = False
-- | This corresponds to the eviction algorithm described in Section 5.3 \"Storage Model\"
@@ -149,7 +148,7 @@ computeCookieString :: Req.Request m -- ^ Input request
-> CookieJar -- ^ Current cookie jar
-> UTCTime -- ^ Value that should be used as \"now\"
-> Bool -- ^ Whether or not this request is coming from an \"http\" source (not javascript or anything like that)
- -> (W.Ascii, CookieJar) -- ^ (Contents of a \"Cookie\" header, Updated cookie jar (last-access-time is updated))
+ -> (BS.ByteString, CookieJar) -- ^ (Contents of a \"Cookie\" header, Updated cookie jar (last-access-time is updated))
computeCookieString request cookie_jar now is_http_api = (output_line, cookie_jar')
where matching_cookie cookie = condition1 && condition2 && condition3 && condition4
where condition1
diff --git a/Network/HTTP/Conduit/Manager.hs b/Network/HTTP/Conduit/Manager.hs
index 8f29944..b36aad0 100644
--- a/Network/HTTP/Conduit/Manager.hs
+++ b/Network/HTTP/Conduit/Manager.hs
@@ -46,7 +46,6 @@ import Network (connectTo, PortID (PortNumber), HostName)
import Network.Socket (socketToHandle)
import Data.Certificate.X509 (X509, encodeCertificate)
-import qualified Network.HTTP.Types as W
import Network.TLS.Extra (certificateVerifyChain, certificateVerifyDomain)
import Network.HTTP.Conduit.ConnInfo
@@ -63,7 +62,7 @@ import System.IO (Handle)
data ManagerSettings = ManagerSettings
{ managerConnCount :: Int
-- ^ Number of connections to a single host to keep alive. Default: 10.
- , managerCheckCerts :: W.Ascii -> [X509] -> IO TLSCertificateUsage
+ , managerCheckCerts :: S8.ByteString -> [X509] -> IO TLSCertificateUsage
-- ^ Check if the server certificate is valid. Only relevant for HTTPS.
}
@@ -76,7 +75,7 @@ instance Default ManagerSettings where
}
-- | Check certificates using the operating system's certificate checker.
-defaultCheckCerts :: W.Ascii -> [X509] -> IO TLSCertificateUsage
+defaultCheckCerts :: S8.ByteString -> [X509] -> IO TLSCertificateUsage
defaultCheckCerts host' certs =
case certificateVerifyDomain (S8.unpack host') certs of
CertificateUsageAccept -> certificateVerifyChain certs
@@ -89,9 +88,9 @@ data Manager = Manager
-- ^ @Nothing@ indicates that the manager is closed.
, mMaxConns :: !Int
-- ^ This is a per-@ConnKey@ value.
- , mCheckCerts :: W.Ascii -> [X509] -> IO TLSCertificateUsage
+ , mCheckCerts :: S8.ByteString -> [X509] -> IO TLSCertificateUsage
-- ^ Check if a certificate is valid.
- , mCertCache :: !(I.IORef (Map.Map W.Ascii (Map.Map X509Encoded UTCTime)))
+ , mCertCache :: !(I.IORef (Map.Map S8.ByteString (Map.Map X509Encoded UTCTime)))
-- ^ Cache of validated certificates. The @UTCTime@ gives the expiration
-- time for the validity of the certificate. The @Ascii@ is the hostname.
}
@@ -149,7 +148,7 @@ newManager ms = do
-- | Collect and destroy any stale connections.
reap :: I.IORef (Maybe (Map.Map ConnKey (NonEmptyList ConnInfo)))
- -> I.IORef (Map.Map W.Ascii (Map.Map X509Encoded UTCTime))
+ -> I.IORef (Map.Map S8.ByteString (Map.Map X509Encoded UTCTime))
-> IO ()
reap mapRef certCacheRef =
mask_ loop
@@ -394,7 +393,7 @@ getConn req m =
(True, False) -> getSslConn $ checkCerts m h
(True, True) -> getSslProxyConn (checkCerts m h) h (port req)
-checkCerts :: Manager -> W.Ascii -> [X509] -> IO TLSCertificateUsage
+checkCerts :: Manager -> S8.ByteString -> [X509] -> IO TLSCertificateUsage
checkCerts man host' certs = do
#if DEBUG
putStrLn $ "checkCerts for host: " ++ show host'
diff --git a/Network/HTTP/Conduit/Request.hs b/Network/HTTP/Conduit/Request.hs
index 83ccfc4..1af7124 100644
--- a/Network/HTTP/Conduit/Request.hs
+++ b/Network/HTTP/Conduit/Request.hs
@@ -76,11 +76,11 @@ data Request m = Request
-- ^ HTTP request method, eg GET, POST.
, secure :: Bool
-- ^ Whether to use HTTPS (ie, SSL).
- , host :: W.Ascii
+ , host :: S.ByteString
, port :: Int
- , path :: W.Ascii
+ , path :: S.ByteString
-- ^ Everything from the host to the query string.
- , queryString :: W.Ascii
+ , queryString :: S.ByteString
, requestHeaders :: W.RequestHeaders
, requestBody :: RequestBody m
, proxy :: Maybe Proxy
@@ -122,7 +122,7 @@ data RequestBody m
-- | Define a HTTP proxy, consisting of a hostname and port number.
data Proxy = Proxy
- { proxyHost :: W.Ascii -- ^ The host name of the HTTP proxy.
+ { proxyHost :: S.ByteString -- ^ The host name of the HTTP proxy.
, proxyPort :: Int -- ^ The port number of the HTTP proxy.
}
diff --git a/http-conduit.cabal b/http-conduit.cabal
index 1109b00..e0f922a 100644
--- a/http-conduit.cabal
+++ b/http-conduit.cabal
@@ -1,5 +1,5 @@
name: http-conduit
-version: 1.5.0
+version: 1.5.0.1
license: BSD3
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@@ -30,7 +30,7 @@ library
, attoparsec >= 0.8.0.2 && < 0.11
, utf8-string >= 0.3.4 && < 0.4
, blaze-builder >= 0.2.1 && < 0.4
- , http-types >= 0.6 && < 0.7
+ , http-types >= 0.6 && < 0.8
, cprng-aes >= 0.2 && < 0.3
, tls >= 0.9.3 && < 0.10
, tls-extra >= 0.4.5 && < 0.5