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

Function InterceptTxnHook

example/plugins/c-api/intercept/intercept.cc:515–541  ·  view source on GitHub ↗

Handle events that occur on the TSHttpTxn.

Source from the content-addressed store, hash-verified

513
514// Handle events that occur on the TSHttpTxn.
515static int
516InterceptTxnHook(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
543void
544TSPluginInit(int /* argc */, const char * /* argv */[])

Callers

nothing calls this directly

Calls 6

TSHttpEventNameLookupFunction · 0.85
InterceptContCreateFunction · 0.85
TSMutexCreateFunction · 0.85
TSHttpTxnServerInterceptFunction · 0.85
TSHttpTxnReenableFunction · 0.85

Tested by

no test coverage detected