on master help sign in
Add Trailers to SFinish and provide them in 'response'
792f3c1Andrew Pritchard
warp/Network/Wai/Handler/Warp/HTTP2/Sender.hs+2−5
@@ -221,10 +221,7 @@ frameSender ctx@Context{outputQ,connectionWindow}
221 let sid = streamNumber strm
221 let sid = streamNumber strm
222 buf = connWriteBuffer `plusPtr` otherLen
222 buf = connWriteBuffer `plusPtr` otherLen
223 total = otherLen + frameHeaderLength + datPayloadLen
223 total = otherLen + frameHeaderLength + datPayloadLen
224− flag = case mnext of
225− CFinish -> setEndStream defaultFlags
226− _ -> defaultFlags
227− fillFrameHeader FrameData datPayloadLen sid flag buf
224+ fillFrameHeader FrameData datPayloadLen sid defaultFlags buf
228 -- "closed" must be before "connSendAll". If not,
225 -- "closed" must be before "connSendAll". If not,
229 -- the context would be switched to the receiver,
226 -- the context would be switched to the receiver,
230 -- resulting the inconsistency of concurrency.
227 -- resulting the inconsistency of concurrency.
@@ -356,7 +353,7 @@ runStreamBuilder buf0 room0 sq = loop buf0 room0 0
356 B.More _ writer -> return (LOne writer, Nothing, total')
353 B.More _ writer -> return (LOne writer, Nothing, total')
357 B.Chunk bs writer -> return (LTwo bs writer, Nothing, total')
354 B.Chunk bs writer -> return (LTwo bs writer, Nothing, total')
358 Just SFlush -> return (LZero, Nothing, total)
355 Just SFlush -> return (LZero, Nothing, total)
359− Just SFinish -> return (LZero, Just [], total)
356+ Just (SFinish trailers) -> return (LZero, Just trailers, total)
360
357
361fillBufStream :: Buffer -> BufSize -> Leftover -> TBQueue Sequence -> TVar Sync -> Stream -> DynaNext
358fillBufStream :: Buffer -> BufSize -> Leftover -> TBQueue Sequence -> TVar Sync -> Stream -> DynaNext
362fillBufStream buf0 siz0 leftover0 sq tvar strm lim0 = do
359fillBufStream buf0 siz0 leftover0 sq tvar strm lim0 = do
warp/Network/Wai/Handler/Warp/HTTP2/Types.hs+1−1
@@ -81,7 +81,7 @@ outputStream _ = error "outputStream"
81
81
82----------------------------------------------------------------
82----------------------------------------------------------------
83
83
84−data Sequence = SFinish
84+data Sequence = SFinish Trailers
85 | SFlush
85 | SFlush
86 | SBuilder Builder
86 | SBuilder Builder
87
87
warp/Network/Wai/Handler/Warp/HTTP2/Worker.hs+1−1
@@ -71,7 +71,7 @@ response Context{outputQ} mgr tconf th strm req rsp = do
71 T.tickle th
71 T.tickle th
72 flush = atomically $ writeTBQueue sq SFlush
72 flush = atomically $ writeTBQueue sq SFlush
73 strmbdy push flush
73 strmbdy push flush
74− atomically $ writeTBQueue sq SFinish
74+ atomically $ writeTBQueue sq $ SFinish []
75 _ -> do
75 _ -> do
76 setThreadContinue tconf True
76 setThreadContinue tconf True
77 let hasBody = requestMethod req /= H.methodHead
77 let hasBody = requestMethod req /= H.methodHead