Handle events that occur on the TSHttpTxn.
| 513 | |
| 514 | // Handle events that occur on the TSHttpTxn. |
| 515 | static int |
| 516 | InterceptTxnHook(TSCont contp, TSEvent event, void *edata) |
| 517 | { |
| 518 | argument_type arg(edata); |
| 519 | |
| 520 | VDEBUG("contp=%p, event=%s (%d), edata=%p", contp, TSHttpEventNameLookup(event), event, arg.ptr); |
| 521 | |
| 522 | switch (event) { |
| 523 | case TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE: { |
| 524 | if (InterceptShouldInterceptRequest(arg.txn)) { |
| 525 | TSCont c = InterceptContCreate(InterceptInterceptHook, TSMutexCreate(), arg.txn); |
| 526 | |
| 527 | VDEBUG("intercepting origin server request for txn=%p, cont=%p", arg.txn, c); |
| 528 | TSHttpTxnServerIntercept(c, arg.txn); |
| 529 | } |
| 530 | |
| 531 | break; |
| 532 | } |
| 533 | |
| 534 | default: |
| 535 | VERROR("unexpected event %s (%d)", TSHttpEventNameLookup(event), event); |
| 536 | break; |
| 537 | } |
| 538 | |
| 539 | TSHttpTxnReenable(arg.txn, TS_EVENT_HTTP_CONTINUE); |
| 540 | return TS_EVENT_NONE; |
| 541 | } |
| 542 | |
| 543 | void |
| 544 | TSPluginInit(int /* argc */, const char * /* argv */[]) |
nothing calls this directly
no test coverage detected