packages feed

HTTP 4000.2.19 → 4000.2.20

raw patch · 3 files changed

+40/−8 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

HTTP.cabal view
@@ -1,5 +1,5 @@ Name: HTTP-Version: 4000.2.19+Version: 4000.2.20 Cabal-Version: >= 1.8 Build-type: Simple License: BSD3
Network/HTTP/Proxy.hs view
@@ -25,10 +25,11 @@ #endif -} -import Control.Monad ( when, mplus, join, liftM2)+import Control.Monad ( when, mplus, join, liftM, liftM2)  #if defined(WIN32) import Network.HTTP.Base ( catchIO )+import Data.List ( isPrefixOf ) #endif import Network.HTTP.Utils ( dropWhileTail, chopAtDelim ) import Network.HTTP.Auth@@ -75,12 +76,14 @@ -- Consults environment variable, and in case of Windows, by querying -- the Registry (cf. @registryProxyString@.) proxyString :: IO (Maybe String)-proxyString = liftM2 mplus envProxyString registryProxyString+proxyString = liftM2 mplus envProxyString windowsProxyString -registryProxyString :: IO (Maybe String)+windowsProxyString :: IO (Maybe String) #if !defined(WIN32)-registryProxyString = return Nothing+windowsProxyString = return Nothing #else+windowsProxyString = liftM (>>= parseWindowsProxy) registryProxyString+ registryProxyLoc :: (HKEY,String) registryProxyLoc = (hive, path)   where@@ -94,6 +97,7 @@  -- read proxy settings from the windows registry; this is just a best -- effort and may not work on all setups. +registryProxyString :: IO (Maybe String) registryProxyString = catchIO   (bracket (uncurry regOpenKey registryProxyLoc) regCloseKey $ \hkey -> do     enable <- fmap toBool $ regQueryValueDWORD hkey "ProxyEnable"@@ -101,6 +105,34 @@         then fmap Just $ regQueryValue hkey (Just "ProxyServer")         else return Nothing)   (\_ -> return Nothing)++-- the proxy string is in the format "http=x.x.x.x:yyyy;https=...;ftp=...;socks=..."+-- even though the following article indicates otherwise+-- https://support.microsoft.com/en-us/kb/819961+--+-- to be sure, parse strings where each entry in the ';'-separated list above is+-- either in the format "protocol=..." or "protocol://..."+--+-- only return the first "http" of them, if it exists+parseWindowsProxy :: String -> Maybe String+parseWindowsProxy s =+  case proxies of+    x:_ -> Just x+    _   -> Nothing+  where+    parts = split ';' s+    pr x = case break (== '=') x of+      (p, []) -> p  -- might be in format http://+      (p, u)  -> p ++ "://" ++ drop 1 u++    proxies = filter (isPrefixOf "http://") . map pr $ parts++    split :: Eq a => a -> [a] -> [[a]]+    split _ [] = []+    split a xs = case break (a ==) xs of+      (ys, [])   -> [ys]+      (ys, _:zs) -> ys:split a zs+ #endif  -- | @fetchProxy flg@ gets the local proxy settings and parse the string@@ -115,7 +147,7 @@   case mstr of     Nothing     -> return NoProxy     Just str    -> case parseProxy str of-        Just p  -> return p                   +        Just p  -> return p         Nothing -> do             when warnIfIllformed $ System.IO.hPutStrLn System.IO.stderr $ unlines                     [ "invalid http proxy uri: " ++ show str
Network/TCP.hs view
@@ -10,8 +10,8 @@ -- Portability :  non-portable (not tested) -- -- Some utility functions for working with the Haskell @network@ package. Mostly--- for internal use by the @Network.HTTP@ code, but ---      +-- for internal use by the @Network.HTTP@ code.+-- ----------------------------------------------------------------------------- module Network.TCP    ( Connection