Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains a simple HTTP and HTTPS proxy. In the most basic setup, the caller specifies a port and runs it as follows:
-- Run a HTTPS and HTTPS proxy on port 3128. import Network.HTTP.Proxy main :: IO () main = runProxy 3128
- type Port = Int
- data Request = Request {}
- data Settings = Settings {
- proxyPort :: Int
- proxyHost :: HostPreference
- proxyOnException :: SomeException -> Response
- proxyTimeout :: Int
- proxyRequestModifier :: Request -> IO (Either Response Request)
- proxyLogger :: ByteString -> IO ()
- proxyUpstream :: Maybe UpstreamProxy
- data UpstreamProxy = UpstreamProxy {}
- httpProxyApp :: Settings -> Manager -> Application
- warpSettings :: Settings -> Settings
- runProxy :: Port -> IO ()
- runProxySettings :: Settings -> IO ()
- runProxySettingsSocket :: Settings -> Socket -> IO ()
- defaultProxySettings :: Settings
Documentation
Request | |
|
Various proxy server settings. This is purposely kept as an abstract data
type so that new settings can be added without breaking backwards
compatibility. In order to create a Settings
value, use defaultProxySettings
and record syntax to modify individual records. For example:
defaultProxySettings { proxyPort = 3128 }
Settings | |
|
data UpstreamProxy Source #
A http-proxy can be configured to use and upstream proxy by providing the proxy name, the port it listens to and an option username and password for proxy authorisation.
UpstreamProxy | |
|
httpProxyApp :: Settings -> Manager -> Application Source #
warpSettings :: Settings -> Settings Source #
runProxy :: Port -> IO () Source #
Run a HTTP and HTTPS proxy server on the specified port. This calls
runProxySettings
with defaultProxySettings
.
runProxySettings :: Settings -> IO () Source #
Run a HTTP and HTTPS proxy server with the specified settings.
defaultProxySettings :: Settings Source #
The default settings for the Proxy server. See the individual settings for the default value.