-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | HTTP/1.0, HTTP/1.1 and HTTP/2 are supported. For HTTP/2, Warp supports
--   direct and ALPN (in TLS) but not upgrade. API docs and the README are
--   available at <a>https://www.stackage.org/package/warp</a>.
@package warp
@version 3.4.21


-- | <b>IMPORTANT NOTICE</b>
--   
--   This module exports internals mainly to provide the <tt>warp-tls</tt>
--   package with tools to implement what it needs to. This module/API
--   should <i>NOT</i> be expected to remain stable at all, even between
--   minor releases.
--   
--   If you see a use case for these functions or types for other purposes,
--   please create an issue in the repository so that we might add it to
--   the main <a>Warp</a> API.
module Network.Wai.Handler.Warp.Internal

-- | Various Warp server settings. This is purposely kept as an abstract
--   data type so that new settings can be added without breaking backwards
--   compatibility. In order to create a <a>Settings</a> value, use
--   <a>defaultSettings</a> and the various 'set' functions to modify
--   individual fields. For example:
--   
--   <pre>
--   setTimeout 20 defaultSettings
--   </pre>
data Settings
Settings :: Port -> HostPreference -> (Maybe Request -> SomeException -> IO ()) -> Maybe (SockAddr -> SomeException -> IO ()) -> (SomeException -> Response) -> (SockAddr -> IO Bool) -> (SockAddr -> IO ()) -> Int -> Maybe Manager -> Int -> Int -> IO () -> (((forall a. () => IO a -> IO a) -> IO ()) -> IO ()) -> (Socket -> IO (Socket, SockAddr)) -> Bool -> (IO () -> IO ()) -> ByteString -> Maybe Int -> ProxyProtocol -> Int -> Bool -> (Request -> Status -> Maybe Integer -> IO ()) -> (Request -> ByteString -> Integer -> IO ()) -> Maybe Int -> Int -> Int -> Int -> Maybe ByteString -> Int -> Maybe Counter -> Maybe ServerState -> Bool -> Settings

-- | Port to listen on. Default value: 3000
[settingsPort] :: Settings -> Port

-- | Default value: HostIPv4
[settingsHost] :: Settings -> HostPreference

-- | What to do with exceptions thrown by either the application or server.
--   Default: ignore server-generated exceptions (see
--   <a>InvalidRequest</a>) and print application-generated applications to
--   stderr.
[settingsOnException] :: Settings -> Maybe Request -> SomeException -> IO ()

-- | Optional observer for exceptions escaping a connection worker. Nothing
--   delegates to settingsOnException with no request, preserving its
--   defaults.
[settingsOnConnectionException] :: Settings -> Maybe (SockAddr -> SomeException -> IO ())

-- | A function to create <a>Response</a> when an exception occurs.
--   
--   Default: 500, text/plain, "Something went wrong"
[settingsOnExceptionResponse] :: Settings -> SomeException -> Response

-- | What to do when a connection is open. When <a>False</a> is returned,
--   the connection is closed immediately. Otherwise, the connection is
--   going on. Default: always returns <a>True</a>.
[settingsOnOpen] :: Settings -> SockAddr -> IO Bool

-- | What to do when a connection is close. Default: do nothing.
[settingsOnClose] :: Settings -> SockAddr -> IO ()

-- | Timeout value in seconds. Default value: 30
[settingsTimeout] :: Settings -> Int

-- | Use an existing timeout manager instead of spawning a new one. If
--   used, <a>settingsTimeout</a> is ignored. Default is <a>Nothing</a>
[settingsManager] :: Settings -> Maybe Manager

-- | Cache duration time of file descriptors in seconds. 0 means that the
--   cache mechanism is not used. Default value: 0
[settingsFdCacheDuration] :: Settings -> Int

-- | Cache duration time of file information in seconds. 0 means that the
--   cache mechanism is not used. Default value: 0
[settingsFileInfoCacheDuration] :: Settings -> Int

-- | Code to run after the listening socket is ready but before entering
--   the main event loop. Useful for signaling to tests that they can start
--   running, or to drop permissions after binding to a restricted port.
--   
--   Default: do nothing.
[settingsBeforeMainLoop] :: Settings -> IO ()

-- | Code to fork a new thread to accept a connection.
--   
--   This may be useful if you need OS bound threads, or if you wish to
--   develop an alternative threading model.
--   
--   Default: <a>defaultFork</a>
[settingsFork] :: Settings -> ((forall a. () => IO a -> IO a) -> IO ()) -> IO ()

-- | Code to accept a new connection.
--   
--   Useful if you need to provide connected sockets from something other
--   than a standard accept call.
--   
--   Default: <a>defaultAccept</a>
[settingsAccept] :: Settings -> Socket -> IO (Socket, SockAddr)

-- | Perform no parsing on the rawPathInfo.
--   
--   This is useful for writing HTTP proxies.
--   
--   Default: False
[settingsNoParsePath] :: Settings -> Bool

-- | An action to install a handler (e.g. Unix signal handler) to close a
--   listen socket. The first argument is an action to close the listen
--   socket.
--   
--   Default: no action
[settingsInstallShutdownHandler] :: Settings -> IO () -> IO ()

-- | Default server name if application does not set one.
[settingsServerName] :: Settings -> ByteString

-- | See <tt>setMaximumBodyFlush</tt>.
[settingsMaximumBodyFlush] :: Settings -> Maybe Int

-- | Specify usage of the PROXY protocol.
[settingsProxyProtocol] :: Settings -> ProxyProtocol

-- | Size of bytes read to prevent Slowloris protection. Default value:
--   2048
[settingsSlowlorisSize] :: Settings -> Int

-- | Whether to enable HTTP2 ALPN/upgrades. Default: True
[settingsHTTP2Enabled] :: Settings -> Bool

-- | A log function. Default: no action.
--   
--   <pre>
--   settingsLogger req status mSentBytes
--   </pre>
--   
--   <i>N.B. <tt>Maybe Integer</tt> is the concrete bytes of the message
--   body</i> <i>after all the headers have been sent. This is
--   <a>Nothing</a> when</i> <i><a>responseRaw</a> is used. (e.g. when
--   using websockets)</i>
[settingsLogger] :: Settings -> Request -> Status -> Maybe Integer -> IO ()

-- | A HTTP/2 server push log function. Default: no action.
[settingsServerPushLogger] :: Settings -> Request -> ByteString -> Integer -> IO ()

