on master help sign in
Refactor headerContinue to take a Builder
a94efedAndrew Pritchard
warp/Network/Wai/Handler/Warp/HTTP2/Sender.hs+5−3
@@ -101,7 +101,8 @@ frameSender ctx@Context{outputQ,connectionWindow}
101 endOfStream = case aux of
101 endOfStream = case aux of
102 Persist{} -> False
102 Persist{} -> False
103 Oneshot hb -> not hb
103 Oneshot hb -> not hb
104+ builder <- hpackEncodeHeader ctx ii settings rsp
104− len <- headerContinue sid rsp endOfStream
105+ len <- headerContinue sid builder endOfStream
105 let total = len + frameHeaderLength
106 let total = len + frameHeaderLength
106 case aux of
107 case aux of
107 Oneshot True -> do -- hasBody
108 Oneshot True -> do -- hasBody
@@ -145,8 +146,9 @@ frameSender ctx@Context{outputQ,connectionWindow}
145 flushN :: Int -> IO ()
146 flushN :: Int -> IO ()
146 flushN n = bufferIO connWriteBuffer n connSendAll
147 flushN n = bufferIO connWriteBuffer n connSendAll
147
148
149+ -- Write header and possibly continuation frames into the connection
150+ -- buffer, using the given builder as their contents.
148− headerContinue sid rsp endOfStream = do
151+ headerContinue sid builder endOfStream = do
149− builder <- hpackEncodeHeader ctx ii settings rsp
150 (len, signal) <- B.runBuilder builder bufHeaderPayload headerPayloadLim
152 (len, signal) <- B.runBuilder builder bufHeaderPayload headerPayloadLim
151 let flag0 = case signal of
153 let flag0 = case signal of
152 B.Done -> setEndHeader defaultFlags
154 B.Done -> setEndHeader defaultFlags