-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | a fast, trustworthy HTTP(s) server built
--
-- hyperdrive aims to provide an HTTP server which is not only extremely
-- fast, but also provides a high-level of proof that its implementation
-- is correct.
--
-- hyperdrive is still in alpha and not at all suitable for use. The
-- current implementation is relatively fast, but does not yet use any of
-- the techniques for proof-of-correctness. It also does not implement
-- many essential features yet.
@package hyperdrive
@version 0.1
module Types
data HTTPVersion
HTTP10 :: HTTPVersion
HTTP11 :: HTTPVersion
ppHTTPVersion :: HTTPVersion -> Doc
data Method
OPTIONS :: Method
GET :: Method
GETONLY :: Method
HEAD :: Method
POST :: Method
PUT :: Method
DELETE :: Method
TRACE :: Method
CONNECT :: Method
EXTENSION :: ByteString -> Method
ppMethod :: Method -> Doc
type MessageBody = ByteString
data Request
Request :: !Method -> !ByteString -> !HTTPVersion -> ![(ByteString, ByteString)] -> !Bool -> !SockAddr -> Request
rqMethod :: Request -> !Method
rqURIbs :: Request -> !ByteString
rqHTTPVersion :: Request -> !HTTPVersion
rqHeaders :: Request -> ![(ByteString, ByteString)]
rqSecure :: Request -> !Bool
rqClient :: Request -> !SockAddr
ppRequest :: Request -> Doc
ppHeader :: (ByteString, ByteString) -> Doc
data Response m
Response :: {-# UNPACK #-} !Int -> [(ByteString, ByteString)] -> Pipe ProxyFast ByteString MessageBody m () -> Response m
rsCode :: Response m -> {-# UNPACK #-} !Int
rsHeaders :: Response m -> [(ByteString, ByteString)]
rsBody :: Response m -> Pipe ProxyFast ByteString MessageBody m ()
ppResponse :: Response m -> Doc
bytestring :: ByteString -> Doc
field :: String -> Doc -> Doc
instance Typeable HTTPVersion
instance Typeable Method
instance Typeable Request
instance Eq HTTPVersion
instance Ord HTTPVersion
instance Read HTTPVersion
instance Show HTTPVersion
instance Data HTTPVersion
instance Eq Method
instance Ord Method
instance Read Method
instance Show Method
instance Data Method
instance Show (Response m)
instance Show Request
module Response
responseWriter :: Monad m => Response m -> Pipe ProxyFast ByteString ByteString m ()
statusLine :: Int -> ByteString
ok_status :: ByteString
not_found_status :: ByteString
renderHeaders :: [(ByteString, ByteString)] -> ByteString
renderHeader :: (ByteString, ByteString) -> ByteString
module Request
colon :: Word8
space :: Word8
nl :: Word8
cr :: Word8
data ParseError
Unexpected :: ParseError
MalformedRequestLine :: ByteString -> ParseError
MalformedHeader :: ByteString -> ParseError
UnknownHTTPVersion :: ByteString -> ParseError
parseRequest :: (Proxy p, Monad m) => Bool -> SockAddr -> StateP ByteString p () ByteString a b m Request
-- | currently if you consume the entire request body this will terminate
-- and return the ret value that you supplied. But, that seems
-- wrong, because that will tear down the whole pipeline and return that
-- value instead of what you really wanted to return.
--
-- Perhaps this should return a 'Maybe ByteString' instead so you can
-- detect when the body ends? But that interfers with using
-- parseRequest in httpPipe. For now we will just return
-- empty forever when you get to the end.
--
-- Perhaps pipes 2.5 will provide a better solution as it is supposed to
-- allow you to catch termination of the upstream pipe.
pipeBody :: (Proxy p, Monad m) => Request -> () -> StateP ByteString p () ByteString a ByteString m r
parseRequestLine :: ByteString -> (Method, ByteString, HTTPVersion)
parseMethod :: ByteString -> Method
parseHTTPVersion :: ByteString -> HTTPVersion
parseHeaders :: (Proxy p, Monad m) => StateP ByteString p () ByteString a b m [(ByteString, ByteString)]
parseHeader :: ByteString -> (ByteString, ByteString)
parseToken :: ByteString -> (ByteString, ByteString)
-- | find a line terminated by a '\r\n'
takeLine :: (Proxy p, Monad m) => StateP ByteString p () ByteString a b m ByteString
instance Typeable ParseError
instance Show ParseError
instance Eq ParseError
instance Exception ParseError
module Network
-- | start TCP listening on a port
listenOn :: Int -> IO Socket
-- | Stream data from the socket.
--
-- FIXME: what should happen if recv raises an exception?
socketReader :: (Proxy p, MonadIO m) => Socket -> (() -> Producer p ByteString m ())
-- | Stream data to the socket.
--
-- FIXME: what should happen if sendAll raises an exception?
socketWriter :: (Proxy p, MonadIO m) => Socket -> (() -> Consumer p ByteString m ())
module Serve
-- | 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.
type Handler m = Request -> Pipe ProxyFast ByteString ByteString m (Response m)
-- | listen on a port and handle Requests
serve :: Int -> Handler IO -> IO ()
serveSocket :: Socket -> Handler IO -> IO ()
-- | this is where we construct the pipe that reads from the socket,
-- processes the request, and sends the response
requestLoop :: Bool -> SockAddr -> (() -> Server ProxyFast () ByteString IO ()) -> (() -> Client ProxyFast () ByteString IO ()) -> Handler IO -> IO ()
-- | and this is the real heart of things
httpPipe :: Bool -> SockAddr -> Handler IO -> () -> StateP ByteString ProxyFast () ByteString () ByteString IO b