| 616 | } |
| 617 | |
| 618 | TSRemapStatus |
| 619 | TSRemapDoRemap(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 | |
| 656 | TSReturnCode |
| 657 | TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf ATS_UNUSED */, int /* errbuf_size ATS_UNUSED */) |
nothing calls this directly
no test coverage detected