-- | An optional timeout to limit the time (in seconds) waiting for a
--   graceful shutdown of the web server.
[settingsGracefulShutdownTimeout] :: Settings -> Maybe Int

-- | A timeout to limit the time (in milliseconds) waiting for FIN for
--   HTTP/1.x. 0 means uses immediate close. Default: 0.
[settingsGracefulCloseTimeout1] :: Settings -> Int

-- | A timeout to limit the time (in milliseconds) waiting for FIN for
--   HTTP/2. 0 means uses immediate close. Default: 2000.
[settingsGracefulCloseTimeout2] :: Settings -> Int

-- | Determines the maximum header size that Warp will tolerate when using
--   HTTP/1.x.
[settingsMaxTotalHeaderLength] :: Settings -> Int

-- | Specify the header value of Alternative Services (AltSvc:).
--   
--   Default: Nothing
[settingsAltSvc] :: Settings -> Maybe ByteString

-- | Determines the maxium buffer size when sending <tt>Builder</tt>
--   responses (See <a>responseBuilder</a>).
--   
--   When sending a builder response warp uses a 16 KiB buffer to write the
--   builder to. When that buffer is too small to fit the builder warp will
--   free it and create a new one that will fit the builder.
--   
--   To protect against allocating too large a buffer warp will error if
--   the builder requires more than this maximum.
--   
--   Default: 1049_000_000 = 1 MiB.
[settingsMaxBuilderResponseBufferSize] :: Settings -> Int

-- | A counter for tracking open connections. Use
--   <a>makeSettingsAndCounter</a> to create settings with a counter, then
--   use <a>getCount</a> on the returned <a>Counter</a> to read the current
--   value.
--   
--   Default: <a>Nothing</a> (warp creates an internal counter)
--   
--   <i>DEPRECATED in favor of <a>settingsServerState</a></i>
[settingsConnectionCounter] :: Settings -> Maybe Counter

-- | Internal read-only server state. Use <a>makeSettingsAndServerState</a>
--   to gain access to the state of the server. Using functions like
--   <a>currentOpenConnections</a> or <a>currentShuttingDownState</a> to
--   gain insight into the current state of the server.
--   
--   Default: <a>Nothing</a> (warp creates its own internal state)
[settingsServerState] :: Settings -> Maybe ServerState

-- | Whether to close connections with network's <tt>unsafeClose</tt> and
--   <tt>unsafeGracefulClose</tt>, which skip the IO manager. Use this only
--   if no thread uses a connection's socket after warp closes it, which
--   <a>responseRaw</a> applications cannot always promise.
--   
--   Default: <a>False</a>.
[settingsUnsafeClose] :: Settings -> Bool

-- | Specify usage of the PROXY protocol.
data ProxyProtocol

-- | See <tt>setProxyProtocolNone</tt>.
ProxyProtocolNone :: ProxyProtocol

-- | See <tt>setProxyProtocolRequired</tt>.
ProxyProtocolRequired :: ProxyProtocol

-- | See <tt>setProxyProtocolOptional</tt>.
ProxyProtocolOptional :: ProxyProtocol

-- | Create <a>defaultSettings</a> with a connection counter. Use
--   <a>getCount</a> on the returned <a>Counter</a> to check open
--   connections.
--   
--   <i>DEPRECATED in favor of <a>makeSettingsAndServerState</a></i>
makeSettingsAndCounter :: IO (Counter, Settings)

-- | Create <a>defaultSettings</a> with a <a>ServerState</a>. Use functions
--   like <a>currentOpenConnections</a> and <a>currentShuttingDownState</a>
--   to gain insight into the state of the server.
makeSettingsAndServerState :: IO (ServerState, Settings)

-- | The connections of a server: how many there are, and which threads are
--   serving them.
--   
--   Both come from the <a>ThreadManager</a>, which counts a connection
--   from when the accept loop keeps a place for it -- before the thread
--   that will serve it has been scheduled, which is too late for a
--   graceful shutdown to notice it.
data Counter

-- | Get the current count of open connections.
getCount :: Counter -> IO Int

-- | Internal read-only state of the server
data ServerState

-- | Takes <a>Settings</a> and either returns the <a>ServerState</a> that
--   was already in there, or creates a new <a>ServerState</a>.
--   
--   The returned <a>Settings</a> will always contain a <a>ServerState</a>.
--   
--   This makes it idempotent if care is taken that the
--   <tt>oldSettings</tt> are not used after using this function.
makeServerState :: Settings -> IO (ServerState, Settings)

-- | The connection setup action would be expensive. A good example is
--   initialization of TLS. So, this converts the connection setup action
--   to the connection maker which will be executed after forking a new
--   worker thread. Then this calls <a>runSettingsConnectionMaker</a> with
--   the connection maker. This allows the expensive computations to be
--   performed in a separate worker thread instead of the main server loop.
runSettingsConnection :: Settings -> IO (Connection, SockAddr) -> Application -> IO ()

-- | This modifies the connection maker so that it returns <a>TCP</a> for
--   <a>Transport</a> (i.e. plain HTTP) then calls
--   <a>runSettingsConnectionMakerSecure</a>.
runSettingsConnectionMaker :: Settings -> IO (IO Connection, SockAddr) -> Application -> IO ()

-- | The core run function which takes <a>Settings</a>, a connection maker
--   and <a>Application</a>. The connection maker can return a connection
--   of either plain HTTP or HTTP over TLS.
runSettingsConnectionMakerSecure :: Settings -> IO (IO (Connection, Transport), SockAddr) -> Application -> IO ()

-- | <a>runSettingsConnectionMakerSecure</a> for a caller that has the
--   listening socket, and so can say how the accept loop waits on it and
--   what becomes of it when the loop stops.
runSettingsConnectionMakerSecureWith :: Settings -> Listener -> IO (IO (Connection, Transport), SockAddr) -> Application -> IO ()

-- | What kind of transport is used for this connection?
data Transport

-- | Plain channel: TCP
TCP :: Transport
TLS :: Int -> Int -> Maybe ByteString -> Word16 -> Maybe CertificateChain -> Transport
[tlsMajorVersion] :: Transport -> Int
[tlsMinorVersion] :: Transport -> Int

-- | The result of Application Layer Protocol Negociation in RFC 7301
[tlsNegotiatedProtocol] :: Transport -> Maybe ByteString

-- | Encrypted channel: TLS or SSL
[tlsChiperID] :: Transport -> Word16
[tlsClientCertificate] :: Transport -> Maybe CertificateChain
QUIC :: Maybe ByteString -> Word16 -> Maybe CertificateChain -> Transport
[quicNegotiatedProtocol] :: Transport -> Maybe ByteString
[quicChiperID] :: Transport -> Word16
[quicClientCertificate] :: Transport -> Maybe CertificateChain

