Safe Haskell | None |
---|
- type Handler m = Request -> Pipe ProxyFast ByteString ByteString m (Response m)
- serve :: Int -> Handler IO -> IO ()
- serveSocket :: Socket -> Handler IO -> IO ()
- requestLoop :: Bool -> SockAddr -> (() -> Server ProxyFast () ByteString IO ()) -> (() -> Client ProxyFast () ByteString IO ()) -> Handler IO -> IO ()
- httpPipe :: Bool -> SockAddr -> Handler IO -> () -> StateP ByteString ProxyFast () ByteString () ByteString IO b
Documentation
type Handler m = Request -> Pipe ProxyFast ByteString ByteString m (Response m)Source
a Handler
essentially a Request
and returns a Response
The Pipe allows use to incrementally read ByteString
chuncks from
the Request body and incrementally write ByteString
chunks in the
Response
body.
listen on a port and handle Requests
:: Bool | is this an HTTPS connection |
-> SockAddr | ip of the client |
-> (() -> Server ProxyFast () ByteString IO ()) | Server to read data (Request) from |
-> (() -> Client ProxyFast () ByteString IO ()) | Client to write data (Response) to |
-> Handler IO | handler |
-> IO () |
this is where we construct the pipe that reads from the socket, processes the request, and sends the response
:: Bool | is this an HTTPS connection |
-> SockAddr | |
-> Handler IO | |
-> () | |
-> StateP ByteString ProxyFast () ByteString () ByteString IO b |
and this is the real heart of things