httpd-shed-0.4.0.3: A simple web-server with an interact style API

CopyrightAndy Gill
LicenseBSD3
MaintainerAndy Gill <andygill@ku.edu>
Stabilityunstable
PortabilityGHC
Safe HaskellNone
LanguageHaskell98

Network.Shed.Httpd

Description

A trivial web server.

This web server promotes a Request to IO Response function into a local web server. The user can decide how to interpret the requests, and the library is intended for implementing Ajax APIs.

initServerLazy (and assocated refactorings), and Chunking support was written by Henning Thielemann. Handling of POST-based payloads was been written by Brandon Moore. initServerBind support was written by John Van Enk.

Synopsis

Documentation

type Server = () Source

initServer Source

Arguments

:: Int

The port number

-> (Request -> IO Response)

The functionality of the Server

-> IO Server

A token for the Server

This server transfers documents as one parcel, using the content-length header.

initServerLazy Source

Arguments

:: Int

Chunk size

-> Int

The port number

-> (Request -> IO Response)

The functionality of the Server

-> IO Server

A token for the Server

This server transfers documents in chunked mode and without content-length header. This way you can ship infinitely big documents. It inserts the transfer encoding header for you.

initServerBind Source

Arguments

:: Int

The port number

-> HostAddress

The host address

-> (Request -> IO Response)

The functionality of the Server

-> IO Server

A token for the Server

This server transfers documents as one parcel, using the content-length header, and takes an additional

data Request Source

Constructors

Request 

Fields

reqMethod :: String
 
reqURI :: URI
 
reqHeaders :: [(String, String)]
 
reqBody :: String
 

Instances

data Response Source

Constructors

Response 

Fields

resCode :: Int
 
resHeaders :: [(String, String)]
 
resBody :: String
 

Instances

queryToArguments :: String -> [(String, String)] Source

Takes an escaped query, optionally starting with ?, and returns an unescaped index-value list.