3 ms·
It would be nice if the browser knew how big the gifs were before it downloaded them, and thus didn't download anything over a certain size.
by WWLink 6y ago
It would be nice if the browser knew how big the gifs were before it downloaded them, and thus didn't download anything over a certain size.
- edoceo 6y agoIsn't the size in the header? (Which yea, could be faked, or sent as Chunked) the USER-agent could just make a cap, and stop after 1mb when image/gif media type
- brabel 6y agoHTTP allows the body length to be specified in the header before the body is downloaded via the `Content-Length` header. It also allows you to stream the body in chunks by setting the `Transfer-Encoding` header to `chunked`, as you've mentioned, in which case each chunk starts with its own length. In both cases, the length cannot be faked because the recipient will stop pulling bytes after the specified length, as that's the purpose of sending such length (after there's no more bytes according to the latest length, the connection is free to be used for a subsequent response)!