I've been messing around with HTTP over the past few days by building a simple CL download manager in Rust using the reqwest crate to handle the HTTP stuff. I've got a basic understanding of how the protocol works - what headers to look for when downloading a file, how to verify the request has worked etc. - but I'm having trouble finding an answer as to where the actual bytes in the body of a HTTP response are stored.
For example, sending a request and getting a response with reqwest takes very little time, so I figure that the downloading can't happen at this stage. What actually takes time is reading the bytes from the body. But surely this body can't be stored in RAM, as downloading a large file would make memory use skyrocket. I realise that where this data is stored may be different across different HTTP frameworks, but I suppose that what I'm after is a more general explanation of where a large HTTP response body is stored when not using a browser to download a file.
self
(including headers and status code). There is no fundamental reason why it should not be possible to get request headers/status code after having read body. Reading body can only be done once, of course, but it could just borrow headers it needs to read the body, instead of consuming them entirely. – Polyhydroxy