Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for http proxy #1091

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading