summaryrefslogtreecommitdiff
path: root/include/modules/ssl.h
diff options
context:
space:
mode:
authorMatt Schatz <genius3000@g3k.solutions>2020-07-20 20:37:20 -0600
committerSadie Powell <sadie@witchery.services>2020-07-27 09:38:11 +0100
commit30648e84ce9c2515994b95b9d1e2e870283ed214 (patch)
tree19012b55331f7725d1bca1c683fab1bae245e139 /include/modules/ssl.h
parentc2218abac11a2ddaff197f93721818efdcc9ae01 (diff)
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.
Diffstat (limited to 'include/modules/ssl.h')
-rw-r--r--include/modules/ssl.h7
1 files changed, 4 insertions, 3 deletions
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<SSLIOHook*>(iohook);
+ IOHook* const lasthook = sock->GetLastHook();
+ if (lasthook && (lasthook->prov->type == IOHookProvider::IOH_SSL))
+ return static_cast<SSLIOHook*>(lasthook);
+
return NULL;
}