-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | HTTP/2.0 library including frames and HPACK -- -- HTTP/2.0 library including frames and HPACK Currently HTTP/2 16 -- framing and HPACK 10 is supported. @package http2 @version 0.7.0 module Network.HTTP2 -- | "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" connectionPreface :: ByteString -- | Length of the preface connectionPrefaceLength :: Int -- | Auxiliary information for frame encoding. data EncodeInfo EncodeInfo :: FrameFlags -> StreamIdentifier -> Maybe Padding -> EncodeInfo -- | Flags to be set in a frame header encodeFlags :: EncodeInfo -> FrameFlags -- | Stream id to be set in a frame header encodeStreamId :: EncodeInfo -> StreamIdentifier -- | Padding if any encodePadding :: EncodeInfo -> Maybe Padding -- | A smart builder of EncodeInfo. encodeInfo :: (FrameFlags -> FrameFlags) -> Int -> EncodeInfo -- | Encoding an HTTP/2 frame to byte stream. encodeFrame :: EncodeInfo -> FramePayload -> ByteString -- | Parsing byte stream to make an HTTP/2 frame. decodeFrame :: Settings -> ByteString -> Either ErrorCodeId (Frame, ByteString) type SettingsKey = Word16 data SettingsKeyId SettingsHeaderTableSize :: SettingsKeyId SettingsEnablePush :: SettingsKeyId SettingsMaxConcurrentStreams :: SettingsKeyId SettingsInitialWindowSize :: SettingsKeyId SettingsMaxFrameSize :: SettingsKeyId SettingsMaxHeaderBlockSize :: SettingsKeyId type SettingsValue = Int -- |
--   >>> fromSettingsKeyId SettingsHeaderTableSize
--   1
--   
--   >>> fromSettingsKeyId SettingsMaxHeaderBlockSize
--   6
--   
fromSettingsKeyId :: SettingsKeyId -> Word16 -- |
--   >>> toSettingsKeyId 0
--   Nothing
--   
--   >>> toSettingsKeyId 1
--   Just SettingsHeaderTableSize
--   
--   >>> toSettingsKeyId 6
--   Just SettingsMaxHeaderBlockSize
--   
--   >>> toSettingsKeyId 7
--   Nothing
--   
toSettingsKeyId :: Word16 -> Maybe SettingsKeyId data Settings Settings :: Int -> Bool -> Int -> Int -> Int -> Maybe Int -> Settings headerTableSize :: Settings -> Int establishPush :: Settings -> Bool maxConcurrentStreams :: Settings -> Int initialWindowSize :: Settings -> Int maxFrameSize :: Settings -> Int maxHeaderBlockSize :: Settings -> Maybe Int type SettingsList = [(SettingsKeyId, SettingsValue)] -- | The default settings. defaultSettings :: Settings -- | Updating settings. -- --
--   >>> updateSettings defaultSettings [(SettingsEnablePush,0),(SettingsMaxHeaderBlockSize,200)]
--   Settings {headerTableSize = 4096, establishPush = False, maxConcurrentStreams = 100, initialWindowSize = 65535, maxFrameSize = 16384, maxHeaderBlockSize = Just 200}
--   
updateSettings :: Settings -> SettingsList -> Settings type ErrorCode = Word32 data ErrorCodeId NoError :: ErrorCodeId ProtocolError :: ErrorCodeId InternalError :: ErrorCodeId FlowControlError :: ErrorCodeId SettingsTimeout :: ErrorCodeId StreamClosed :: ErrorCodeId FrameSizeError :: ErrorCodeId RefusedStream :: ErrorCodeId Cancel :: ErrorCodeId CompressionError :: ErrorCodeId ConnectError :: ErrorCodeId EnhanceYourCalm :: ErrorCodeId InadequateSecurity :: ErrorCodeId HTTP11Required :: ErrorCodeId UnknownErrorCode :: ErrorCode -> ErrorCodeId UnknownError :: String -> ErrorCodeId -- |
--   >>> fromErrorCodeId NoError
--   0
--   
--   >>> fromErrorCodeId InadequateSecurity
--   12
--   
fromErrorCodeId :: ErrorCodeId -> ErrorCode -- |
--   >>> toErrorCodeId 0
--   NoError
--   
--   >>> toErrorCodeId 0xc
--   InadequateSecurity
--   
--   >>> toErrorCodeId 0xe
--   UnknownErrorCode 14
--   
toErrorCodeId :: ErrorCode -> ErrorCodeId type FrameType = Word8 data FrameTypeId FrameData :: FrameTypeId FrameHeaders :: FrameTypeId FramePriority :: FrameTypeId FrameRSTStream :: FrameTypeId FrameSettings :: FrameTypeId FramePushPromise :: FrameTypeId FramePing :: FrameTypeId FrameGoAway :: FrameTypeId FrameWindowUpdate :: FrameTypeId FrameContinuation :: FrameTypeId -- |
--   >>> fromFrameTypeId FrameData
--   0
--   
--   >>> fromFrameTypeId FrameContinuation
--   9
--   
fromFrameTypeId :: FrameTypeId -> FrameType -- |
--   >>> toFrameTypeId 0
--   Just FrameData
--   
--   >>> toFrameTypeId 9
--   Just FrameContinuation
--   
--   >>> toFrameTypeId 10
--   Nothing
--   
toFrameTypeId :: FrameType -> Maybe FrameTypeId data Frame Frame :: FrameHeader -> FramePayload -> Frame frameHeader :: Frame -> FrameHeader framePayload :: Frame -> FramePayload data FrameHeader FrameHeader :: PayloadLength -> FrameFlags -> StreamIdentifier -> FrameHeader payloadLength :: FrameHeader -> PayloadLength flags :: FrameHeader -> FrameFlags streamId :: FrameHeader -> StreamIdentifier data FramePayload DataFrame :: ByteString -> FramePayload HeadersFrame :: (Maybe Priority) -> HeaderBlockFragment -> FramePayload PriorityFrame :: Priority -> FramePayload RSTStreamFrame :: ErrorCodeId -> FramePayload SettingsFrame :: SettingsList -> FramePayload PushPromiseFrame :: PromisedStreamId -> HeaderBlockFragment -> FramePayload PingFrame :: ByteString -> FramePayload GoAwayFrame :: LastStreamId -> ErrorCodeId -> ByteString -> FramePayload WindowUpdateFrame :: WindowSizeIncrement -> FramePayload ContinuationFrame :: HeaderBlockFragment -> FramePayload UnknownFrame :: FrameType -> ByteString -> FramePayload framePayloadToFrameType :: FramePayload -> FrameType newtype StreamIdentifier StreamIdentifier :: Int -> StreamIdentifier type StreamDependency = StreamIdentifier type PromisedStreamId = StreamIdentifier type LastStreamId = StreamIdentifier fromStreamIdentifier :: StreamIdentifier -> Int toStreamIdentifier :: Int -> StreamIdentifier streamIdentifierForSeetings :: StreamIdentifier testExclusive :: Int -> Bool setExclusive :: Int -> Int type FrameFlags = Word8 defaultFlags :: FrameFlags -- |
--   >>> testEndStream 0x1
--   True
--   
testEndStream :: FrameFlags -> Bool -- |
--   >>> testAck 0x1
--   True
--   
testAck :: FrameFlags -> Bool -- |
--   >>> testEndHeader 0x4
--   True
--   
testEndHeader :: FrameFlags -> Bool -- |
--   >>> testPadded 0x8
--   True
--   
testPadded :: FrameFlags -> Bool -- |
--   >>> testPriority 0x20
--   True
--   
testPriority :: FrameFlags -> Bool -- |
--   >>> setEndStream 0
--   1
--   
setEndStream :: FrameFlags -> FrameFlags -- |
--   >>> setAck 0
--   1
--   
setAck :: FrameFlags -> FrameFlags -- |
--   >>> setEndHeader 0
--   4
--   
setEndHeader :: FrameFlags -> FrameFlags -- |
--   >>> setPadded 0
--   8
--   
setPadded :: FrameFlags -> FrameFlags -- |
--   >>> setPriority 0
--   32
--   
setPriority :: FrameFlags -> FrameFlags type PayloadLength = Int maxPayloadLength :: PayloadLength type WindowSizeIncrement = Word32 type HeaderBlockFragment = ByteString data Priority Priority :: Bool -> StreamIdentifier -> Int -> Priority exclusive :: Priority -> Bool streamDependency :: Priority -> StreamIdentifier weight :: Priority -> Int type Padding = ByteString -- | HPACK: encoding and decoding a header list. module Network.HPACK -- | HPACK encoding, from HeaderList to ByteStream. type HPACKEncoding = DynamicTable -> HeaderList -> IO (DynamicTable, ByteStream) -- | HPACK decoding, from ByteStream to HeaderList. type HPACKDecoding = DynamicTable -> ByteStream -> IO (DynamicTable, HeaderList) -- | Converting HeaderList for HTTP request to the low level format. encodeHeader :: EncodeStrategy -> HPACKEncoding -- | Converting the low level format for HTTP request to HeaderList. -- DecodeError would be thrown. decodeHeader :: HPACKDecoding -- | Type for dynamic table. data DynamicTable -- | Creating DynamicTable. The default maxDynamicTableSize is 4096 -- bytes, an array has 128 entries, resulting 1024 bytes in 64bit machine newDynamicTableForEncoding :: Size -> IO DynamicTable -- | Creating DynamicTable. The default maxDynamicTableSize is 4096 -- bytes, an array has 128 entries, resulting 1024 bytes in 64bit machine newDynamicTableForDecoding :: Size -> IO DynamicTable -- | Compression algorithms for HPACK encoding. data CompressionAlgo -- | No compression Naive :: CompressionAlgo -- | Using the static table only Static :: CompressionAlgo -- | Using indices only Linear :: CompressionAlgo -- | Strategy for HPACK encoding. data EncodeStrategy EncodeStrategy :: CompressionAlgo -> Bool -> EncodeStrategy -- | Which compression algorithm is used. compressionAlgo :: EncodeStrategy -> CompressionAlgo -- | Whether or not to use Huffman encoding for strings. useHuffman :: EncodeStrategy -> Bool -- | Default EncodeStrategy. compressionAlgo is Linear -- and useHuffman is True. defaultEncodeStrategy :: EncodeStrategy -- | Errors for decoder. data DecodeError -- | Index is out of range IndexOverrun :: Index -> DecodeError -- | Eos appears in the middle of huffman string EosInTheMiddle :: DecodeError -- | Non-eos appears in the end of huffman string IllegalEos :: DecodeError -- | Eos of huffman string is more than 7 bits TooLongEos :: DecodeError -- | Encoded string has no length EmptyEncodedString :: DecodeError -- | Header block is empty EmptyBlock :: DecodeError -- | Header list. type HeaderList = [Header] -- | Header. type Header = (HeaderName, HeaderValue) -- | Header name. type HeaderName = ByteString -- | Header value. type HeaderValue = ByteString -- | Byte stream in HTTP request/response. type ByteStream = ByteString -- | Size in bytes. type Size = Int -- | Index for table. type Index = Int