Hi - using php as a wrapper to serve some static content that needs to be cache friendly.
Part of that means generating Etag header and evaluation when a client sends a If-None-Match header to validate a cached copy that has out-lived its max-age.
Problem is - and I believe it is largely due to proxies that may be caching for multiple clients - the Etag header is not suppose to be the same with different negotiated Content-Encoding schemes.
So if client A accepts gzip and the content is sent gzip - it should get a different Etag than client B that does not accept gzip and gets it sent with deflate instead.
Based on the Accept-Encoding header and my server configuration I can accurately guess what the Content-Encoding header will be for *my* server but I can not extend that to other servers that may be configured different (or even not offer any compression during transit)
Is there a reliable way with php to determine what (if anything) php is going to use for the Content-Encoding header when it actually sends content?
headers_list() only works with displaying value of Content-Encoding after the headers are sent and it is too late to act. Before headers are sent, it does not show what the Content-Encoding header will be.
Right now I'm just assuming if client accepts gzip it will be gzip, else if it accept deflate it will deflate, else none will be used.
That assumption is probably good and valid whenever zlib compression is enabled, but it may not be valid with other scenarios.
Thanks for suggestions.
Part of that means generating Etag header and evaluation when a client sends a If-None-Match header to validate a cached copy that has out-lived its max-age.
Problem is - and I believe it is largely due to proxies that may be caching for multiple clients - the Etag header is not suppose to be the same with different negotiated Content-Encoding schemes.
So if client A accepts gzip and the content is sent gzip - it should get a different Etag than client B that does not accept gzip and gets it sent with deflate instead.
Based on the Accept-Encoding header and my server configuration I can accurately guess what the Content-Encoding header will be for *my* server but I can not extend that to other servers that may be configured different (or even not offer any compression during transit)
Is there a reliable way with php to determine what (if anything) php is going to use for the Content-Encoding header when it actually sends content?
headers_list() only works with displaying value of Content-Encoding after the headers are sent and it is too late to act. Before headers are sent, it does not show what the Content-Encoding header will be.
Right now I'm just assuming if client accepts gzip it will be gzip, else if it accept deflate it will deflate, else none will be used.
That assumption is probably good and valid whenever zlib compression is enabled, but it may not be valid with other scenarios.
Thanks for suggestions.