MCPcopy Create free account
hub / github.com/apache/trafficserver / TSRemapDoRemap

Function TSRemapDoRemap

plugins/statichit/statichit.cc:618–654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

616}
617
618TSRemapStatus
619TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
620{
621 const TSHttpStatus txnstat = TSHttpTxnStatusGet(rh);
622 if (txnstat != TS_HTTP_STATUS_NONE && txnstat != TS_HTTP_STATUS_OK) {
623 VDEBUG("transaction status_code=%d already set; skipping processing", static_cast<int>(txnstat));
624 return TSREMAP_NO_REMAP;
625 }
626
627 StaticHitConfig *cfg = static_cast<StaticHitConfig *>(ih);
628
629 if (!cfg) {
630 VERROR("No remap context available, check code / config");
631 TSHttpTxnStatusSet(rh, TS_HTTP_STATUS_INTERNAL_SERVER_ERROR);
632 return TSREMAP_NO_REMAP;
633 }
634
635 if (!cfg->disableExact) {
636 // Anchor to URL specified in remap
637 int pathsz;
638 TSUrlPathGet(rri->requestBufp, rri->requestUrl, &pathsz);
639 if (pathsz > 0) {
640 VDEBUG("Path is not an exact match. Rejecting!");
641 TSHttpTxnStatusSet(rh, TS_HTTP_STATUS_NOT_FOUND);
642 return TSREMAP_NO_REMAP;
643 }
644 }
645
646 if (!cfg->maxAge) {
647 TSHttpTxnConfigIntSet(rh, TS_CONFIG_HTTP_CACHE_HTTP, 0);
648 StaticHitSetupIntercept(static_cast<StaticHitConfig *>(ih), rh);
649 } else {
650 TSHttpTxnHookAdd(rh, TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK, static_cast<StaticHitConfig *>(ih)->cont);
651 }
652
653 return TSREMAP_NO_REMAP; // This plugin never rewrites anything.
654}
655
656TSReturnCode
657TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf ATS_UNUSED */, int /* errbuf_size ATS_UNUSED */)

Callers

nothing calls this directly

Calls 6

TSHttpTxnStatusGetFunction · 0.85
TSHttpTxnStatusSetFunction · 0.85
TSUrlPathGetFunction · 0.85
TSHttpTxnConfigIntSetFunction · 0.85
StaticHitSetupInterceptFunction · 0.85
TSHttpTxnHookAddFunction · 0.85

Tested by

no test coverage detected