summaryrefslogtreecommitdiffstats
path: root/auth_mellon_util.c
diff options
context:
space:
mode:
authormanu@netbsd.org <manu@netbsd.org@a716ebb1-153a-0410-b759-cfb97c6a1b53>2009-08-11 13:19:21 +0000
committermanu@netbsd.org <manu@netbsd.org@a716ebb1-153a-0410-b759-cfb97c6a1b53>2009-08-11 13:19:21 +0000
commit4055392f81e2dc3fb568e16364b598ff07b985f2 (patch)
tree038ce2efcb7103863f20e4db871e96552f297076 /auth_mellon_util.c
parent6de95e8bd59caea283224155b8f43c5cf06a4417 (diff)
downloadmod_auth_mellon-4055392f81e2dc3fb568e16364b598ff07b985f2.tar.gz
mod_auth_mellon-4055392f81e2dc3fb568e16364b598ff07b985f2.tar.xz
mod_auth_mellon-4055392f81e2dc3fb568e16364b598ff07b985f2.zip
Do not ever send Cache-Control: no-cahche to IE, as it breaks file
downloads. git-svn-id: https://modmellon.googlecode.com/svn/trunk@65 a716ebb1-153a-0410-b759-cfb97c6a1b53
Diffstat (limited to 'auth_mellon_util.c')
-rw-r--r--auth_mellon_util.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/auth_mellon_util.c b/auth_mellon_util.c
index 11e1989..8f4e3bb 100644
--- a/auth_mellon_util.c
+++ b/auth_mellon_util.c
@@ -125,15 +125,32 @@ int am_check_permissions(request_rec *r, am_cache_entry_t *session)
*/
void am_set_nocache(request_rec *r)
{
+ const char *user_agent;
+
/* We set headers in both r->headers_out and r->err_headers_out, so that
* we can be sure that they will be included.
*/
-
- apr_table_setn(r->headers_out, "Cache-Control", "no-cache");
- apr_table_setn(r->err_headers_out, "Cache-Control", "no-cache");
-
- apr_table_setn(r->headers_out, "Pragma", "no-cache");
- apr_table_setn(r->err_headers_out, "Pragma", "no-cache");
+ apr_table_setn(r->headers_out,
+ "Expires", "Thu, 01 Jan 1970 00:00:00 GMT");
+ apr_table_setn(r->headers_out,
+ "Cache-Control", "private, must-revalidate");
+ apr_table_setn(r->err_headers_out,
+ "Expires", "Thu, 01 Jan 1970 00:00:00 GMT");
+ apr_table_setn(r->err_headers_out,
+ "Cache-Control", "private, must-revalidate");
+
+ /*
+ * Never use Cache-Control: no-cache for IE
+ */
+ user_agent = apr_table_get(r->headers_in, "User-Agent");
+ if ((user_agent == NULL) ||
+ (strstr(user_agent, "compatible; MSIE ") == NULL) ||
+ (strstr(user_agent, "Opera") != NULL)) {
+ apr_table_addn(r->headers_out,
+ "Cache-Control", "no-cache, no-store");
+ apr_table_addn(r->err_headers_out,
+ "Cache-Control", "no-cache, no-store");
+ }
}