Created
February 5, 2015 18:01
-
-
Save davars/a9e40c8e19311e37f771 to your computer and use it in GitHub Desktop.
ModPagespeedPubliclyCacheMismatchedHashesExperimental
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: src/net/instaweb/rewriter/rewrite_context.cc | |
=================================================================== | |
--- src/net/instaweb/rewriter/rewrite_context.cc (revision 4522) | |
+++ src/net/instaweb/rewriter/rewrite_context.cc (working copy) | |
@@ -1020,8 +1020,9 @@ | |
GoogleString output; | |
bool ok = false; | |
ResponseHeaders* response_headers = async_fetch_->response_headers(); | |
- if (success_) { | |
- if (output_resource_->hash() == requested_hash_) { | |
+ if (success_) { | |
+ if (Options()->publicly_cache_mismatched_hashes_experimental() || | |
+ output_resource_->hash() == requested_hash_) { | |
response_headers->CopyFrom(*( | |
output_resource_->response_headers())); | |
// Use the most conservative Cache-Control considering all inputs. | |
@@ -3083,12 +3084,10 @@ | |
} | |
} | |
int64 ttl_ms = min_cache_expiry_time_ms - date_ms; | |
- if (!Options()->publicly_cache_mismatched_hashes_experimental()) { | |
- // Shorten cache length, and prevent proxies caching this, as it's under | |
- // the "wrong" URL. | |
- cache_control_suffix = ",private"; | |
- ttl_ms = std::min(ttl_ms, headers->implicit_cache_ttl_ms()); | |
- } | |
+ // Shorten cache length, and prevent proxies caching this, as it's under | |
+ // the "wrong" URL. | |
+ cache_control_suffix = ",private"; | |
+ ttl_ms = std::min(ttl_ms, headers->implicit_cache_ttl_ms()); | |
headers->SetDateAndCaching(date_ms, ttl_ms, cache_control_suffix); | |
// TODO(jmarantz): Use the actual content-hash to replace the W/"0" etag |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment