Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Commit ed5ed3d

Browse files
committed
LoadFromFileCacheTtlMs is not honored (*after* first request)
Not ready to go in yet, needs more verification of code paths. Fixes apache/incubator-pagespeed-ngx#1418
1 parent a41cdab commit ed5ed3d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

net/instaweb/rewriter/in_place_rewrite_context.cc

+12-1
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,19 @@ void InPlaceRewriteContext::FixFetchFallbackHeaders(
398398
headers->Replace(HttpAttributes::kEtag, HTTPCache::FormatEtag(StrCat(
399399
id(), "-", rewritten_hash_)));
400400
}
401+
402+
// Determine if we need to use the implicit cache ttl ms or the implicit
403+
// load from file cache ttl ms.
404+
int64 implicit_ttl = Options()->implicit_cache_ttl_ms();
405+
if (num_slots() == 1) {
406+
ResourcePtr resource(slot(0)->resource());
407+
if (!resource->UseHttpCache()) {
408+
implicit_ttl = Options()->load_from_file_cache_ttl_ms();
409+
}
410+
}
411+
401412
headers->RemoveAll(HttpAttributes::kLastModified);
402-
headers->set_implicit_cache_ttl_ms(Options()->implicit_cache_ttl_ms());
413+
headers->set_implicit_cache_ttl_ms(implicit_ttl);
403414
headers->ComputeCaching();
404415
int64 expire_at_ms = kint64max;
405416
int64 date_ms = kint64max;

0 commit comments

Comments
 (0)