Skip to content

Commit

Permalink
Support for http-proxy (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
junjihashimoto authored and aristidb committed Jun 19, 2017
1 parent 8c52a4c commit b4461f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Aws/Aws.hs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ data Configuration
, credentials :: Credentials
-- | The error / message logger.
, logger :: Logger
, proxy :: Maybe HTTP.Proxy
}

-- | The default configuration, with credentials loaded from environment variable or configuration file
Expand All @@ -95,6 +96,7 @@ baseConfiguration = liftIO $ do
timeInfo = Timestamp
, credentials = cr'
, logger = defaultLog Warning
, proxy = Nothing
}

-- | Debug configuration, which logs much more verbosely.
Expand Down Expand Up @@ -234,7 +236,9 @@ unsafeAwsRef cfg info manager metadataRef request = do
let !q = {-# SCC "unsafeAwsRef:signQuery" #-} signQuery request info sd
let logDebug = liftIO . logger cfg Debug . T.pack
logDebug $ "String to sign: " ++ show (sqStringToSign q)
!httpRequest <- {-# SCC "unsafeAwsRef:httpRequest" #-} liftIO $ queryToHttpRequest q
!httpRequest <- {-# SCC "unsafeAwsRef:httpRequest" #-} liftIO $ do
req <- queryToHttpRequest q
return $ req { HTTP.proxy = proxy cfg }
logDebug $ "Host: " ++ show (HTTP.host httpRequest)
logDebug $ "Path: " ++ show (HTTP.path httpRequest)
logDebug $ "Query string: " ++ show (HTTP.queryString httpRequest)
Expand Down

0 comments on commit b4461f8

Please sign in to comment.