diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2018-11-07 17:35:46 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2018-11-07 17:36:18 +0000 |
commit | 738abc1de7e5905d3b323f1ddb3938754024c844 (patch) | |
tree | 9f2d8ba0eb6e50a1b36b06336f0b75ff16c454fb /net/Socket.cpp | |
parent | Avoid synchronous re-layout of comments / red-lines on each modification. (diff) | |
download | online-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.cpp | 12 |
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: */ |