-- | What the accept loop waits on at the top of each turn, and what it
--   leaves behind when it stops.
--   
--   A server used to be stopped by closing the listening socket under the
--   thread waiting in <tt>accept</tt> on it. That takes an IO manager that
--   can wake a thread out of a wait by closing the file descriptor under
--   it, which is what <a>closeFdWith</a> is for, and the IO manager that
--   provides it is not the only one there will be. So the loop waits for
--   the socket and for the shutdown at once and ends on whichever comes
--   first; the socket is closed after it, by which time nothing is waiting
--   on it.
data Listener
Listener :: IO (Maybe (Socket, SockAddr)) -> IO () -> Listener

-- | Accepts a connection. <a>Nothing</a> instead once the server has been
--   asked to stop: giving up has to be composed with the accept itself, so
--   the accept belongs here rather than beside it.
[acceptOrStop] :: Listener -> IO (Maybe (Socket, SockAddr))

-- | Run once the accept loop has ended and before the connections are
--   waited for: the port is a successor's to take, and a successor should
--   not have to wait out someone else's drain for it.
[closeListener] :: Listener -> IO ()

-- | For a caller that handed warp a connection maker and no socket. There
--   is nothing here to accept and nothing to close, and such a server ends
--   the way it always did: by whatever its maker accepts on being closed.
noListener :: Listener
makeListener :: Settings -> Socket -> IO Listener

-- | Thrown by a connection maker which was told to stop rather than handed
--   a connection, and caught by the accept loop. A maker has to return a
--   connection or throw, so this is how it says that there will not be
--   one.
data AcceptStopped
AcceptStopped :: AcceptStopped

-- | Data type to manipulate IO actions for connections. This is used to
--   abstract IO actions for plain HTTP and HTTP over TLS.
data Connection
Connection :: ([ByteString] -> IO ()) -> (ByteString -> IO ()) -> SendFile -> IO () -> Recv -> RecvBuf -> IORef WriteBuffer -> IORef Bool -> SockAddr -> TVar Int -> Connection

-- | This is not used at this moment.
[connSendMany] :: Connection -> [ByteString] -> IO ()

-- | The sending function.
[connSendAll] :: Connection -> ByteString -> IO ()

-- | The sending function for files in HTTP/1.1.
[connSendFile] :: Connection -> SendFile

-- | The connection closing function. Warp guarantees it will only be
--   called once. Other functions (like <a>connRecv</a>) may be called
--   after <a>connClose</a> is called.
[connClose] :: Connection -> IO ()

-- | The connection receiving function. This returns "" for EOF or
--   exceptions.
[connRecv] :: Connection -> Recv

-- | Obsoleted.
[connRecvBuf] :: Connection -> RecvBuf

-- | Reference to a write buffer. When during sending of a <tt>Builder</tt>
--   response it's detected the current <a>WriteBuffer</a> is too small it
--   will be freed and a new bigger buffer will be created and written to
--   this reference.
[connWriteBuffer] :: Connection -> IORef WriteBuffer

-- | Is this connection HTTP/2?
[connHTTP2] :: Connection -> IORef Bool
[connMySockAddr] :: Connection -> SockAddr

-- | Amount of apps currently in progress on this connection.
--   
--   <i>HTTP2 can handle more than one request concurrently</i>
[connAppsInProgress] :: Connection -> TVar Int

-- | Creating <a>Connection</a> for plain HTTP based on a given socket.
--   
--   (N.B. make sure the <a>Settings</a> have an initialized
--   <a>ServerState</a> to guarantee a graceful shutdown)
socketConnection :: Settings -> Socket -> IO Connection
type Recv = IO ByteString

-- | Create a <a>Recv</a> which stops receiving when the server is shutting
--   down and no <a>Application</a> is still using this <a>Socket</a>.
--   
--   Nothing is closed and no thread is interrupted to make it return: the
--   read and the shutdown are waited for at once, inside
--   <a>receiveWith</a>.
makeGracefulRecv :: Socket -> BufferPool -> ServerState -> TVar Int -> Recv
type RecvBuf = Buffer -> BufSize -> IO Bool
type Buffer = Ptr Word8
type BufSize = Int

-- | A write buffer of a specified size containing bytes and a way to free
--   the buffer.
data WriteBuffer
WriteBuffer :: Buffer -> BufSize -> IO () -> WriteBuffer
[bufBuffer] :: WriteBuffer -> Buffer

-- | The size of the write buffer.
[bufSize] :: WriteBuffer -> BufSize

-- | Free the allocated buffer. Warp guarantees it will only be called
--   once, and no other functions will be called after it.
[bufFree] :: WriteBuffer -> IO ()

-- | Allocate a buffer of the given size and wrap it in a
--   <a>WriteBuffer</a> containing that size and a finalizer.
createWriteBuffer :: BufSize -> IO WriteBuffer

-- | Allocating a buffer with malloc().
allocateBuffer :: Int -> IO Buffer

-- | Releasing a buffer with free().
freeBuffer :: Buffer -> IO ()
copy :: Buffer -> ByteString -> IO Buffer

-- | Data type to abstract file identifiers. On Unix, a file descriptor
--   would be specified to make use of the file descriptor cache.
data FileId
FileId :: FilePath -> Maybe Fd -> FileId
[fileIdPath] :: FileId -> FilePath
[fileIdFd] :: FileId -> Maybe Fd

-- | fileid, offset, length, hook action, HTTP headers
type SendFile = FileId -> Integer -> Integer -> IO () -> [ByteString] -> IO ()

-- | Function to send a file based on sendfile() for Linux/Mac/FreeBSD.
--   This makes use of the file descriptor cache. For other OSes, this is
--   identical to <a>readSendFile</a>.
sendFile :: Socket -> Buffer -> BufSize -> (ByteString -> IO ()) -> SendFile

-- | Function to send a file based on pread()/send() for Unix. This makes
--   use of the file descriptor cache. For Windows, this is emulated by
--   <tt>Handle</tt>.
readSendFile :: Buffer -> BufSize -> (ByteString -> IO ()) -> SendFile

