1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
-- | HTTP\/2 server library.
--
-- Example:
--
-- > {-# LANGUAGE OverloadedStrings #-}
-- > module Main (main) where
-- >
-- > import qualified Control.Exception as E
-- > import Data.ByteString.Builder (byteString)
-- > import Network.HTTP.Types (ok200)
-- > import Network.Run.TCP (runTCPServer) -- network-run
-- >
-- > import Network.HTTP2.Server
-- >
-- > main :: IO ()
-- > main = runTCPServer Nothing "80" runHTTP2Server
-- > where
-- > runHTTP2Server s = E.bracket (allocSimpleConfig s 4096)
-- > freeSimpleConfig
-- > (\config -> run defaultServerConfig config server)
-- > server _req _aux sendResponse = sendResponse response []
-- > where
-- > response = responseBuilder ok200 header body
-- > header = [("Content-Type", "text/plain")]
-- > body = byteString "Hello, world!\n"
module Network.HTTP2.Server (
-- * Runner
run,
-- * Server configuration
ServerConfig,
defaultServerConfig,
numberOfWorkers,
connectionWindowSize,
settings,
-- * HTTP\/2 setting
Settings,
defaultSettings,
headerTableSize,
enablePush,
maxConcurrentStreams,
initialWindowSize,
maxFrameSize,
maxHeaderListSize,
-- ** Rate limits
pingRateLimit,
settingsRateLimit,
emptyFrameRateLimit,
rstRateLimit,
-- * Common configuration
Config (..),
allocSimpleConfig,
allocSimpleConfig',
freeSimpleConfig,
module Network.HTTP.Semantics.Server,
) where
import Network.HTTP.Semantics.Server
import Network.HTTP2.H2
import Network.HTTP2.Server.Run (
ServerConfig (..),
defaultServerConfig,
run,
)
|