Setting a Global Hook¶
Global hooks are always added in
TSHttpHookAdd. The two arguments of
TSHttpHookAdd are the hook
ID and the continuation to call when processing the event corresponding
to the hook. In
denylist_1.c, the global hook is added as follows:
TSHttpHookAdd (TS_HTTP_OS_DNS_HOOK, contp);
TS_HTTP_OS_DNS_HOOK is the ID for the origin server DNS
lookup hook and
contp is the parent continuation created earlier.
This means that the Denylist plugin is called at every origin server
DNS lookup. When it is called, the handler functio
TS_EVENT_HTTP_OS_DNS and calls
handle_dns to see if the
request is forbidden.