http-extensions icon indicating copy to clipboard operation
http-extensions copied to clipboard

Speak about considerations of byte counting and transfer-encoding

Open LPardue opened this issue 1 year ago • 3 comments

Ted Hardie asked:

How does the upload offset calculation interact with transfer encoding/compression? I'm reporting how many bytes came through the network, is that right?

We probably would benefit from some consideration text to mention how HTTP/1.1 transfer-encoding might be a footgun if the server counted those bytes naiively.

LPardue avatar Nov 10 '23 12:11 LPardue

I agree, we should clarify this. I was also confused about the exact behavior until you helped me clear it up. Is the following summary correct?

  • From a client's perspective, the offset is counted after Content-Encoding is applied but before Transfer-Encoding is applied.
  • From a server's perspective, the offset is counted after the message is decoded using Transfer-Encoding but before decoding using Content-Encoding.

Acconut avatar Nov 23 '23 14:11 Acconut

To add to Marius' list above: Can the server do anything about a request where only part of a message with transfer-encoding arrives? E.g. a partial message with transfer-encoding: gzip might not be possible to decode.

smatsson avatar Nov 30 '23 15:11 smatsson

HTTP/1.1 Transfer-Encoding is a hop-by-hop header at an HTTP protocol layer and should be ignored by application frameworks such as resumable upload.

gstrauss avatar Dec 03 '23 23:12 gstrauss