-- | The version of Warp.
warpVersion :: String
data InternalInfo
InternalInfo :: Manager -> IO GMTDate -> (FilePath -> IO (Maybe Fd, Refresh)) -> (FilePath -> IO FileInfo) -> InternalInfo
[timeoutManager] :: InternalInfo -> Manager
[getDate] :: InternalInfo -> IO GMTDate
[getFd] :: InternalInfo -> FilePath -> IO (Maybe Fd, Refresh)
[getFileInfo] :: InternalInfo -> FilePath -> IO FileInfo

-- | The type for header value used with <tt>HeaderName</tt>.
type HeaderValue = ByteString
type IndexedHeader = IndexedRequestHeader

-- | <a>IndexedRequestHeader</a> with no headers set.
defaultIndexRequestHeader :: IndexedRequestHeader
cancel :: Handle -> IO ()
defaultManager :: Manager
emptyHandle :: Handle
initialize :: Int -> IO Manager
killManager :: Manager -> IO ()
pause :: Handle -> IO ()
register :: Manager -> TimeoutAction -> IO Handle
registerKillThread :: Manager -> TimeoutAction -> IO Handle
resume :: Handle -> IO ()
stopManager :: Manager -> IO ()
tickle :: Handle -> IO ()
withHandle :: Manager -> TimeoutAction -> (Handle -> IO a) -> IO a
withHandleKillThread :: Manager -> TimeoutAction -> (Handle -> IO ()) -> IO ()
withManager :: Int -> (Manager -> IO a) -> IO a
withManager' :: Int -> (Manager -> IO a) -> IO a
data TimeoutThread
TimeoutThread :: TimeoutThread
data Handle
data Manager
type TimeoutAction = IO ()
closeFile :: Fd -> IO ()
openFile :: FilePath -> IO Fd
setFileCloseOnExec :: Fd -> IO ()

-- | Creating <a>MutableFdCache</a> and executing the action in the second
--   argument. The first argument is a cache duration in microseconds.
withFdCache :: Int -> ((FilePath -> IO (Maybe Fd, Refresh)) -> IO a) -> IO a
data Fd

-- | An action to activate a Fd cache entry.
type Refresh = IO ()

-- | Getting the file information corresponding to the file.
getInfo :: FilePath -> IO FileInfo

-- | Creating a file information cache and executing the action in the
--   second argument. The first argument is a cache duration in
--   microseconds.
withFileInfoCache :: Int -> ((FilePath -> IO FileInfo) -> IO a) -> IO a

-- | File information.
data FileInfo
FileInfo :: FilePath -> Integer -> HTTPDate -> ByteString -> FileInfo
[fileInfoName] :: FileInfo -> FilePath
[fileInfoSize] :: FileInfo -> Integer

-- | Modification time
[fileInfoTime] :: FileInfo -> HTTPDate

-- | Modification time in the GMT format
[fileInfoDate] :: FileInfo -> ByteString

-- | Creating <tt>DateCache</tt> and executing the action.
withDateCache :: (IO GMTDate -> IO a) -> IO a

-- | The type of the Date header value.
type GMTDate = ByteString

-- | Type for input streaming.
--   
--   <i>Caveat: a <a>Source</a> is meant to be used in one thread only.</i>
data Source

-- | first request on this connection?
data FirstRequest
FirstRequest :: FirstRequest
SubsequentRequest :: FirstRequest

-- | Receiving a HTTP request from <a>Connection</a> and parsing its header
--   to create <a>Request</a>.
recvRequest :: FirstRequest -> Settings -> Connection -> InternalInfo -> Handle -> SockAddr -> Source -> Transport -> IO (Request, Maybe (IORef Int), IndexedRequestHeader, IO ByteString)

-- | Sending a HTTP response to <a>Connection</a> according to
--   <a>Response</a>.
--   
--   Applications/middlewares MUST provide a proper <a>ResponseHeaders</a>.
--   so that inconsistency does not happen. No header is deleted by this
--   function.
--   
--   Especially, Applications/middlewares MUST provide a proper
--   Content-Type. They MUST NOT provide Content-Length, Content-Range, and
--   Transfer-Encoding because they are inserted, when necessary,
--   regardless they already exist. This function does not insert
--   Content-Encoding. It's middleware's responsibility.
--   
--   The Date and Server header is added if not exist in HTTP response
--   header.
--   
--   There are three basic APIs to create <a>Response</a>:
--   
--   <ul>
--   <li><i><a>responseBuilder</a> :: <a>Status</a> -&gt;
--   <a>ResponseHeaders</a> -&gt; <a>Builder</a> -&gt; <a>Response</a></i>
--   HTTP response body is created from <a>Builder</a>. Transfer-Encoding:
--   chunked is used in HTTP/1.1.</li>
--   <li><i><a>responseStream</a> :: <a>Status</a> -&gt;
--   <a>ResponseHeaders</a> -&gt; <a>StreamingBody</a> -&gt;
--   <a>Response</a></i> HTTP response body is created from <a>Builder</a>.
--   Transfer-Encoding: chunked is used in HTTP/1.1.</li>
--   <li><i><a>responseRaw</a> :: (<a>IO</a> <a>ByteString</a> -&gt;
--   (<a>ByteString</a> -&gt; <a>IO</a> ()) -&gt; <a>IO</a> ()) -&gt;
--   <a>Response</a> -&gt; <a>Response</a></i> No header is added and no
--   Transfer-Encoding: is applied.</li>
--   <li><i><a>responseFile</a> :: <a>Status</a> -&gt;
--   <a>ResponseHeaders</a> -&gt; <a>FilePath</a> -&gt; <a>Maybe</a>
--   <a>FilePart</a> -&gt; <a>Response</a></i> HTTP response body is sent
--   (by sendfile(), if possible) for GET method. HTTP response body is not
--   sent by HEAD method. Content-Length and Content-Range are
--   automatically added into the HTTP response header if necessary. If
--   Content-Length and Content-Range exist in the HTTP response header,
--   they would cause inconsistency. "Accept-Ranges: bytes" is also
--   inserted.</li>
--   </ul>
--   
--   Applications are categorized into simple and sophisticated.
--   Sophisticated applications should specify <a>Just</a> to <a>Maybe</a>
--   <a>FilePart</a>. They should treat the conditional request by
--   themselves. A proper <a>Status</a> (200 or 206) must be provided.
--   
--   Simple applications should specify <a>Nothing</a> to <a>Maybe</a>
--   <a>FilePart</a>. The size of the specified file is obtained by disk
--   access or from the file info cache. If-Modified-Since,
--   If-Unmodified-Since, If-Range and Range are processed. Since a proper
--   status is chosen, <a>Status</a> is ignored. Last-Modified is inserted.
sendResponse :: Settings -> Connection -> InternalInfo -> Handle -> Request -> IndexedRequestHeader -> IO ByteString -> Response -> IO Bool

