haxy-1.0.1: A simple HTTP proxy server library

Safe HaskellNone
LanguageHaskell2010

Network.HTTP.Proxy.Server

Description

A library for programming custom proxy servers.

Synopsis

Documentation

proxyMain :: forall s. HStream s => Settings s -> IO () Source

Proxy entry-point. Spawns a new proxy server.

data Settings s Source

Proxy server settings

Constructors

Settings 

Fields

requestModifier :: Request s -> IO (Request s)

A function for modifying requests. Will be called for each request received; the modified request will be forwarded to the target server. Defaults to an identity function.

responseModifier :: Request s -> Response s -> IO (Response s)

A function for modifying responses. Will be called for each response received; the modified response will be forwarded to the client. Defaults to an identity function.

cache :: Cache s

The cache. Use def for no cache.

isAuthorized :: Request s -> IO Bool

Authorization function. Allows denying certain requests. Defaults to allowing all requests

logger :: Logger

A logging function. The default is stdLogger from http-server.

portnum :: Integer

Proxy server port number; default is 3128

hostname :: Maybe String

The server host name. Defaults to the result of getHostName

Instances

data Cache s Source

The cache.

Constructors

Cache 

Fields

queryCache :: Request s -> IO (Maybe (Response s))

Retreive the response to a request from the cache.

recordInCache :: Request s -> Response s -> IO ()

Record the response to a request in the cache.

Instances

class Default a where

A class for types with a default value.

Methods

def :: a

The default value for this type.

Instances