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

Function server_push_plugin

example/plugins/c-api/server_push/server_push.cc:67–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67static int
68server_push_plugin(TSCont contp, TSEvent event, void *edata)
69{
70 TSHttpSsn ssnp;
71 TSHttpTxn txnp;
72
73 switch (event) {
74 case TS_EVENT_HTTP_SSN_START:
75 ssnp = static_cast<TSHttpSsn>(edata);
76 TSHttpSsnHookAdd(ssnp, TS_HTTP_TXN_START_HOOK, contp);
77 TSHttpSsnReenable(ssnp, TS_EVENT_HTTP_CONTINUE);
78 break;
79 case TS_EVENT_HTTP_TXN_START:
80 txnp = static_cast<TSHttpTxn>(edata);
81 TSHttpTxnHookAdd(txnp, TS_HTTP_READ_REQUEST_HDR_HOOK, contp);
82 TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
83 break;
84 case TS_EVENT_HTTP_READ_REQUEST_HDR:
85 txnp = static_cast<TSHttpTxn>(edata);
86 if (should_push(txnp)) {
87 TSHttpTxnServerPush(txnp, url, strlen(url));
88 }
89 TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
90 break;
91 default:
92 break;
93 }
94
95 return 0;
96}
97
98void
99TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)

Callers

nothing calls this directly

Calls 6

TSHttpSsnHookAddFunction · 0.85
TSHttpSsnReenableFunction · 0.85
TSHttpTxnHookAddFunction · 0.85
TSHttpTxnReenableFunction · 0.85
should_pushFunction · 0.85
TSHttpTxnServerPushFunction · 0.85

Tested by

no test coverage detected