-- | Set flag FileCloseOnExec flag on a socket (on Unix)
--   
--   Copied from:
--   <a>https://github.com/mzero/plush/blob/master/src/Plush/Server/Warp.hs</a>
setSocketCloseOnExec :: Socket -> IO ()
windowsThreadBlockHack :: IO a -> IO a

-- | Converting WAI application to the server type of http2 library.
http2server :: String -> Settings -> InternalInfo -> Transport -> SockAddr -> Application -> Server

-- | Running an action with internal info.
withII :: Settings -> (InternalInfo -> IO a) -> IO a
serveConnection :: Connection -> InternalInfo -> Handle -> SockAddr -> Transport -> Settings -> Application -> IO ()

-- | <a>PositionReadMaker</a> based on file descriptor cache.
pReadMaker :: InternalInfo -> PositionReadMaker


-- | A fast, light-weight HTTP server handler for WAI.
--   
--   HTTP/1.0, HTTP/1.1 and HTTP/2 are supported. For HTTP/2, Warp supports
--   direct and ALPN (in TLS) but not upgrade.
--   
--   Note on slowloris timeouts: to prevent slowloris attacks, timeouts are
--   used at various points in request receiving and response sending. One
--   interesting corner case is partial request body consumption; in that
--   case, Warp's timeout handling is still in effect, and the timeout will
--   not be triggered again. Therefore, it is recommended that once you
--   start consuming the request body, you either:
--   
--   <ul>
--   <li>consume the entire body promptly</li>
--   <li>call the <a>pauseTimeout</a> function</li>
--   </ul>
--   
--   For more information, see
--   <a>https://github.com/yesodweb/wai/issues/351</a>.
module Network.Wai.Handler.Warp

-- | Run an <a>Application</a> on the given port. This calls
--   <a>runSettings</a> with <a>defaultSettings</a>.
run :: Port -> Application -> IO ()

-- | Run an <a>Application</a> on the port present in the <tt>PORT</tt>
--   environment variable. Uses the <a>Port</a> given when the variable is
--   unset. This calls <a>runSettings</a> with <a>defaultSettings</a>.
runEnv :: Port -> Application -> IO ()

-- | Run an <a>Application</a> with the given <a>Settings</a>. This opens a
--   listen socket on the port defined in <a>Settings</a> and calls
--   <a>runSettingsSocket</a>.
runSettings :: Settings -> Application -> IO ()

-- | This installs a shutdown handler for the given socket and runs the
--   default connection setup action, which handles plain (non-cipher)
--   HTTP. Running the handler stops the server accepting, closes the
--   listening socket, and gracefully shuts the live connections down.
--   
--   The supplied socket can be a Unix named socket, which can be used when
--   reverse HTTP proxying into your application.
--   
--   Note that the <a>settingsPort</a> will still be passed to
--   <a>Application</a>s via the <tt>serverPort</tt> record.
runSettingsSocket :: Settings -> Socket -> Application -> IO ()

-- | Various Warp server settings. This is purposely kept as an abstract
--   data type so that new settings can be added without breaking backwards
--   compatibility. In order to create a <a>Settings</a> value, use
--   <a>defaultSettings</a> and the various 'set' functions to modify
--   individual fields. For example:
--   
--   <pre>
--   setTimeout 20 defaultSettings
--   </pre>
data Settings

-- | The default settings for the Warp server. See the individual settings
--   for the default value.
defaultSettings :: Settings

-- | Port to listen on. Default value: 3000
setPort :: Port -> Settings -> Settings

-- | Interface to bind to. Default value: HostIPv4
setHost :: HostPreference -> Settings -> Settings

-- | What to do with exceptions thrown by either the application or server.
--   Default: <a>defaultOnException</a>
setOnException :: (Maybe Request -> SomeException -> IO ()) -> Settings -> Settings

-- | Handle exceptions escaping a connection worker, with the address
--   supplied by its connection source. This includes connection creation
--   (such as a TLS handshake) and cleanup failures, even when no
--   <a>Request</a> exists. For socket listeners this is the accepted TCP
--   peer, before any PROXY protocol rewriting.
--   
--   When installed, this handler receives these exceptions instead of the
--   handler configured with <a>setOnException</a>. Request-specific
--   exceptions and accept-loop failures still use that handler. By
--   default, worker exceptions go to that handler too, with <a>Nothing</a>
--   as its <tt>Maybe Request</tt> argument because no request context is
--   available at this boundary.
setOnConnectionException :: (SockAddr -> SomeException -> IO ()) -> Settings -> Settings

-- | A function to create a <a>Response</a> when an exception occurs.
--   Default: <a>defaultOnExceptionResponse</a>
--   
--   Note that an application can handle its own exceptions without
--   interfering with Warp:
--   
--   <pre>
--   myApp :: Application
--   myApp request respond = innerApp `catch` onError
--     where
--       onError = respond . response500 request
--   
--   response500 :: Request -&gt; SomeException -&gt; Response
--   response500 req someEx = responseLBS status500 -- ...
--   </pre>
setOnExceptionResponse :: (SomeException -> Response) -> Settings -> Settings

-- | What to do when a connection is opened. When <a>False</a> is returned,
--   the connection is closed immediately. Otherwise, the connection is
--   going on. Default: always returns <a>True</a>.
setOnOpen :: (SockAddr -> IO Bool) -> Settings -> Settings

-- | What to do when a connection is closed. Default: do nothing.
setOnClose :: (SockAddr -> IO ()) -> Settings -> Settings

-- | "Slow-loris" timeout lower-bound value in seconds. Connections where
--   network progress is made less frequently than this may be closed. In
--   practice many connections may be allowed to go without progress for up
--   to twice this amount of time. Note that this timeout is not applied to
--   application code, only network progress.
--   
--   Default value: 30
setTimeout :: Int -> Settings -> Settings

-- | Use an existing timeout manager instead of spawning a new one. If
--   used, <a>settingsTimeout</a> is ignored.
setManager :: Manager -> Settings -> Settings

-- | Cache duration time of file descriptors in seconds. 0 means that the
--   cache mechanism is not used.
--   
--   The FD cache is an optimization that is useful for servers dealing
--   with static files. However, if files are being modified, it can cause
--   incorrect results in some cases. Therefore, we disable it by default.
--   If you know that your files will be static or you prefer performance
--   to file consistency, it's recommended to turn this on; a reasonable
--   value for those cases is 10. Enabling this cache results in drastic
--   performance improvement for file transfers.
--   
--   Default value: 0, was previously 10
setFdCacheDuration :: Int -> Settings -> Settings

