Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions plugins/experimental/statichit/statichit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,15 @@ TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
return TSREMAP_NO_REMAP;
}

// Anchor to URL specified in remap
int pathsz;
TSUrlPathGet(rri->requestBufp, rri->requestUrl, &pathsz);
if (pathsz > 0) {
VERROR("Path is not an exact match. Rejecting!");
TSHttpTxnStatusSet(rh, TS_HTTP_STATUS_NOT_FOUND);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps add an error message - VERROR("...");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @shukitchan ! Added a VERROR

return TSREMAP_NO_REMAP;
}

if (!cfg->maxAge) {
TSHttpTxnConfigIntSet(rh, TS_CONFIG_HTTP_CACHE_HTTP, 0);
StaticHitSetupIntercept(static_cast<StaticHitConfig *>(ih), rh);
Expand Down Expand Up @@ -631,6 +640,10 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf ATS_UNUSE
return TS_ERROR;
}

if (filePath.find("/") != 0) {
filePath = std::string(TSConfigDirGet()) + '/' + filePath;
}

StaticHitConfig *tc = new StaticHitConfig(filePath, mimeType);
if (maxAge > 0) {
tc->maxAge = maxAge;
Expand Down