Permalink
Browse files

handle pagespeed off w/o file cache path set

fixes issues reported in ngx_pagespeed
apache/incubator-pagespeed-ngx#956
  • Loading branch information...
crowell committed May 6, 2015
1 parent 1fd007a commit c925b48400af18abaf73fb86dd723642efb29112
Showing with 15 additions and 3 deletions.
  1. +15 −3 net/instaweb/system/system_cache_path.cc
@@ -205,11 +205,23 @@ void SystemCachePath::ChildInit(SlowWorker* cache_clean_worker) {
// Implementations must ensure the file cache path is an absolute path.
// mod_pagespeed checks in mod_instaweb.cc:pagespeed_post_config while
// ngx_pagespeed checks in ngx_pagespeed.cc:ps_merge_srv_conf.
// There is at least one example where this check is violated in
// ngx_pagespeed. Example:
// server {
// pagespeed off;
// pagespeed FileCachePath "/tmp";
// location / {
// pagespeed on;
// }
// }
//
// Fixing this would require knowing if pagespeed is ever switched on within
// a deeper level of the block. When this is parsed, we just have knowledge
// of the higher-level server block.
StringPiece path(options_->file_cache_path());
DCHECK(path.starts_with("/"));
cache_flush_filename = StrCat(
path,
path.ends_with("/") ? "" : "/",
path, (path.size() > 0 &&
path.ends_with("/")) ? "" : "/",
cache_flush_filename);
}

0 comments on commit c925b48

Please sign in to comment.