-- | Cache duration time of file information in seconds. 0 means that the
--   cache mechanism is not used.
--   
--   The file information cache is an optimization that is useful for
--   servers dealing with static files. However, if files are being
--   modified, it can cause incorrect results in some cases. Therefore, we
--   disable it by default. If you know that your files will be static or
--   you prefer performance to file consistency, it's recommended to turn
--   this on; a reasonable value for those cases is 10. Enabling this cache
--   results in drastic performance improvement for file transfers.
--   
--   Default value: 0
setFileInfoCacheDuration :: Int -> Settings -> Settings

-- | Code to run after the listening socket is ready but before entering
--   the main event loop. Useful for signaling to tests that they can start
--   running, or to drop permissions after binding to a restricted port.
--   
--   Default: do nothing.
setBeforeMainLoop :: IO () -> Settings -> Settings

-- | Perform no parsing on the rawPathInfo.
--   
--   This is useful for writing HTTP proxies.
--   
--   Default: False
setNoParsePath :: Bool -> Settings -> Settings

-- | A code to install shutdown handler.
--   
--   For instance, this code should set up a UNIX signal handler. The
--   handler should call the first argument, which closes the listen
--   socket, at shutdown.
--   
--   Example usage:
--   
--   <pre>
--   settings :: IO () -&gt; <a>Settings</a>
--   settings shutdownAction = <a>setInstallShutdownHandler</a> shutdownHandler <a>defaultSettings</a>
--     <b>where</b>
--       shutdownHandler closeSocket =
--         void $ <a>installHandler</a> <a>sigTERM</a> (<a>Catch</a> $ shutdownAction &gt;&gt; closeSocket) <a>Nothing</a>
--   </pre>
--   
--   Note that by default, the graceful shutdown mode lasts indefinitely
--   (see <a>setGracefulShutdownTimeout</a>). If you install a signal
--   handler as above, upon receiving that signal, the custom shutdown
--   action will run <i>and</i> all outstanding requests will be handled.
--   
--   You may instead prefer to do one or both of the following:
--   
--   <ul>
--   <li>Only wait a finite amount of time for outstanding requests to
--   complete, using <a>setGracefulShutdownTimeout</a>.</li>
--   <li>Only catch one signal, so the second hard-kills the Warp server,
--   using <a>CatchOnce</a>.</li>
--   </ul>
--   
--   Default: does not install any code.
setInstallShutdownHandler :: (IO () -> IO ()) -> Settings -> Settings

-- | Default server name to be sent as the "Server:" header if an
--   application does not set one. If an empty string is set, the "Server:"
--   header is not sent. This is true even if an application set one.
setServerName :: ByteString -> Settings -> Settings

-- | The maximum number of bytes to flush from an unconsumed request body.
--   
--   By default, Warp does not flush the request body so that, if a large
--   body is present, the connection is simply terminated instead of
--   wasting time and bandwidth on transmitting it. However, some clients
--   do not deal with that situation well. You can either change this
--   setting to <tt>Nothing</tt> to flush the entire body in all cases, or
--   in your application ensure that you always consume the entire request
--   body.
--   
--   Default: 8192 bytes.
setMaximumBodyFlush :: Maybe Int -> Settings -> Settings

-- | Code to fork a new thread to accept a connection.
--   
--   This may be useful if you need OS bound threads, or if you wish to
--   develop an alternative threading model.
--   
--   Default: void . forkIOWithUnmask
setFork :: (((forall a. () => IO a -> IO a) -> IO ()) -> IO ()) -> Settings -> Settings

-- | Code to accept a new connection.
--   
--   Useful if you need to provide connected sockets from something other
--   than a standard accept call.
--   
--   Default: <a>defaultAccept</a>
setAccept :: (Socket -> IO (Socket, SockAddr)) -> Settings -> Settings

-- | Do not use the PROXY protocol.
setProxyProtocolNone :: Settings -> Settings

-- | Require PROXY header.
--   
--   This is for cases where a "dumb" TCP/SSL proxy is being used, which
--   cannot add an <tt>X-Forwarded-For</tt> HTTP header field but has
--   enabled support for the PROXY protocol.
--   
--   See <a>http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt</a>
--   and
--   <a>http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/TerminologyandKeyConcepts.html#proxy-protocol</a>.
--   
--   Only the human-readable header format (version 1) is supported. The
--   binary header format (version 2) is <i>not</i> supported.
setProxyProtocolRequired :: Settings -> Settings

-- | Use the PROXY header if it exists, but also accept connections without
--   the header. See <a>setProxyProtocolRequired</a>.
--   
--   WARNING: This is contrary to the PROXY protocol specification and
--   using it can indicate a security problem with your architecture if the
--   web server is directly accessible to the public, since it would allow
--   easy IP address spoofing. However, it can be useful in some cases,
--   such as if a load balancer health check uses regular HTTP without the
--   PROXY header, but proxied connections <i>do</i> include the PROXY
--   header.
setProxyProtocolOptional :: Settings -> Settings

-- | Size in bytes read to prevent Slowloris attacks. Default value: 2048
setSlowlorisSize :: Int -> Settings -> Settings

-- | Disable HTTP2.
setHTTP2Disabled :: Settings -> Settings

-- | Setting a log function.
--   
--   @since 3.X.X
setLogger :: (Request -> Status -> Maybe Integer -> IO ()) -> Settings -> Settings

-- | Setting a log function for HTTP/2 server push.
--   
--   Since: 3.2.7
setServerPushLogger :: (Request -> ByteString -> Integer -> IO ()) -> Settings -> Settings

-- | Set the graceful shutdown timeout. A timeout of <tt>Nothing</tt> will
--   wait indefinitely, and a number, if provided, will be treated as
--   seconds to wait for requests to finish, before shutting down the
--   server entirely.
--   
--   Graceful shutdown mode is entered when the server socket is closed;
--   see <a>setInstallShutdownHandler</a> for an example of how this could
--   be done in response to a UNIX signal.
setGracefulShutdownTimeout :: Maybe Int -> Settings -> Settings

-- | A timeout to limit the time (in milliseconds) waiting for FIN for
--   HTTP/1.x. 0 means uses immediate close. Default: 0.
setGracefulCloseTimeout1 :: Int -> Settings -> Settings

