http2
http2 copied to clipboard
`getRequestBodyChunk` should indicate if a chunk is the last one
For streaming calls, clients have two ways of indicating end-of-input to the sever:
NON-EMPTY DATA FRAME 1 <not marked as end-of-stream>
NON-EMPTY DATA FRAME 2 <not marked as end-of-stream>
NON-EMPTY DATA FRAME 3 <marked as end-of-stream>
and
NON-EMPTY DATA FRAME 1 <not marked as end-of-stream>
NON-EMPTY DATA FRAME 2 <not marked as end-of-stream>
NON-EMPTY DATA FRAME 3 <not marked as end-of-stream>
EMPTY DATA FRAME 4 <marked as end-of-stream>
getRequestBodyChunk
does not allow servers to differentiate between these two cases; in both cases, we will first get a non-empty bytestring indicating the last piece of data, and then the next call to getRequestBodyChunk
will return an empty bytestring. Calling getRequestBodyChunk
again to figure out after-the-fact if the previously received bytestring was the final one is not an option, because that call may block. We therefore need a generalization that doesn't just give us a bytestring, but also tells us if that bytestring was marked being the last one.
For an example of where this matters, see https://github.com/well-typed/grapesy/issues/114 .