summaryrefslogtreecommitdiffstats
path: root/net/Socket.cpp
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2018-11-07 17:35:46 +0000
committerMichael Meeks <michael.meeks@collabora.com>2018-11-07 17:36:18 +0000
commit738abc1de7e5905d3b323f1ddb3938754024c844 (patch)
tree9f2d8ba0eb6e50a1b36b06336f0b75ff16c454fb /net/Socket.cpp
parentAvoid synchronous re-layout of comments / red-lines on each modification. (diff)
downloadonline-738abc1de7e5905d3b323f1ddb3938754024c844.tar.gz
online-738abc1de7e5905d3b323f1ddb3938754024c844.zip
Respond to SSL/TLS over http - when we don't expect it.
Change-Id: I48c7607cd4e1416fb4ac28c552c2cd96b51d60a6
Diffstat (limited to 'net/Socket.cpp')
-rw-r--r--net/Socket.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/Socket.cpp b/net/Socket.cpp
index 208efc3c9c..44f5d18a40 100644
--- a/net/Socket.cpp
+++ b/net/Socket.cpp
@@ -607,6 +607,18 @@ namespace HttpHelper
}
}
+bool StreamSocket::sniffSSL() const
+{
+ // Only sniffing the first bytes of a sockte.
+ if (_bytesSent > 0 || _bytesRecvd != _inBuffer.size() || _bytesRecvd < 6)
+ return false;
+
+ // 0x0000 16 03 01 02 00 01 00 01
+ return (_inBuffer[0] == 0x16 && // HANDSHAKE
+ _inBuffer[1] == 0x03 && // SSL 3.0 / TLS 1.x
+ _inBuffer[5] == 0x01); // Handshake: CLIENT_HELLO
+}
+
#endif // !MOBILEAPP
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */