packages feed

http-client 0.4.14 → 0.4.15

raw patch · 3 files changed

+18/−5 lines, 3 files

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.4.15++* Support proxy authentication in environment variables [#129](https://github.com/snoyberg/http-client/issues/129)+ ## 0.4.14  * Ignore empty `http_proxy` [#128](https://github.com/snoyberg/http-client/pull/128)
Network/HTTP/Client/Manager.hs view
@@ -54,6 +54,7 @@ import Network.HTTP.Client.Types import Network.HTTP.Client.Connection import Network.HTTP.Client.Headers (parseStatusHeaders)+import Network.HTTP.Client.Request (username, password, applyBasicProxyAuth) import Control.Concurrent.MVar (MVar, takeMVar, tryPutMVar, newEmptyMVar) import System.Environment (getEnvironment) import qualified Network.URI as U@@ -490,7 +491,7 @@         Just ""  -> return noEnvProxy         Just str -> do             let invalid = throwIO $ InvalidProxyEnvironmentVariable name (T.pack str)-            p <- maybe invalid return $ do+            (p, muserpass) <- maybe invalid return $ do                 uri <- case U.parseURI str of                     Just u | U.uriScheme u == "http:" -> return u                     _ -> U.parseURI $ "http://" ++ str@@ -501,7 +502,13 @@                 guard $ null $ U.uriFragment uri                  auth <- U.uriAuthority uri-                guard $ null $ U.uriUserInfo auth+                let muserpass =+                        if null authInfo+                            then Nothing+                            else Just ( S8.pack $ username authInfo+                                      , S8.pack $ password authInfo+                                      )+                    authInfo = U.uriUserInfo auth                  port <-                     case U.uriPort auth of@@ -512,8 +519,10 @@                                 _ -> Nothing                         _ -> Nothing -                Just $ Proxy (S8.pack $ U.uriRegName auth) port-            return $ \req -> req { proxy = Just p }+                Just $ (Proxy (S8.pack $ U.uriRegName auth) port, muserpass)+            return $ \req ->+                maybe id (uncurry applyBasicProxyAuth) muserpass+                req { proxy = Just p }     where noEnvProxy = case eh of             EHFromRequest -> id             EHNoProxy     -> \req -> req { proxy = Nothing }
http-client.cabal view
@@ -1,5 +1,5 @@ name:                http-client-version:             0.4.14+version:             0.4.15 synopsis:            An HTTP client engine, intended as a base layer for more user-friendly packages. description:         Hackage documentation generation is not reliable. For up to date documentation, please see: <http://www.stackage.org/package/http-client>. homepage:            https://github.com/snoyberg/http-client