How does a web server/the http protocol handle version control and compression?

Posted by Sune Rasmussen on Server Fault See other posts from Server Fault or by Sune Rasmussen
Published on 2010-05-10T00:13:42Z Indexed on 2010/05/10 0:19 UTC
Read the original article Hit count: 648

When a client browser requests a file from the web server, I know that some kind of check is performed, because the files needed to serve the web page may already be cached by the web browser. So, if a file exists in the cache, no files are sent. But if the file on the server has changed since the file was cached in the browser, the file is sent and updated anyhow.

Then, if you have compression like gzipping enabled on the server, the files that are to be provided to the client must be gzipped on the way, requiring some amount of server side processing.

But how is this managed? The logical approach seems to me, that the web server should have a cache as well, containing the newest version of all files that have been requested within a certain time span, thus a compressed version of these files, so that compression would not have to be done each time a files is requested.

And also, how are files eventually requested? Does the browser ask for files, each time it encounters one in the HTML code and the specific file is not stored in the local cache, or does it sum all the files that are needed up and ask for the whole bunch at the same time?

But that's only guessing from a programming point of view, and I don't really know.

If the answers are very different among web server systems, I'm primarily interested in Apache, but other answers are appreciated, too.

© Server Fault or respective owner

Related posts about gzip

Related posts about webserver