hyperdrive-0.1: a fast, trustworthy HTTP(s) server built

Safe HaskellNone

Serve

Synopsis

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.

serveSource

Arguments

:: Int

port number to listen on

-> Handler IO

handler

-> IO () 

listen on a port and handle Requests

serveSocketSource

Arguments

:: Socket

socket to listen on

-> Handler IO

handler

-> IO () 

requestLoopSource

Arguments

:: 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

httpPipeSource

Arguments

:: Bool

is this an HTTPS connection

-> SockAddr 
-> Handler IO 
-> () 
-> StateP ByteString ProxyFast () ByteString () ByteString IO b 

and this is the real heart of things