| 685 | } |
| 686 | |
| 687 | static int |
| 688 | AuthProxyGlobalHook(TSCont /* cont ATS_UNUSED */, TSEvent event, void *edata) |
| 689 | { |
| 690 | TSHttpTxn txn = static_cast<TSHttpTxn>(edata); |
| 691 | |
| 692 | AuthLogDebug("handling event=%d edata=%p", (int)event, edata); |
| 693 | |
| 694 | switch (event) { |
| 695 | case TS_EVENT_HTTP_POST_REMAP: |
| 696 | // Ignore internal requests since we generated them. |
| 697 | if (TSHttpTxnIsInternal(txn)) { |
| 698 | // All our internal requests *must* hit the origin since it is the |
| 699 | // agent that needs to make the authorization decision. We can't |
| 700 | // allow that to be cached. Note that this only affects the remap |
| 701 | // rule that this plugin is instantiated for, *unless* you are using |
| 702 | // it as a global plugin (not highly recommended). Also remember that |
| 703 | // the HEAD auth request might trip a different remap rule, particularly |
| 704 | // if you do not have pristine host-headers enabled. |
| 705 | if (!CacheInternalRequests(txn)) |
| 706 | TSHttpTxnConfigIntSet(txn, TS_CONFIG_HTTP_CACHE_HTTP, 0); |
| 707 | AuthLogDebug("re-enabling internal transaction"); |
| 708 | TSHttpTxnReenable(txn, TS_EVENT_HTTP_CONTINUE); |
| 709 | return TS_EVENT_NONE; |
| 710 | } |
| 711 | // Hook this request if we are in global authorization mode or if a |
| 712 | // remap rule tagged it. |
| 713 | if (AuthGlobalOptions != nullptr || AuthRequestIsTagged(txn)) { |
| 714 | AuthRequestContext *auth = AuthRequestContext::allocate(); |
| 715 | auth->state = StateTableInit; |
| 716 | auth->txn = txn; |
| 717 | return AuthRequestContext::dispatch(auth->cont, event, edata); |
| 718 | } |
| 719 | // fallthrough |
| 720 | |
| 721 | default: |
| 722 | return TS_EVENT_NONE; |
| 723 | } |
| 724 | } |
| 725 | |
| 726 | static AuthOptions * |
| 727 | AuthParseOptions(int argc, const char **argv) |
nothing calls this directly
no test coverage detected