http3 0.1.3 → 0.1.4
raw patch · 7 files changed
+49/−26 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Network.QPACK: [ecUseHuffman] :: QEncoderConfig -> Bool
- Network.QPACK: QEncoderConfig :: Size -> Size -> Size -> QEncoderConfig
+ Network.QPACK: QEncoderConfig :: Size -> Size -> Size -> Bool -> QEncoderConfig
- Network.QPACK.Internal: encodeHeader :: DynamicTable -> [Header] -> IO (EncodedFieldSection, EncodedEncoderInstruction)
+ Network.QPACK.Internal: encodeHeader :: Bool -> DynamicTable -> [Header] -> IO (EncodedFieldSection, EncodedEncoderInstruction)
- Network.QPACK.Internal: encodeTokenHeader :: WriteBuffer -> WriteBuffer -> DynamicTable -> TokenHeaderList -> IO [AbsoluteIndex]
+ Network.QPACK.Internal: encodeTokenHeader :: WriteBuffer -> WriteBuffer -> Bool -> DynamicTable -> TokenHeaderList -> IO [AbsoluteIndex]
Files
- ChangeLog.md +4/−0
- Network/HTTP3/Send.hs +12/−3
- Network/QPACK.hs +13/−6
- Network/QPACK/Error.hs +4/−4
- Network/QPACK/HeaderBlock/Encode.hs +9/−6
- http3.cabal +3/−3
- test/HTTP3/Error.hs +4/−4
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for http3 +## 0.1.4++* adding ecUseHuffman to defaultQEncoderConfig+ ## 0.1.3 * Using quic v0.3.
Network/HTTP3/Send.hs view
@@ -61,7 +61,10 @@ T.tickle th case mnext of Nothing -> do- Trailers trailers <- tlrmkr Nothing+ tm <- tlrmkr Nothing+ let trailers = case tm of+ Trailers t -> t+ _ -> [] unless (null trailers) $ sendHeader ctx strm th trailers Just next -> sendNext ctx strm th next tlrmkr @@ -90,7 +93,10 @@ then return (signal, tlrmkr0) else do let bs = PS fp 0 len- NextTrailersMaker tlrmkr1 <- tlrmkr0 $ Just bs+ tm <- tlrmkr0 $ Just bs+ let tlrmkr1 = case tm of+ NextTrailersMaker t -> t+ _ -> defaultTrailersMaker encodeH3Frame (H3Frame H3FrameData bs) >>= sendStream strm T.tickle th return (signal, tlrmkr1)@@ -131,6 +137,9 @@ newByteStringAndSend strm th tlrmkr1 writer >>= loop loop (B.Chunk bs writer, tlrmkr1) = do encodeH3Frame (H3Frame H3FrameData bs) >>= sendStream strm- NextTrailersMaker tlrmkr2 <- tlrmkr1 $ Just bs+ tm2 <- tlrmkr1 $ Just bs+ let tlrmkr2 = case tm2 of+ NextTrailersMaker t -> t+ _ -> defaultTrailersMaker T.tickle th newByteStringAndSend strm th tlrmkr2 writer >>= loop
Network/QPACK.hs view
@@ -113,6 +113,7 @@ { ecMaxTableCapacity :: Size , ecHeaderBlockBufferSize :: Size , ecInstructionBufferSize :: Size+ , ecUseHuffman :: Bool } deriving (Show) @@ -126,6 +127,7 @@ { ecMaxTableCapacity = 4096 , ecHeaderBlockBufferSize = 4096 , ecInstructionBufferSize = 4096+ , ecUseHuffman = True } -- | Creating a new QPACK encoder.@@ -146,6 +148,7 @@ bufsiz1 gcbuf2 bufsiz2+ ecUseHuffman dyntbl lock handler = decoderInstructionHandler dyntbl@@ -192,10 +195,11 @@ -> Int -> GCBuffer -> Int+ -> Bool -> DynamicTable -> MVar () -> QEncoder-qpackEncoder gcbuf1 bufsiz1 gcbuf2 bufsiz2 dyntbl lock sid ts =+qpackEncoder gcbuf1 bufsiz1 gcbuf2 bufsiz2 huff dyntbl lock sid ts = withMVar lock $ \_ -> withForeignPtr gcbuf1 $ \buf1 -> withForeignPtr gcbuf2 $ \buf2 -> do@@ -206,7 +210,7 @@ setBasePointToInsersionPoint dyntbl clearRequiredInsertCount dyntbl let tss = splitThrough bufsiz1 ts- his <- mapM (qpackEncodeHeader buf1 bufsiz1 buf2 bufsiz2 dyntbl) tss+ his <- mapM (qpackEncodeHeader buf1 bufsiz1 buf2 bufsiz2 huff dyntbl) tss let (hbs, daiss) = unzip his prefix <- qpackEncodePrefix buf1 bufsiz1 dyntbl let section = BS.concat (prefix : hbs)@@ -224,10 +228,11 @@ -> Int -> GCBuffer -> Int+ -> Bool -> DynamicTable -> MVar () -> QEncoderS-qpackEncoderS gcbuf1 bufsiz1 gcbuf2 bufsiz2 dyntbl lock sid hs =+qpackEncoderS gcbuf1 bufsiz1 gcbuf2 bufsiz2 huff dyntbl lock sid hs = withMVar lock $ \_ -> withForeignPtr gcbuf1 $ \buf1 -> withForeignPtr gcbuf2 $ \buf2 -> do@@ -238,7 +243,7 @@ setBasePointToInsersionPoint dyntbl clearRequiredInsertCount dyntbl let tss = splitThrough bufsiz1 ts- his <- mapM (qpackEncodeHeader buf1 bufsiz1 buf2 bufsiz2 dyntbl) tss+ his <- mapM (qpackEncodeHeader buf1 bufsiz1 buf2 bufsiz2 huff dyntbl) tss let (hbs, daiss) = unzip his prefix <- qpackEncodePrefix buf1 bufsiz1 dyntbl let section = BS.concat (prefix : hbs)@@ -272,13 +277,14 @@ -> BufferSize -> Buffer -> BufferSize+ -> Bool -> DynamicTable -> TokenHeaderList -> IO (ByteString, [AbsoluteIndex])-qpackEncodeHeader buf1 bufsiz1 buf2 bufsiz2 dyntbl ts = do+qpackEncodeHeader buf1 bufsiz1 buf2 bufsiz2 huff dyntbl ts = do wbuf1 <- newWriteBuffer buf1 bufsiz1 wbuf2 <- newWriteBuffer buf2 bufsiz2- dais <- encodeTokenHeader wbuf1 wbuf2 dyntbl ts+ dais <- encodeTokenHeader wbuf1 wbuf2 huff dyntbl ts hb <- toByteString wbuf1 ins <- toByteString wbuf2 when (ins /= "") $ sendIns dyntbl ins@@ -343,6 +349,7 @@ bufsiz1 gcbuf2 bufsiz2+ ecUseHuffman dyntbl lock return enc
Network/QPACK/Error.hs view
@@ -12,7 +12,7 @@ DecoderInstructionError (..), ) where -import Control.Exception+import qualified Control.Exception as E import Network.QUIC @@ -38,6 +38,6 @@ data DecoderInstructionError = DecoderInstructionError deriving (Eq, Show) -instance Exception DecodeError-instance Exception EncoderInstructionError-instance Exception DecoderInstructionError+instance E.Exception DecodeError+instance E.Exception EncoderInstructionError+instance E.Exception DecoderInstructionError
Network/QPACK/HeaderBlock/Encode.hs view
@@ -39,15 +39,16 @@ -- temporally allocated for header block, prefix and encoder instructions. -- If headers are too large, 'BufferOverrun' is thrown. encodeHeader- :: DynamicTable+ :: Bool+ -> DynamicTable -> [Header] -> IO (EncodedFieldSection, EncodedEncoderInstruction)-encodeHeader dyntbl hs = do+encodeHeader huff dyntbl hs = do setBasePointToInsersionPoint dyntbl clearRequiredInsertCount dyntbl (hb0, insb) <- withWriteBuffer' 2048 $ \wbuf1 -> withWriteBuffer 2048 $ \wbuf2 -> do- hs1 <- encodeTokenHeader wbuf1 wbuf2 dyntbl ts+ hs1 <- encodeTokenHeader wbuf1 wbuf2 huff dyntbl ts unless (null hs1) $ E.throwIO BufferOverrun prefix <- withWriteBuffer 32 $ \wbuf -> encodePrefix wbuf dyntbl let hb = prefix `B.append` hb0@@ -63,17 +64,19 @@ -- ^ Workspace for the body of header block -> WriteBuffer -- ^ Workspace for encoder instructions+ -> Bool+ -- ^ Use Huffman encoding or not -> DynamicTable -> TokenHeaderList -> IO [AbsoluteIndex]-encodeTokenHeader wbuf1 wbuf2 dyntbl ts0 = do+encodeTokenHeader wbuf1 wbuf2 huff dyntbl ts0 = do clearWriteBuffer wbuf1 clearWriteBuffer wbuf2 let revidx = getRevIndex dyntbl ready <- isTableReady dyntbl if ready- then encodeLinear wbuf1 wbuf2 dyntbl revidx True ts0- else encodeStatic wbuf1 wbuf2 dyntbl revidx True ts0+ then encodeLinear wbuf1 wbuf2 dyntbl revidx huff ts0+ else encodeStatic wbuf1 wbuf2 dyntbl revidx huff ts0 encodeStatic :: WriteBuffer
http3.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: http3-version: 0.1.3+version: 0.1.4 license: BSD-3-Clause license-file: LICENSE maintainer: Kazu Yamamoto <kazu@iij.ad.jp>@@ -115,7 +115,7 @@ http2, http3, quic,- tls >=2.1.10 && <2.3,+ tls >=2.3.0 && <2.5, tls-session-manager if flag(devel)@@ -142,7 +142,7 @@ http-types, http3, quic,- tls >=2.1.10 && <2.3,+ tls >=2.3.0 && <2.5, unix-time if flag(devel)
test/HTTP3/Error.hs view
@@ -201,7 +201,7 @@ -- [(":method","GET") -- ,(":scheme","https")--- ,(":autority","127.0.0.1")+-- ,(":authority","127.0.0.1") -- ,(":path","/") -- ,(":foo","bar") -- the presence of prohibited fields or pseudo-header fields, -- ]@@ -209,12 +209,12 @@ illegalHeader1 _ = [ H3Frame H3FrameHeaders- "\x00\x00\xd1\xd7\x27\x02\x3a\x61\x75\x74\x6f\x72\x69\x74\x79\x09\x31\x32\x37\x2e\x30\x2e\x30\x2e\x31\xc1\x24\x3a\x66\x6f\x6f\x03\x62\x61\x72"+ "\x00\x00\xd1\xd7\x50\x09\x31\x32\x37\x2e\x30\x2e\x30\x2e\x31\xc1\x24\x3a\x66\x6f\x6f\x03\x62\x61\x72" ] -- [(":method","GET") -- ,(":scheme","https")--- ,(":autority","127.0.0.1")+-- ,(":authority","127.0.0.1") -- ,("foo","bar") -- ,(":path","/") -- pseudo-header fields after fields -- ]@@ -222,7 +222,7 @@ illegalHeader2 _ = [ H3Frame H3FrameHeaders- "\x00\x00\xd1\xd7\x27\x02\x3a\x61\x75\x74\x6f\x72\x69\x74\x79\x09\x31\x32\x37\x2e\x30\x2e\x30\x2e\x31\x23\x66\x6f\x6f\x03\x62\x61\x72\xc1"+ "\x00\x00\xd1\xd7\x50\x09\x31\x32\x37\x2e\x30\x2e\x30\x2e\x31\x23\x66\x6f\x6f\x03\x62\x61\x72\xc1" ] -- [(":method","GET")