From 30648e84ce9c2515994b95b9d1e2e870283ed214 Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Mon, 20 Jul 2020 20:37:20 -0600 Subject: Fix secure websocket users not being seen as secure. Since a TLS (SSL) module will always be the last IOHook attached to a socket, IsSSL() needs to ignore any Middle IOHooks that may also be attached. --- include/modules/ssl.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include/modules') diff --git a/include/modules/ssl.h b/include/modules/ssl.h index 2227c4b13..ac2e367fd 100644 --- a/include/modules/ssl.h +++ b/include/modules/ssl.h @@ -186,9 +186,10 @@ class SSLIOHook : public IOHook public: static SSLIOHook* IsSSL(StreamSocket* sock) { - IOHook* const iohook = sock->GetIOHook(); - if ((iohook) && ((iohook->prov->type == IOHookProvider::IOH_SSL))) - return static_cast(iohook); + IOHook* const lasthook = sock->GetLastHook(); + if (lasthook && (lasthook->prov->type == IOHookProvider::IOH_SSL)) + return static_cast(lasthook); + return NULL; } -- cgit v1.3.1-10-gc9f91