Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/gold_tests/tls_hooks/tls_hooks18.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
'map https://example.com:{1} http://127.0.0.1:{0}'.format(server.Variables.Port, ts.Variables.ssl_port)
)

Test.PrepareTestPlugin(os.path.join(Test.Variables.AtsTestPluginsDir, 'ssl_hook_test.so'), ts, '-client_hello=2')
Test.PrepareTestPlugin(os.path.join(Test.Variables.AtsTestPluginsDir, 'ssl_hook_test.so'), ts, '-client_hello=2 -close=1')

tr = Test.AddTestRun("Test two client hello hooks")
tr.Processes.Default.StartBefore(server)
Expand Down
14 changes: 14 additions & 0 deletions tests/tools/plugins/ssl_hook_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,16 @@
#define PN "ssl_hook_test"
#define PCP "[" PN " Plugin] "

static bool was_conn_closed;

int
ReenableSSL(TSCont cont, TSEvent event, void *edata)
{
if (was_conn_closed) {
TSContDestroy(cont);
return TS_SUCCESS;
}

TSVConn ssl_vc = reinterpret_cast<TSVConn>(TSContDataGet(cont));
TSDebug(PN, "Callback reenable ssl_vc=%p", ssl_vc);
TSVConnReenable(ssl_vc);
Expand Down Expand Up @@ -73,6 +80,7 @@ CB_Pre_Accept_Delay(TSCont cont, TSEvent event, void *edata)
TSContDataSet(cb, ssl_vc);

// Schedule to reenable in a bit
was_conn_closed = false;
TSContScheduleOnPool(cb, 2000, TS_THREAD_POOL_NET);

return TS_SUCCESS;
Expand Down Expand Up @@ -108,6 +116,7 @@ CB_out_start_delay(TSCont cont, TSEvent event, void *edata)
TSContDataSet(cb, ssl_vc);

// Schedule to reenable in a bit
was_conn_closed = false;
TSContScheduleOnPool(cb, 2000, TS_THREAD_POOL_NET);

return TS_SUCCESS;
Expand All @@ -124,6 +133,9 @@ CB_close(TSCont cont, TSEvent event, void *edata)

// All done, reactivate things
TSVConnReenable(ssl_vc);

was_conn_closed = true;

return TS_SUCCESS;
}

Expand Down Expand Up @@ -169,6 +181,7 @@ CB_Client_Hello(TSCont cont, TSEvent event, void *edata)
TSContDataSet(cb, ssl_vc);

// Schedule to reenable in a bit
was_conn_closed = false;
TSContScheduleOnPool(cb, 2000, TS_THREAD_POOL_NET);

return TS_SUCCESS;
Expand Down Expand Up @@ -215,6 +228,7 @@ CB_Cert(TSCont cont, TSEvent event, void *edata)
TSContDataSet(cb, ssl_vc);

// Schedule to reenable in a bit
was_conn_closed = false;
TSContScheduleOnPool(cb, 2000, TS_THREAD_POOL_NET);

return TS_SUCCESS;
Expand Down