Skip to content

Commit

Permalink
Merge pull request #1091 from TristanCacqueray/http_proxy
Browse files Browse the repository at this point in the history
Add support for http proxy
  • Loading branch information
mergify[bot] authored Nov 28, 2023
2 parents b6f17ff + ce02661 commit e4cf794
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
All notable changes to this project will be documented in this file.
## [master]
### Added

- [crawler] Proxy can be configured with `http_proxy` and `https_proxy` environment.

### Changed
### Removed
### Fixed
Expand Down
7 changes: 6 additions & 1 deletion src/Monocle/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import Network.HTTP.Client (
requestHeaders,
responseBody,
)
import Network.HTTP.Client qualified
import Network.HTTP.Client.OpenSSL qualified as OpenSSL
import OpenSSL.Session (VerificationMode (VerifyNone))
import Proto3.Suite.JSONPB (FromJSONPB (..), ToJSONPB (..))
Expand Down Expand Up @@ -59,7 +60,11 @@ mkManager' verify = do
Verify -> OpenSSL.defaultOpenSSLSettings
tlsCiphers <- fromMaybe "DEFAULT" <$> lookupEnv "TLS_CIPHERS"
ctx <- OpenSSL.defaultMakeContext (opensslSettings {OpenSSL.osslSettingsCiphers = tlsCiphers})
newManager $ OpenSSL.opensslManagerSettings (pure ctx)
let settings = OpenSSL.opensslManagerSettings (pure ctx)

-- setup proxy
let proxy = Network.HTTP.Client.proxyEnvironment Nothing
newManager (Network.HTTP.Client.managerSetProxy proxy settings)

-- | Create the 'MonocleClient'
withClient ::
Expand Down

0 comments on commit e4cf794

Please sign in to comment.