-- | A timeout to limit the time (in milliseconds) waiting for FIN for
--   HTTP/2. 0 means uses immediate close. Default: 2000.
setGracefulCloseTimeout2 :: Int -> Settings -> Settings

-- | Set the maximum header size that Warp will tolerate when using
--   HTTP/1.x.
setMaxTotalHeaderLength :: Int -> Settings -> Settings

-- | Setting the header value of Alternative Services (AltSvc:).
setAltSvc :: ByteString -> Settings -> Settings

-- | Set the maximum buffer size for sending <tt>Builder</tt> responses.
setMaxBuilderResponseBufferSize :: Int -> Settings -> Settings

-- | Close connections with network's <tt>unsafeClose</tt> and
--   <tt>unsafeGracefulClose</tt>. See <a>settingsUnsafeClose</a> for when
--   it is safe. Default: <a>False</a>.
setUnsafeClose :: Bool -> Settings -> Settings

-- | Get the listening port.
getPort :: Settings -> Port

-- | Get the interface to bind to.
getHost :: Settings -> HostPreference

-- | Get the action on opening connection.
getOnOpen :: Settings -> SockAddr -> IO Bool

-- | Get the action on closeing connection.
getOnClose :: Settings -> SockAddr -> IO ()

-- | Get the exception handler.
getOnException :: Settings -> Maybe Request -> SomeException -> IO ()

-- | Get the handler installed with <a>setOnConnectionException</a>. If
--   none was installed, the returned function ignores the peer address and
--   calls the handler configured with <a>setOnException</a>, passing
--   <a>Nothing</a> as its <tt>Maybe Request</tt> argument and forwarding
--   the exception.
getOnConnectionException :: Settings -> SockAddr -> SomeException -> IO ()

-- | Get the graceful shutdown timeout
getGracefulShutdownTimeout :: Settings -> Maybe Int

-- | A timeout to limit the time (in milliseconds) waiting for FIN for
--   HTTP/1.x. 0 means uses immediate close.
getGracefulCloseTimeout1 :: Settings -> Int

-- | A timeout to limit the time (in milliseconds) waiting for FIN for
--   HTTP/2. 0 means uses immediate close.
getGracefulCloseTimeout2 :: Settings -> Int

-- | Get the connection counter, if one was configured. Use <a>getCount</a>
--   on the returned <a>Counter</a> to read the current value.
--   
--   See <a>makeSettingsAndCounter</a> to create settings with a counter.
--   
--   <i>DEPRECATED in favor of <a>getServerState</a></i>
getOpenConnectionCounter :: Settings -> Maybe Counter

-- | Get the <a>ServerState</a>, if one was configured. Use things like
--   <a>currentOpenConnections</a> and <a>currentShuttingDownState</a> to
--   query information about the current state of the server.
--   
--   See <a>makeSettingsAndServerState</a> to create <a>Settings</a> with a
--   <a>ServerState</a>.
getServerState :: Settings -> Maybe ServerState

-- | Whether connections are closed with network's <tt>unsafeClose</tt> and
--   <tt>unsafeGracefulClose</tt>.
getUnsafeClose :: Settings -> Bool

-- | Internal read-only state of the server
data ServerState

-- | Create <a>defaultSettings</a> with a <a>ServerState</a>. Use functions
--   like <a>currentOpenConnections</a> and <a>currentShuttingDownState</a>
--   to gain insight into the state of the server.
makeSettingsAndServerState :: IO (ServerState, Settings)

-- | Get the currently open connections of the server.
--   
--   Connections are considered "open" the moment they are accepted by the
--   socket.
currentOpenConnections :: ServerState -> IO Int

-- | Check if the server is currently shutting down.
--   
--   <pre>
--   False: Server is not shutting down
--   True:  Server is shutting down or has shut down.
--   </pre>
currentShuttingDownState :: ServerState -> IO Bool

-- | Get the currently open connections of the server in an <a>STM</a>
--   transaction.
--   
--   Connections are considered "open" the moment they are accepted by the
--   socket.
currentOpenConnectionsSTM :: ServerState -> STM Int

-- | Check if the server is currently shutting down in an <a>STM</a>
--   transaction.
--   
--   (This way you can have a thread wait for server shutdown with
--   <a>retry</a>)
--   
--   <pre>
--   False: Server is not shutting down
--   True:  Server is shutting down or has shut down.
--   </pre>
currentShuttingDownStateSTM :: ServerState -> STM Bool

-- | Create <a>defaultSettings</a> with a connection counter. Use
--   <a>getCount</a> on the returned <a>Counter</a> to check open
--   connections.
--   
--   <i>DEPRECATED in favor of <a>makeSettingsAndServerState</a></i>
makeSettingsAndCounter :: IO (Counter, Settings)

-- | The connections of a server: how many there are, and which threads are
--   serving them.
--   
--   Both come from the <a>ThreadManager</a>, which counts a connection
--   from when the accept loop keeps a place for it -- before the thread
--   that will serve it has been scheduled, which is too late for a
--   graceful shutdown to notice it.
data Counter

-- | Get the current count of open connections.
getCount :: Counter -> IO Int

-- | Printing an exception to standard error if
--   <a>defaultShouldDisplayException</a> returns <a>True</a>.
--   
--   @since: 3.1.0
defaultOnException :: Maybe Request -> SomeException -> IO ()

-- | Apply the logic provided by <a>defaultOnException</a> to determine if
--   an exception should be shown or not. The goal is to hide exceptions
--   which occur under the normal course of the web server running.
defaultShouldDisplayException :: SomeException -> Bool

-- | Sending 400 for bad requests. Sending 500 for internal server errors.
--   <tt>since: 3.1.0 Sending 413 for too large payload. Sending 431 for
--   too large headers. </tt>since 3.2.27 Sending 501 for an unsupported
--   transfer coding. @since 3.4.17
defaultOnExceptionResponse :: SomeException -> Response

-- | Exception handler for the debugging purpose. 500, text/plain, a showed
--   exception.
--   
--   @since: 2.0.3.2
exceptionResponseForDebug :: SomeException -> Response
data HostPreference

-- | TCP port number.
type Port = Int

-- | Error types for bad <tt>Request</tt>.
data InvalidRequest
NotEnoughLines :: [String] -> InvalidRequest
BadFirstLine :: String -> InvalidRequest
NonHttp :: InvalidRequest
IncompleteHeaders :: InvalidRequest
ConnectionClosedByPeer :: InvalidRequest
OverLargeHeader :: InvalidRequest
BadProxyHeader :: String -> InvalidRequest

