![]() | |
![]() |
| | Thread Tools | Display Modes |
#31
| |||||||
| |||||||
|
|
John L. wrote: I highly recommend learning PHP, even if you only learn the basics, as even a little bit of server-side scripting can go a long way. |
|
But for static pages for which server side scripting would be used for maintainance purposes, they've tradeoffs: |
|
1) HTTP cache control. For example, conditional GET operations will always think that documents have been changed and reload them. The HTTP cache control mechanism is really subtle. A large part of RFC-2616 deals with it. Dynamic pages break that. |
|
2) Typically, the server don't send a compressed stream for dynamic resources even if the user agent declares a Accept-Encoding header including gzip, compress or other compression algorithms. Compression can reduce by 3 or 4 the file size! Both the server and client benefit from this! |
|
3) HTTP 1.1 partial downloading is very unlikely to work with dynamic content. This does matter for big files only. Below 400 kilobytes, it's not very important. |
|
4) The Content-Length attribute won't be specified, though it can help the user agent. e.g. User agents use it to display a progress bar and automatically, or with user help, they may choose to stop downloading the resource if it's too large or to use an alternative download manager. Actually, the HEAD method looses of its usefulness if the Content-Length attribute disappears. |
|
Other minor detail: The Content-MD5 won't be provided while it could be useful on unreliable connections. |
#32
| |||||||
| |||||||
|
|
On the other hand, it is possible to use server-side scripting and make the pages *look* static to the end user, which is obviously worthwhile for those pages that need to be dynamic but aren't inherently uncacheable. snip With Apache 2.2 and CGI setting a Last-Modified header in the CGI script is sufficient to get proper 304 responses on If-Modified-Since. |
|
You also get arguably easier control over Cache-Control with server-side scripting than with .htaccess. |
|
2) Typically, the server don't send a compressed stream for dynamic resources even if the user agent declares a Accept-Encoding header including gzip, compress or other compression algorithms. Compression can reduce by 3 or 4 the file size! Both the server and client benefit from this! Again, Apache 2.2 and CGI works fine with Accept-Encoding: gzip at least. I've not tested the others. |
|
3) HTTP 1.1 partial downloading is very unlikely to work with dynamic content. This does matter for big files only. Below 400 kilobytes, it's not very important. If a web page is above 400kb it could probably do with splitting anyway! |
|
Actually, the HEAD method looses of its usefulness if the Content-Length attribute disappears. There's nothing to stop server-side scripts from doing: page = generateContentsOfPage(); setResponseHeader("Content-Length",length(page)); print(page); |
|
Whether that's a sensible way to do things depends on the language. In the scripting languages that encourage interleaving of code and HTML tags (<?php ?>, <% %>, etc) it's probably fighting the paradigm too much. |
|
Other minor detail: The Content-MD5 won't be provided while it could be useful on unreliable connections. I don't see this header even on static files. Maybe I just haven't enabled it in the Apache config, though. Yes, there's the ContentDigest directive. |
![]() |
| Thread Tools | |
| Display Modes | |
| |