on master help sign in
Refactor headerContinue to take a Builder

This allows it to be used for trailers, which will need to avoid inserting status and other headers automatically.

commita94efed9ce36c69585ac67833b77080ef882462c authorAndrew Pritchard <awpr@google.com> dateFri 24 Jul 2015, 23:16 (11 years ago) parent14f99a2
1 file changed+5−3
warp/Network/Wai/Handler/Warp/HTTP2/Sender.hs+5−3
warp/Network/Wai/Handler/Warp/HTTP2/Sender.hs+5−3
@@ -101,7 +101,8 @@ frameSender ctx@Context{outputQ,connectionWindow}
101101 endOfStream = case aux of
102102 Persist{} -> False
103103 Oneshot hb -> not hb
104− len <- headerContinue sid rsp endOfStream
104+ builder <- hpackEncodeHeader ctx ii settings rsp
105+ len <- headerContinue sid builder endOfStream
105106 let total = len + frameHeaderLength
106107 case aux of
107108 Oneshot True -> do -- hasBody
@@ -145,8 +146,9 @@ frameSender ctx@Context{outputQ,connectionWindow}
145146 flushN :: Int -> IO ()
146147 flushN n = bufferIO connWriteBuffer n connSendAll
147148
148− headerContinue sid rsp endOfStream = do
149− builder <- hpackEncodeHeader ctx ii settings rsp
149+ -- Write header and possibly continuation frames into the connection
150+ -- buffer, using the given builder as their contents.
151+ headerContinue sid builder endOfStream = do
150152 (len, signal) <- B.runBuilder builder bufHeaderPayload headerPayloadLim
151153 let flag0 = case signal of
152154 B.Done -> setEndHeader defaultFlags