-- | Since 3.3.22
PayloadTooLarge :: InvalidRequest

-- | Since 3.3.22
RequestHeaderFieldsTooLarge :: InvalidRequest

-- | A transfer coding warp does not implement. Since 3.4.17
UnsupportedTransferEncoding :: InvalidRequest

-- | The length of the request body cannot be determined reliably, so no
--   reading of it can be trusted. Since 3.4.17
AmbiguousBodyLength :: InvalidRequest

-- | CR or NUL inside a header field line, which one reader takes for a
--   line terminator where another reads data. Since 3.4.17
BadHeaderLine :: InvalidRequest

-- | A header field name which is not a token, which hides the field from
--   one reader but not another. Since 3.4.17
BadFieldName :: ByteString -> InvalidRequest

-- | A chunked request body that does not keep to the framing RFC 9112
--   gives it. Since 3.4.17
BadChunkedBody :: InvalidRequest

-- | No <tt>Host</tt> in a HTTP/1.1 request, or more than one, which a
--   router and this server may read differently. Since 3.4.19
BadHost :: InvalidRequest

-- | Explicitly pause the slowloris timeout.
--   
--   This is useful for cases where you partially consume a request body.
--   For more information, see
--   <a>https://github.com/yesodweb/wai/issues/351</a>
pauseTimeout :: Request -> IO ()

-- | File information.
data FileInfo
FileInfo :: FilePath -> Integer -> HTTPDate -> ByteString -> FileInfo
[fileInfoName] :: FileInfo -> FilePath
[fileInfoSize] :: FileInfo -> Integer

-- | Modification time
[fileInfoTime] :: FileInfo -> HTTPDate

-- | Modification time in the GMT format
[fileInfoDate] :: FileInfo -> ByteString

-- | Getting file information of the target file.
--   
--   This function first uses a stat(2) or similar system call to obtain
--   information of the target file, then registers it into the internal
--   cache. From the next time, the information is obtained from the cache.
--   This reduces the overhead to call the system call. The internal cache
--   is refreshed every duration specified by
--   <a>setFileInfoCacheDuration</a>.
--   
--   This function throws an <a>IO</a> exception if the information is not
--   available. For instance, the target file does not exist. If this
--   function is used an a Request generated by a WAI backend besides Warp,
--   it also throws an <a>IO</a> exception.
getFileInfo :: Request -> FilePath -> IO FileInfo

-- | Getting information of client certificate.
clientCertificate :: Request -> Maybe CertificateChain

-- | Runs the given <a>Application</a> on a free port. Passes the port to
--   the given operation and executes it, while the <a>Application</a> is
--   running. Shuts down the server before returning.
withApplication :: IO Application -> (Port -> IO a) -> IO a

-- | <a>withApplication</a> with given <a>Settings</a>. This will ignore
--   the port value set by <tt>setPort</tt> in <a>Settings</a>.
withApplicationSettings :: Settings -> IO Application -> (Port -> IO a) -> IO a

-- | Same as <a>withApplication</a> but with different exception handling:
--   If the given <a>Application</a> throws an exception,
--   <a>testWithApplication</a> will re-throw the exception to the calling
--   thread, possibly interrupting the execution of the given operation.
--   
--   This is handy for running tests against an <a>Application</a> over a
--   real network port. When running tests, it's useful to let exceptions
--   thrown by your <a>Application</a> propagate to the main thread of the
--   test-suite.
--   
--   <b>The exception handling makes this function unsuitable for use in
--   production.</b> Use <a>withApplication</a> instead.
testWithApplication :: IO Application -> (Port -> IO a) -> IO a

-- | <a>testWithApplication</a> with given <a>Settings</a>.
testWithApplicationSettings :: Settings -> IO Application -> (Port -> IO a) -> IO a

-- | Opens a socket on a free port and returns both port and socket.
openFreePort :: IO (Port, Socket)

-- | The version of Warp.
warpVersion :: String

-- | HTTP/2 specific data.
--   
--   Since: 3.2.7
data HTTP2Data

-- | Accessor for <a>PushPromise</a> in <a>HTTP2Data</a>.
--   
--   Since: 3.2.7
http2dataPushPromise :: HTTP2Data -> [PushPromise]

-- | Accessor for <a>TrailersMaker</a> in <a>HTTP2Data</a>.
--   
--   Since: 3.2.8 but the type changed in 3.3.0
http2dataTrailers :: HTTP2Data -> TrailersMaker

-- | Default HTTP/2 specific data.
--   
--   Since: 3.2.7
defaultHTTP2Data :: HTTP2Data

-- | Getting <a>HTTP2Data</a> through vault of the request. Warp uses this
--   to receive <a>HTTP2Data</a> from <a>Middleware</a>.
--   
--   Since: 3.2.7
getHTTP2Data :: Request -> IO (Maybe HTTP2Data)

-- | Setting <a>HTTP2Data</a> through vault of the request.
--   <a>Application</a> or <a>Middleware</a> should use this.
--   
--   Since: 3.2.7
setHTTP2Data :: Request -> Maybe HTTP2Data -> IO ()

-- | Modifying <a>HTTP2Data</a> through vault of the request.
--   <a>Application</a> or <a>Middleware</a> should use this.
--   
--   Since: 3.2.8
modifyHTTP2Data :: Request -> (Maybe HTTP2Data -> Maybe HTTP2Data) -> IO ()

-- | HTTP/2 push promise or sever push. This allows files only for
--   backward-compatibility while the HTTP/2 library supports other types.
--   
--   Since: 3.2.7
data PushPromise

-- | Accessor for a URL path in <a>PushPromise</a>. E.g.
--   "/style/default.css".
--   
--   Since: 3.2.7
promisedPath :: PushPromise -> ByteString

-- | Accessor for <a>FilePath</a> in <a>PushPromise</a>. E.g.
--   "FILE_PATH/default.css".
--   
--   Since: 3.2.7
promisedFile :: PushPromise -> FilePath

-- | Accessor for <a>ResponseHeaders</a> in <a>PushPromise</a>
--   "content-type" must be specified. Default value: [].
--   
--   Since: 3.2.7
promisedResponseHeaders :: PushPromise -> ResponseHeaders

-- | Accessor for <a>Weight</a> in <a>PushPromise</a>. Default value: 16.
--   
--   Since: 3.2.7
promisedWeight :: PushPromise -> Weight

-- | Default push promise.
--   
--   Since: 3.2.7
defaultPushPromise :: PushPromise
