zeroc-ice 3.8.1 → 3.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/dist/IceRuby/Communicator.cpp +26 -9
- data/dist/IceRuby/Config.h +0 -12
- data/dist/IceRuby/Connection.cpp +18 -9
- data/dist/IceRuby/DefaultSliceLoader.h +1 -1
- data/dist/IceRuby/Endpoint.cpp +21 -8
- data/dist/IceRuby/Operation.cpp +29 -11
- data/dist/IceRuby/Properties.cpp +3 -4
- data/dist/IceRuby/Proxy.cpp +11 -19
- data/dist/IceRuby/RubySliceLoader.cpp +1 -1
- data/dist/IceRuby/RubySliceLoader.h +6 -0
- data/dist/IceRuby/Types.cpp +162 -138
- data/dist/IceRuby/Types.h +68 -28
- data/dist/IceRuby/Util.cpp +14 -78
- data/dist/IceRuby/Util.h +7 -17
- data/dist/ice/cpp/include/Ice/Communicator.h +31 -8
- data/dist/ice/cpp/include/Ice/Config.h +2 -2
- data/dist/ice/cpp/include/Ice/Connection.h +24 -8
- data/dist/ice/cpp/include/Ice/CtrlCHandler.h +1 -1
- data/dist/ice/cpp/include/Ice/Demangle.h +1 -1
- data/dist/ice/cpp/include/Ice/Endpoint.h +4 -4
- data/dist/ice/cpp/include/Ice/Initialize.h +4 -4
- data/dist/ice/cpp/include/Ice/InputStream.h +5 -5
- data/dist/ice/cpp/include/Ice/Instrumentation.h +13 -7
- data/dist/ice/cpp/include/Ice/LocalExceptions.h +26 -5
- data/dist/ice/cpp/include/Ice/Logger.h +7 -0
- data/dist/ice/cpp/include/Ice/LoggerUtil.h +1 -1
- data/dist/ice/cpp/include/Ice/Object.h +10 -8
- data/dist/ice/cpp/include/Ice/ObjectAdapter.h +1 -1
- data/dist/ice/cpp/include/Ice/OutgoingAsync.h +5 -2
- data/dist/ice/cpp/include/Ice/OutgoingResponse.h +2 -1
- data/dist/ice/cpp/include/Ice/OutputStream.h +14 -11
- data/dist/ice/cpp/include/Ice/PluginFactory.h +1 -1
- data/dist/ice/cpp/include/Ice/Properties.h +3 -3
- data/dist/ice/cpp/include/Ice/Proxy.h +192 -50
- data/dist/ice/cpp/include/Ice/SSL/ClientAuthenticationOptions.h +3 -3
- data/dist/ice/cpp/include/Ice/SSL/EndpointInfo.h +1 -1
- data/dist/ice/cpp/include/Ice/SSL/ServerAuthenticationOptions.h +5 -5
- data/dist/ice/cpp/include/Ice/ServantLocator.h +1 -1
- data/dist/ice/cpp/include/Ice/Service.h +2 -5
- data/dist/ice/cpp/include/Ice/SliceLoader.h +1 -1
- data/dist/ice/cpp/include/Ice/SlicedData.h +5 -3
- data/dist/ice/cpp/include/Ice/StreamHelpers.h +1 -1
- data/dist/ice/cpp/include/Ice/StreamableTraits.h +2 -2
- data/dist/ice/cpp/include/Ice/StringConverter.h +2 -3
- data/dist/ice/cpp/include/Ice/StringUtil.h +2 -7
- data/dist/ice/cpp/include/Ice/UUID.h +1 -0
- data/dist/ice/cpp/include/Ice/Value.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/BuiltinSequences.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/Context.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/EndpointTypes.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/Identity.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/Locator.h +57 -23
- data/dist/ice/cpp/include/generated/Ice/LocatorRegistry.h +38 -11
- data/dist/ice/cpp/include/generated/Ice/Metrics.h +99 -44
- data/dist/ice/cpp/include/generated/Ice/OperationMode.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/Process.h +34 -8
- data/dist/ice/cpp/include/generated/Ice/PropertiesAdmin.h +42 -11
- data/dist/ice/cpp/include/generated/Ice/PropertyDict.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/RemoteLogger.h +93 -40
- data/dist/ice/cpp/include/generated/Ice/ReplyStatus.h +8 -4
- data/dist/ice/cpp/include/generated/Ice/Router.h +55 -19
- data/dist/ice/cpp/include/generated/Ice/SliceChecksumDict.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/Version.h +2 -2
- data/dist/ice/cpp/include/generated/IceDiscovery/Lookup.h +66 -14
- data/dist/ice/cpp/include/generated/IceLocatorDiscovery/Lookup.h +34 -8
- data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories_all.cpp +1 -1
- data/dist/ice/cpp/src/Ice/Base64.cpp +47 -137
- data/dist/ice/cpp/src/Ice/Base64.h +2 -2
- data/dist/ice/cpp/src/Ice/BatchRequestQueue.cpp +28 -13
- data/dist/ice/cpp/src/Ice/BatchRequestQueue.h +5 -1
- data/dist/ice/cpp/src/Ice/Buffer.cpp +1 -1
- data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +6 -4
- data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.h +1 -1
- data/dist/ice/cpp/src/Ice/Communicator.cpp +4 -3
- data/dist/ice/cpp/src/Ice/CommunicatorFlushBatchAsync.cpp +8 -0
- data/dist/ice/cpp/src/Ice/ConnectRequestHandler.cpp +5 -15
- data/dist/ice/cpp/src/Ice/ConnectRequestHandler.h +1 -1
- data/dist/ice/cpp/src/Ice/ConnectionFactory.cpp +6 -8
- data/dist/ice/cpp/src/Ice/ConnectionFactory.h +0 -3
- data/dist/ice/cpp/src/Ice/ConnectionI.cpp +121 -108
- data/dist/ice/cpp/src/Ice/ConnectionI.h +12 -9
- data/dist/ice/cpp/src/Ice/ConsoleUtil.cpp +1 -1
- data/dist/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +10 -14
- data/dist/ice/cpp/src/Ice/EndpointI.h +1 -1
- data/dist/ice/cpp/src/Ice/FileUtil.cpp +15 -79
- data/dist/ice/cpp/src/Ice/FileUtil.h +0 -3
- data/dist/ice/cpp/src/Ice/FixedRequestHandler.cpp +1 -1
- data/dist/ice/cpp/src/Ice/FixedRequestHandler.h +1 -1
- data/dist/ice/cpp/src/Ice/HttpParser.h +0 -2
- data/dist/ice/cpp/src/Ice/IPEndpointI.cpp +4 -0
- data/dist/ice/cpp/src/Ice/IdleTimeoutTransceiverDecorator.cpp +6 -3
- data/dist/ice/cpp/src/Ice/IncomingRequest.cpp +2 -4
- data/dist/ice/cpp/src/Ice/InputStream.cpp +50 -33
- data/dist/ice/cpp/src/Ice/Instance.cpp +73 -50
- data/dist/ice/cpp/src/Ice/Instance.h +1 -6
- data/dist/ice/cpp/src/Ice/LocalExceptions.cpp +7 -1
- data/dist/ice/cpp/src/Ice/LocatorInfo.cpp +2 -2
- data/dist/ice/cpp/src/Ice/LoggerAdminI.cpp +13 -18
- data/dist/ice/cpp/src/Ice/LoggerI.cpp +1 -1
- data/dist/ice/cpp/src/Ice/LoggerI.h +2 -2
- data/dist/ice/cpp/src/Ice/MetricsAdminI.h +6 -1
- data/dist/ice/cpp/src/Ice/MetricsObserverI.h +22 -18
- data/dist/ice/cpp/src/Ice/NativePropertiesAdmin.cpp +5 -2
- data/dist/ice/cpp/src/Ice/Network.cpp +168 -103
- data/dist/ice/cpp/src/Ice/Network.h +12 -7
- data/dist/ice/cpp/src/Ice/NetworkProxy.cpp +17 -6
- data/dist/ice/cpp/src/Ice/NetworkProxy.h +2 -1
- data/dist/ice/cpp/src/Ice/Object.cpp +1 -1
- data/dist/ice/cpp/src/Ice/ObjectAdapterI.cpp +56 -19
- data/dist/ice/cpp/src/Ice/OpaqueEndpointI.cpp +10 -10
- data/dist/ice/cpp/src/Ice/Options.cpp +7 -2
- data/dist/ice/cpp/src/Ice/OutgoingAsync.cpp +2 -2
- data/dist/ice/cpp/src/Ice/OutgoingResponse.cpp +127 -127
- data/dist/ice/cpp/src/Ice/OutgoingResponseInternal.h +21 -0
- data/dist/ice/cpp/src/Ice/OutputStream.cpp +50 -65
- data/dist/ice/cpp/src/Ice/PluginManagerI.cpp +7 -1
- data/dist/ice/cpp/src/Ice/Properties.cpp +26 -16
- data/dist/ice/cpp/src/Ice/PropertyNames.cpp +2 -1
- data/dist/ice/cpp/src/Ice/PropertyUtil.cpp +1 -1
- data/dist/ice/cpp/src/Ice/ProtocolInstance.cpp +0 -11
- data/dist/ice/cpp/src/Ice/ProtocolInstance.h +1 -2
- data/dist/ice/cpp/src/Ice/Proxy.cpp +9 -1
- data/dist/ice/cpp/src/Ice/ProxyAsync.cpp +110 -13
- data/dist/ice/cpp/src/Ice/ProxyFunctions.cpp +4 -4
- data/dist/ice/cpp/src/Ice/Random.cpp +68 -7
- data/dist/ice/cpp/src/Ice/Random.h +6 -2
- data/dist/ice/cpp/src/Ice/Reference.cpp +37 -26
- data/dist/ice/cpp/src/Ice/Reference.h +3 -0
- data/dist/ice/cpp/src/Ice/ReferenceFactory.cpp +26 -13
- data/dist/ice/cpp/src/Ice/RequestHandler.h +3 -1
- data/dist/ice/cpp/src/Ice/RequestHandlerCache.cpp +1 -1
- data/dist/ice/cpp/src/Ice/RequestHandlerCache.h +1 -1
- data/dist/ice/cpp/src/Ice/ResourceConfig.h +3 -3
- data/dist/ice/cpp/src/Ice/RetryQueue.cpp +8 -12
- data/dist/ice/cpp/src/Ice/SHA1.cpp +11 -11
- data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.cpp +0 -6
- data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.h +0 -6
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.cpp +27 -12
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.h +1 -2
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.cpp +77 -27
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.h +2 -1
- data/dist/ice/cpp/src/Ice/SSL/RFC2253.cpp +2 -2
- data/dist/ice/cpp/src/Ice/SSL/SSLEndpointI.cpp +1 -1
- data/dist/ice/cpp/src/Ice/SSL/SSLEngine.h +1 -4
- data/dist/ice/cpp/src/Ice/SSL/SSLUtil.cpp +39 -34
- data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.cpp +165 -80
- data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.h +1 -5
- data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.cpp +73 -33
- data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.h +0 -1
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.cpp +110 -17
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.h +7 -2
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportTransceiverI.cpp +9 -3
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.cpp +73 -51
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.h +0 -8
- data/dist/ice/cpp/src/Ice/Selector.cpp +13 -11
- data/dist/ice/cpp/src/Ice/ServantManager.cpp +3 -3
- data/dist/ice/cpp/src/Ice/Service.cpp +33 -115
- data/dist/ice/cpp/src/Ice/StreamSocket.cpp +33 -40
- data/dist/ice/cpp/src/Ice/StreamSocket.h +4 -4
- data/dist/ice/cpp/src/Ice/StringConverter.cpp +1 -1
- data/dist/ice/cpp/src/Ice/StringUtil.cpp +12 -21
- data/dist/ice/cpp/src/Ice/SysLoggerI.cpp +136 -100
- data/dist/ice/cpp/src/Ice/SysLoggerI.h +7 -3
- data/dist/ice/cpp/src/Ice/SystemdJournalI.cpp +1 -1
- data/dist/ice/cpp/src/Ice/TcpAcceptor.cpp +7 -7
- data/dist/ice/cpp/src/Ice/TcpAcceptor.h +2 -1
- data/dist/ice/cpp/src/Ice/TcpBufSize.h +40 -0
- data/dist/ice/cpp/src/Ice/TcpConnector.cpp +5 -2
- data/dist/ice/cpp/src/Ice/TcpConnector.h +2 -0
- data/dist/ice/cpp/src/Ice/TcpEndpointI.cpp +2 -2
- data/dist/ice/cpp/src/Ice/TcpTransceiver.cpp +6 -2
- data/dist/ice/cpp/src/Ice/ThreadPool.cpp +2 -8
- data/dist/ice/cpp/src/Ice/ThreadPool.h +0 -2
- data/dist/ice/cpp/src/Ice/Timer.cpp +7 -3
- data/dist/ice/cpp/src/Ice/UUID.cpp +1 -2
- data/dist/ice/cpp/src/Ice/UdpEndpointI.cpp +6 -3
- data/dist/ice/cpp/src/Ice/UdpTransceiver.cpp +136 -123
- data/dist/ice/cpp/src/Ice/UdpTransceiver.h +3 -4
- data/dist/ice/cpp/src/Ice/WSAcceptor.cpp +8 -3
- data/dist/ice/cpp/src/Ice/WSAcceptor.h +5 -1
- data/dist/ice/cpp/src/Ice/WSEndpoint.cpp +45 -2
- data/dist/ice/cpp/src/Ice/WSTransceiver.cpp +214 -34
- data/dist/ice/cpp/src/Ice/WSTransceiver.h +13 -2
- data/dist/ice/cpp/src/Ice/generated/BuiltinSequences.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/Context.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/EndpointTypes.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/Identity.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/Locator.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/LocatorRegistry.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/Metrics.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/OperationMode.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/Process.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/PropertiesAdmin.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/PropertyDict.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/RemoteLogger.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/ReplyStatus.cpp +4 -2
- data/dist/ice/cpp/src/Ice/generated/Router.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/SliceChecksumDict.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/Version.cpp +2 -2
- data/dist/ice/cpp/src/IceDiscovery/LookupI.cpp +47 -9
- data/dist/ice/cpp/src/IceDiscovery/LookupI.h +8 -3
- data/dist/ice/cpp/src/IceDiscovery/generated/Lookup.cpp +2 -2
- data/dist/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +43 -14
- data/dist/ice/cpp/src/IceLocatorDiscovery/generated/Lookup.cpp +2 -2
- data/dist/ice/cpp/src/Slice/DocCommentParser.cpp +32 -26
- data/dist/ice/cpp/src/Slice/DocCommentParser.h +6 -4
- data/dist/ice/cpp/src/Slice/FileTracker.cpp +3 -11
- data/dist/ice/cpp/src/Slice/FileTracker.h +0 -2
- data/dist/ice/cpp/src/Slice/Grammar.cpp +211 -210
- data/dist/ice/cpp/src/Slice/MetadataValidation.cpp +34 -14
- data/dist/ice/cpp/src/Slice/MetadataValidation.h +3 -2
- data/dist/ice/cpp/src/Slice/Parser.cpp +145 -97
- data/dist/ice/cpp/src/Slice/Parser.h +22 -8
- data/dist/ice/cpp/src/Slice/Preprocessor.cpp +77 -29
- data/dist/ice/cpp/src/Slice/Preprocessor.h +0 -3
- data/dist/ice/cpp/src/Slice/Scanner.cpp +3 -3
- data/dist/ice/cpp/src/Slice/SliceUtil.cpp +203 -172
- data/dist/ice/cpp/src/Slice/StringLiteralUtil.cpp +0 -2
- data/dist/ice/cpp/src/Slice/Util.h +21 -12
- data/dist/ice/cpp/src/slice2rb/Ruby.cpp +7 -3
- data/dist/ice/cpp/src/slice2rb/RubyUtil.cpp +26 -20
- data/dist/ice/cpp/src/slice2rb/RubyUtil.h +10 -13
- data/dist/ice/slice/Glacier2/Router.ice +3 -3
- data/dist/ice/slice/Ice/Identity.ice +3 -0
- data/dist/ice/slice/Ice/Locator.ice +6 -5
- data/dist/ice/slice/Ice/LocatorRegistry.ice +3 -0
- data/dist/ice/slice/Ice/Metrics.ice +7 -6
- data/dist/ice/slice/Ice/OperationMode.ice +8 -0
- data/dist/ice/slice/Ice/Process.ice +3 -0
- data/dist/ice/slice/Ice/RemoteLogger.ice +5 -5
- data/dist/ice/slice/Ice/ReplyStatus.ice +13 -0
- data/dist/ice/slice/IceGrid/Admin.ice +9 -9
- data/dist/ice/slice/IceGrid/Descriptor.ice +5 -5
- data/dist/ice/slice/IceStorm/Metrics.ice +1 -1
- data/dist/lib/Glacier2/Metrics.rb +1 -1
- data/dist/lib/Glacier2/PermissionsVerifier.rb +3 -3
- data/dist/lib/Glacier2/Router.rb +9 -9
- data/dist/lib/Glacier2/SSLInfo.rb +1 -1
- data/dist/lib/Glacier2/Session.rb +15 -15
- data/dist/lib/Ice/BuiltinSequences.rb +1 -1
- data/dist/lib/Ice/CompressBatch.rb +1 -2
- data/dist/lib/Ice/Context.rb +1 -1
- data/dist/lib/Ice/EndpointSelectionType.rb +1 -2
- data/dist/lib/Ice/EndpointTypes.rb +1 -1
- data/dist/lib/Ice/Identity.rb +1 -1
- data/dist/lib/Ice/IdentitySpaceship.rb +1 -0
- data/dist/lib/Ice/LocalExceptions.rb +3 -0
- data/dist/lib/Ice/Locator.rb +5 -5
- data/dist/lib/Ice/LocatorRegistry.rb +4 -4
- data/dist/lib/Ice/Metrics.rb +7 -7
- data/dist/lib/Ice/OperationMode.rb +2 -3
- data/dist/lib/Ice/Process.rb +3 -3
- data/dist/lib/Ice/PropertiesAdmin.rb +4 -4
- data/dist/lib/Ice/PropertyDict.rb +1 -1
- data/dist/lib/Ice/ProxyFunctions.rb +8 -4
- data/dist/lib/Ice/RemoteLogger.rb +7 -8
- data/dist/lib/Ice/ReplyStatus.rb +4 -4
- data/dist/lib/Ice/Router.rb +5 -5
- data/dist/lib/Ice/SliceChecksumDict.rb +1 -1
- data/dist/lib/Ice/SliceUtil.rb +2 -2
- data/dist/lib/Ice/Struct.rb +1 -0
- data/dist/lib/Ice/ToStringMode.rb +1 -2
- data/dist/lib/Ice/Value.rb +2 -2
- data/dist/lib/Ice/Version.rb +1 -1
- data/dist/lib/IceBox/ServiceManager.rb +8 -8
- data/dist/lib/IceGrid/Admin.rb +85 -86
- data/dist/lib/IceGrid/Descriptor.rb +1 -1
- data/dist/lib/IceGrid/Exception.rb +1 -1
- data/dist/lib/IceGrid/FileParser.rb +2 -2
- data/dist/lib/IceGrid/Registry.rb +14 -15
- data/dist/lib/IceGrid/Session.rb +7 -7
- data/dist/lib/IceGrid/UserAccountMapper.rb +2 -2
- data/dist/lib/IceStorm/IceStorm.rb +16 -16
- data/dist/lib/IceStorm/Metrics.rb +1 -1
- data/extconf.rb +1 -1
- data/ice.gemspec +3 -3
- metadata +5 -5
- data/dist/ice/cpp/src/Ice/DLLMain.cpp +0 -40
- data/dist/ice/cpp/src/Ice/UndefSysMacros.h +0 -37
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
#include <climits>
|
|
17
17
|
#include <cstdint>
|
|
18
|
+
#include <stdexcept>
|
|
18
19
|
|
|
19
20
|
using namespace std;
|
|
20
21
|
using namespace Ice;
|
|
@@ -51,6 +52,23 @@ namespace
|
|
|
51
52
|
const string _iceProtocol = "ice.zeroc.com"; // NOLINT(cert-err58-cpp)
|
|
52
53
|
const string _wsUUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; // NOLINT(cert-err58-cpp)
|
|
53
54
|
|
|
55
|
+
// Returns true if the Connection header field - a comma-separated list of tokens, already trimmed and lowercased
|
|
56
|
+
// by HttpParser::getHeader - includes the "upgrade" token required by RFC 6455 section 4.
|
|
57
|
+
bool hasUpgradeToken(string_view connectionField)
|
|
58
|
+
{
|
|
59
|
+
while (!connectionField.empty())
|
|
60
|
+
{
|
|
61
|
+
auto comma = connectionField.find(',');
|
|
62
|
+
string_view token = connectionField.substr(0, comma);
|
|
63
|
+
connectionField.remove_prefix(comma == string_view::npos ? connectionField.size() : comma + 1);
|
|
64
|
+
if (IceInternal::trim(token) == "upgrade")
|
|
65
|
+
{
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
|
|
54
72
|
//
|
|
55
73
|
// Rename to avoid conflict with OS 10.10 htonll
|
|
56
74
|
//
|
|
@@ -124,6 +142,49 @@ namespace
|
|
|
124
142
|
}
|
|
125
143
|
}
|
|
126
144
|
|
|
145
|
+
string
|
|
146
|
+
IceInternal::canonicalizeOrigin(string_view origin)
|
|
147
|
+
{
|
|
148
|
+
// Throws std::invalid_argument for any input that is not a serialized origin per RFC 6454.
|
|
149
|
+
auto sep = origin.find("://");
|
|
150
|
+
if (sep == string_view::npos || sep == 0)
|
|
151
|
+
{
|
|
152
|
+
throw invalid_argument{"malformed origin '" + string{origin} + "'"};
|
|
153
|
+
}
|
|
154
|
+
string scheme{origin.substr(0, sep)};
|
|
155
|
+
transform(
|
|
156
|
+
scheme.begin(),
|
|
157
|
+
scheme.end(),
|
|
158
|
+
scheme.begin(),
|
|
159
|
+
[](unsigned char c) { return static_cast<char>(std::tolower(c)); });
|
|
160
|
+
string_view authority = origin.substr(sep + 3);
|
|
161
|
+
// Tolerate a single trailing slash (some peers send "https://example.com/" as an Origin); reject any other
|
|
162
|
+
// path/query/fragment/userinfo.
|
|
163
|
+
if (!authority.empty() && authority.back() == '/')
|
|
164
|
+
{
|
|
165
|
+
authority.remove_suffix(1);
|
|
166
|
+
}
|
|
167
|
+
if (authority.empty() || authority.find_first_of("/?#@") != string_view::npos)
|
|
168
|
+
{
|
|
169
|
+
throw invalid_argument{"malformed origin '" + string{origin} + "'"};
|
|
170
|
+
}
|
|
171
|
+
string hostAndPort{authority};
|
|
172
|
+
transform(
|
|
173
|
+
hostAndPort.begin(),
|
|
174
|
+
hostAndPort.end(),
|
|
175
|
+
hostAndPort.begin(),
|
|
176
|
+
[](unsigned char c) { return static_cast<char>(std::tolower(c)); });
|
|
177
|
+
if (auto colon = hostAndPort.rfind(':'); colon != string::npos)
|
|
178
|
+
{
|
|
179
|
+
string_view port = string_view{hostAndPort}.substr(colon + 1);
|
|
180
|
+
if ((scheme == "http" && port == "80") || (scheme == "https" && port == "443"))
|
|
181
|
+
{
|
|
182
|
+
hostAndPort = hostAndPort.substr(0, colon);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return scheme + "://" + hostAndPort;
|
|
186
|
+
}
|
|
187
|
+
|
|
127
188
|
NativeInfoPtr
|
|
128
189
|
IceInternal::WSTransceiver::getNativeInfo()
|
|
129
190
|
{
|
|
@@ -188,7 +249,7 @@ IceInternal::WSTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer)
|
|
|
188
249
|
// encoded with Base64.
|
|
189
250
|
//
|
|
190
251
|
vector<byte> key(16);
|
|
191
|
-
IceInternal::generateRandom(reinterpret_cast<char*>(
|
|
252
|
+
IceInternal::generateRandom(reinterpret_cast<char*>(key.data()), key.size());
|
|
192
253
|
_key = IceInternal::Base64::encode(key);
|
|
193
254
|
out << _key << "\r\n\r\n"; // EOM
|
|
194
255
|
|
|
@@ -376,10 +437,10 @@ IceInternal::WSTransceiver::closing(bool initiator, exception_ptr reason)
|
|
|
376
437
|
{
|
|
377
438
|
//
|
|
378
439
|
// If we initiated a close connection but also received a
|
|
379
|
-
// close connection, we assume we didn't
|
|
380
|
-
//
|
|
440
|
+
// close connection, we assume we didn't initiate the
|
|
441
|
+
// close and we send the close frame now. This is to
|
|
381
442
|
// ensure that if both peers close the connection at the same
|
|
382
|
-
// time we don't hang having both
|
|
443
|
+
// time we don't hang having both peers waiting for the close
|
|
383
444
|
// frame of the other.
|
|
384
445
|
//
|
|
385
446
|
assert(!initiator);
|
|
@@ -531,8 +592,8 @@ IceInternal::WSTransceiver::read(Buffer& buf)
|
|
|
531
592
|
}
|
|
532
593
|
|
|
533
594
|
//
|
|
534
|
-
// If we read the full Ice message, handle it before trying
|
|
535
|
-
//
|
|
595
|
+
// If we read the full Ice message, handle it before trying to
|
|
596
|
+
// read any more data from the WS connection.
|
|
536
597
|
//
|
|
537
598
|
if (buf.i == buf.b.end())
|
|
538
599
|
{
|
|
@@ -845,9 +906,10 @@ IceInternal::WSTransceiver::WSTransceiver(
|
|
|
845
906
|
//
|
|
846
907
|
}
|
|
847
908
|
|
|
848
|
-
IceInternal::WSTransceiver::WSTransceiver(ProtocolInstancePtr instance, TransceiverPtr del)
|
|
909
|
+
IceInternal::WSTransceiver::WSTransceiver(ProtocolInstancePtr instance, TransceiverPtr del, set<string> allowedOrigins)
|
|
849
910
|
: _instance(std::move(instance)),
|
|
850
911
|
_delegate(std::move(del)),
|
|
912
|
+
_allowedOrigins(std::move(allowedOrigins)),
|
|
851
913
|
_incoming(true),
|
|
852
914
|
_state(StateInitializeDelegate),
|
|
853
915
|
_parser(make_shared<HttpParser>()),
|
|
@@ -876,6 +938,19 @@ IceInternal::WSTransceiver::handleRequest(Buffer& responseBuffer)
|
|
|
876
938
|
{
|
|
877
939
|
string val;
|
|
878
940
|
|
|
941
|
+
//
|
|
942
|
+
// The opening handshake must be a GET request (RFC 6455 section 4.1). We check the message type first
|
|
943
|
+
// because method() (used just below) and uri() (used later) assert the parser holds a request.
|
|
944
|
+
//
|
|
945
|
+
if (_parser->type() != HttpParser::TypeRequest)
|
|
946
|
+
{
|
|
947
|
+
throw WebSocketException("WebSocket handshake is not an HTTP request");
|
|
948
|
+
}
|
|
949
|
+
if (_parser->method() != "GET")
|
|
950
|
+
{
|
|
951
|
+
throw WebSocketException("unsupported HTTP method '" + _parser->method() + "' for WebSocket handshake");
|
|
952
|
+
}
|
|
953
|
+
|
|
879
954
|
//
|
|
880
955
|
// HTTP/1.1
|
|
881
956
|
//
|
|
@@ -905,7 +980,7 @@ IceInternal::WSTransceiver::handleRequest(Buffer& responseBuffer)
|
|
|
905
980
|
{
|
|
906
981
|
throw WebSocketException("missing value for Connection field");
|
|
907
982
|
}
|
|
908
|
-
else if (val
|
|
983
|
+
else if (!hasUpgradeToken(val))
|
|
909
984
|
{
|
|
910
985
|
throw WebSocketException("invalid value '" + val + "' for Connection field");
|
|
911
986
|
}
|
|
@@ -955,10 +1030,43 @@ IceInternal::WSTransceiver::handleRequest(Buffer& responseBuffer)
|
|
|
955
1030
|
throw WebSocketException("missing value for WebSocket key");
|
|
956
1031
|
}
|
|
957
1032
|
|
|
958
|
-
|
|
959
|
-
|
|
1033
|
+
try
|
|
1034
|
+
{
|
|
1035
|
+
vector<byte> decodedKey = Base64::decode(key);
|
|
1036
|
+
if (decodedKey.size() != 16)
|
|
1037
|
+
{
|
|
1038
|
+
throw WebSocketException("WebSocket key '" + key + "' has invalid length");
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
catch (const std::invalid_argument&)
|
|
1042
|
+
{
|
|
1043
|
+
throw WebSocketException("invalid base64 value '" + key + "' for WebSocket key");
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
//
|
|
1047
|
+
// Optionally validate the Origin header against the adapter's allowed-origins list.
|
|
1048
|
+
// Browsers always send Origin; non-browser clients do not, so an absent header bypasses the check.
|
|
1049
|
+
// A wildcard ("*") allowlist is normalized to an empty set at parse time, so empty here means "no enforcement".
|
|
1050
|
+
//
|
|
1051
|
+
if (!_allowedOrigins.empty())
|
|
960
1052
|
{
|
|
961
|
-
|
|
1053
|
+
string origin;
|
|
1054
|
+
if (_parser->getHeader("Origin", origin, false))
|
|
1055
|
+
{
|
|
1056
|
+
string canonical;
|
|
1057
|
+
try
|
|
1058
|
+
{
|
|
1059
|
+
canonical = canonicalizeOrigin(IceInternal::trim(origin));
|
|
1060
|
+
}
|
|
1061
|
+
catch (const std::invalid_argument&)
|
|
1062
|
+
{
|
|
1063
|
+
throw WebSocketException("invalid Origin header '" + origin + "'");
|
|
1064
|
+
}
|
|
1065
|
+
if (_allowedOrigins.count(canonical) == 0)
|
|
1066
|
+
{
|
|
1067
|
+
throw WebSocketException("origin '" + origin + "' is not allowed");
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
962
1070
|
}
|
|
963
1071
|
|
|
964
1072
|
//
|
|
@@ -991,9 +1099,8 @@ IceInternal::WSTransceiver::handleRequest(Buffer& responseBuffer)
|
|
|
991
1099
|
out << "Sec-WebSocket-Accept: ";
|
|
992
1100
|
string input = key + _wsUUID;
|
|
993
1101
|
vector<byte> hash;
|
|
994
|
-
sha1(reinterpret_cast<const byte*>(
|
|
995
|
-
out << IceInternal::Base64::encode(hash) << "\r\n"
|
|
996
|
-
<< "\r\n"; // EOM
|
|
1102
|
+
sha1(reinterpret_cast<const byte*>(input.data()), input.size(), hash);
|
|
1103
|
+
out << IceInternal::Base64::encode(hash) << "\r\n\r\n"; // EOM
|
|
997
1104
|
|
|
998
1105
|
string str = out.str();
|
|
999
1106
|
responseBuffer.b.resize(str.size());
|
|
@@ -1058,7 +1165,7 @@ IceInternal::WSTransceiver::handleResponse()
|
|
|
1058
1165
|
{
|
|
1059
1166
|
throw WebSocketException("missing value for Connection field");
|
|
1060
1167
|
}
|
|
1061
|
-
else if (val
|
|
1168
|
+
else if (!hasUpgradeToken(val))
|
|
1062
1169
|
{
|
|
1063
1170
|
throw WebSocketException("invalid value '" + val + "' for Connection field");
|
|
1064
1171
|
}
|
|
@@ -1090,7 +1197,7 @@ IceInternal::WSTransceiver::handleResponse()
|
|
|
1090
1197
|
}
|
|
1091
1198
|
string input = _key + _wsUUID;
|
|
1092
1199
|
vector<byte> hash;
|
|
1093
|
-
sha1(reinterpret_cast<const byte*>(
|
|
1200
|
+
sha1(reinterpret_cast<const byte*>(input.data()), input.size(), hash);
|
|
1094
1201
|
if (val != IceInternal::Base64::encode(hash))
|
|
1095
1202
|
{
|
|
1096
1203
|
throw WebSocketException("invalid value '" + val + "' for Sec-WebSocket-Accept");
|
|
@@ -1120,6 +1227,16 @@ IceInternal::WSTransceiver::preRead(Buffer& buf)
|
|
|
1120
1227
|
byte ch = *_readI++;
|
|
1121
1228
|
_readOpCode = static_cast<int>(ch & byte{0xf});
|
|
1122
1229
|
|
|
1230
|
+
//
|
|
1231
|
+
// No extension is negotiated, so the RSV1, RSV2, and RSV3 bits must all be 0.
|
|
1232
|
+
//
|
|
1233
|
+
if ((ch & byte{0x70}) != byte{0})
|
|
1234
|
+
{
|
|
1235
|
+
throw ProtocolException(__FILE__, __LINE__, "invalid WebSocket frame: RSV bits must be 0");
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
const bool finalFrame = (ch & byte{FLAG_FINAL}) == byte{FLAG_FINAL};
|
|
1239
|
+
|
|
1123
1240
|
//
|
|
1124
1241
|
// Remember if last frame if we're going to read a data or
|
|
1125
1242
|
// continuation frame, this is only for protocol
|
|
@@ -1131,7 +1248,7 @@ IceInternal::WSTransceiver::preRead(Buffer& buf)
|
|
|
1131
1248
|
{
|
|
1132
1249
|
throw ProtocolException(__FILE__, __LINE__, "invalid data frame, no FIN on previous frame");
|
|
1133
1250
|
}
|
|
1134
|
-
_readLastFrame =
|
|
1251
|
+
_readLastFrame = finalFrame;
|
|
1135
1252
|
}
|
|
1136
1253
|
else if (_readOpCode == OP_CONT)
|
|
1137
1254
|
{
|
|
@@ -1139,7 +1256,7 @@ IceInternal::WSTransceiver::preRead(Buffer& buf)
|
|
|
1139
1256
|
{
|
|
1140
1257
|
throw ProtocolException(__FILE__, __LINE__, "invalid continuation frame, previous frame FIN set");
|
|
1141
1258
|
}
|
|
1142
|
-
_readLastFrame =
|
|
1259
|
+
_readLastFrame = finalFrame;
|
|
1143
1260
|
}
|
|
1144
1261
|
|
|
1145
1262
|
ch = *_readI++;
|
|
@@ -1162,6 +1279,30 @@ IceInternal::WSTransceiver::preRead(Buffer& buf)
|
|
|
1162
1279
|
// 127: The subsequent eight bytes contain the payload length
|
|
1163
1280
|
//
|
|
1164
1281
|
_readPayloadLength = static_cast<size_t>((ch & byte{0x7f}));
|
|
1282
|
+
|
|
1283
|
+
//
|
|
1284
|
+
// RFC 6455 section 5.5: control frames (close, ping, and pong) must not be fragmented
|
|
1285
|
+
// and must have a payload length of 125 bytes or less - they cannot use the 16-bit or
|
|
1286
|
+
// 64-bit extended length encoding. Enforce this before allocating any payload buffer.
|
|
1287
|
+
//
|
|
1288
|
+
if (_readOpCode == OP_CLOSE || _readOpCode == OP_PING || _readOpCode == OP_PONG)
|
|
1289
|
+
{
|
|
1290
|
+
if (!finalFrame)
|
|
1291
|
+
{
|
|
1292
|
+
throw ProtocolException(
|
|
1293
|
+
__FILE__,
|
|
1294
|
+
__LINE__,
|
|
1295
|
+
"invalid WebSocket control frame: the FIN bit is not set");
|
|
1296
|
+
}
|
|
1297
|
+
if (_readPayloadLength > 125)
|
|
1298
|
+
{
|
|
1299
|
+
throw ProtocolException(
|
|
1300
|
+
__FILE__,
|
|
1301
|
+
__LINE__,
|
|
1302
|
+
"invalid WebSocket control frame: the payload length exceeds 125 bytes");
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1165
1306
|
if (_readPayloadLength < 126)
|
|
1166
1307
|
{
|
|
1167
1308
|
_readHeaderLength = 0;
|
|
@@ -1194,7 +1335,10 @@ IceInternal::WSTransceiver::preRead(Buffer& buf)
|
|
|
1194
1335
|
|
|
1195
1336
|
if (_readPayloadLength == 126)
|
|
1196
1337
|
{
|
|
1197
|
-
|
|
1338
|
+
// memcpy avoids the alignment UB of a direct uint16_t* dereference on _readI.
|
|
1339
|
+
uint16_t length;
|
|
1340
|
+
memcpy(&length, _readI, sizeof(length));
|
|
1341
|
+
_readPayloadLength = static_cast<size_t>(ntohs(length));
|
|
1198
1342
|
_readI += 2;
|
|
1199
1343
|
}
|
|
1200
1344
|
else if (_readPayloadLength == 127)
|
|
@@ -1244,7 +1388,7 @@ IceInternal::WSTransceiver::preRead(Buffer& buf)
|
|
|
1244
1388
|
}
|
|
1245
1389
|
_readState = ReadStatePayload;
|
|
1246
1390
|
assert(buf.i != buf.b.end());
|
|
1247
|
-
|
|
1391
|
+
_readFrameOffset = 0;
|
|
1248
1392
|
break;
|
|
1249
1393
|
}
|
|
1250
1394
|
case OP_CLOSE: // Connection close
|
|
@@ -1322,7 +1466,17 @@ IceInternal::WSTransceiver::preRead(Buffer& buf)
|
|
|
1322
1466
|
{
|
|
1323
1467
|
_pingPayload.clear();
|
|
1324
1468
|
_pingPayload.resize(_readPayloadLength);
|
|
1325
|
-
memcpy(
|
|
1469
|
+
memcpy(_pingPayload.data(), _readI, _pingPayload.size());
|
|
1470
|
+
if (_incoming)
|
|
1471
|
+
{
|
|
1472
|
+
// A client masks its frames (RFC 6455 §5.3), so unmask the ping payload here, just like the
|
|
1473
|
+
// data path does in postRead. Otherwise the pong we echo back carries the still-masked bytes
|
|
1474
|
+
// instead of the original ping payload (RFC 6455 §5.5.3).
|
|
1475
|
+
for (size_t i = 0; i < _pingPayload.size(); ++i)
|
|
1476
|
+
{
|
|
1477
|
+
_pingPayload[i] ^= static_cast<uint8_t>(_readMask[i % 4]);
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1326
1480
|
}
|
|
1327
1481
|
|
|
1328
1482
|
_readI += _readPayloadLength;
|
|
@@ -1398,13 +1552,16 @@ IceInternal::WSTransceiver::postRead(Buffer& buf)
|
|
|
1398
1552
|
if (_incoming)
|
|
1399
1553
|
{
|
|
1400
1554
|
//
|
|
1401
|
-
// Unmask the data we just read.
|
|
1555
|
+
// Unmask the data we just read. _readFrameOffset is the mask index (payload bytes consumed so far in
|
|
1556
|
+
// this frame). We keep it as an integer rather than an iterator into buf because ConnectionI reallocates
|
|
1557
|
+
// the read buffer between reads of the same frame, which would invalidate such an iterator.
|
|
1402
1558
|
//
|
|
1403
1559
|
IceInternal::Buffer::Container::iterator p = _readStart;
|
|
1404
|
-
for (
|
|
1560
|
+
for (size_t n = _readFrameOffset; p < buf.i; ++p, ++n)
|
|
1405
1561
|
{
|
|
1406
1562
|
*p ^= _readMask[n % 4];
|
|
1407
1563
|
}
|
|
1564
|
+
_readFrameOffset += static_cast<size_t>(buf.i - _readStart);
|
|
1408
1565
|
}
|
|
1409
1566
|
|
|
1410
1567
|
_readPayloadLength -= static_cast<size_t>(buf.i - _readStart);
|
|
@@ -1447,15 +1604,35 @@ IceInternal::WSTransceiver::preWrite(Buffer& buf)
|
|
|
1447
1604
|
else if (_state == StatePongPending)
|
|
1448
1605
|
{
|
|
1449
1606
|
prepareWriteHeader(OP_PONG, _pingPayload.size());
|
|
1450
|
-
|
|
1607
|
+
|
|
1608
|
+
// A zero-length ping (the common keep-alive case) leaves _pingPayload empty. Guard the copy so we
|
|
1609
|
+
// never form &_pingPayload[0] on an empty vector, which is undefined behavior and aborts under
|
|
1610
|
+
// hardened standard libraries (_GLIBCXX_ASSERTIONS, MSVC debug iterators, libc++ hardening).
|
|
1611
|
+
if (!_pingPayload.empty())
|
|
1451
1612
|
{
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1613
|
+
if (_pingPayload.size() > static_cast<size_t>(_writeBuffer.b.end() - _writeBuffer.i))
|
|
1614
|
+
{
|
|
1615
|
+
auto pos = static_cast<size_t>(_writeBuffer.i - _writeBuffer.b.begin());
|
|
1616
|
+
_writeBuffer.b.resize(pos + _pingPayload.size());
|
|
1617
|
+
_writeBuffer.i = _writeBuffer.b.begin() + pos;
|
|
1618
|
+
}
|
|
1619
|
+
if (_incoming)
|
|
1620
|
+
{
|
|
1621
|
+
// Server-to-client frames are not masked (RFC 6455 §5.1).
|
|
1622
|
+
memcpy(_writeBuffer.i, _pingPayload.data(), _pingPayload.size());
|
|
1623
|
+
_writeBuffer.i += _pingPayload.size();
|
|
1624
|
+
}
|
|
1625
|
+
else
|
|
1626
|
+
{
|
|
1627
|
+
// Client-to-server frames are masked with _writeMask, like the OP_DATA and OP_CLOSE paths;
|
|
1628
|
+
// prepareWriteHeader set FLAG_MASKED, so the payload must be masked to match (RFC 6455 §5.5.3).
|
|
1629
|
+
for (size_t i = 0; i < _pingPayload.size(); ++i)
|
|
1630
|
+
{
|
|
1631
|
+
*_writeBuffer.i++ = static_cast<std::byte>(_pingPayload[i]) ^ _writeMask[i % 4];
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
_pingPayload.clear();
|
|
1455
1635
|
}
|
|
1456
|
-
memcpy(_writeBuffer.i, &_pingPayload[0], _pingPayload.size());
|
|
1457
|
-
_writeBuffer.i += _pingPayload.size();
|
|
1458
|
-
_pingPayload.clear();
|
|
1459
1636
|
|
|
1460
1637
|
_writeBuffer.b.resize(static_cast<size_t>(_writeBuffer.i - _writeBuffer.b.begin()));
|
|
1461
1638
|
_writeState = WriteStateControlFrame;
|
|
@@ -1467,8 +1644,9 @@ IceInternal::WSTransceiver::preWrite(Buffer& buf)
|
|
|
1467
1644
|
{
|
|
1468
1645
|
prepareWriteHeader(OP_CLOSE, 2);
|
|
1469
1646
|
|
|
1470
|
-
// Write closing reason
|
|
1471
|
-
|
|
1647
|
+
// Write closing reason. memcpy avoids the alignment UB of a direct uint16_t* store.
|
|
1648
|
+
const uint16_t reason = htons(static_cast<uint16_t>(_closingReason));
|
|
1649
|
+
memcpy(_writeBuffer.i, &reason, sizeof(reason));
|
|
1472
1650
|
if (!_incoming)
|
|
1473
1651
|
{
|
|
1474
1652
|
*_writeBuffer.i++ ^= _writeMask[0];
|
|
@@ -1499,7 +1677,7 @@ IceInternal::WSTransceiver::preWrite(Buffer& buf)
|
|
|
1499
1677
|
// 32-bit value, so we copy the entire message into the internal buffer
|
|
1500
1678
|
// for writing. For incoming connections, we just copy the start of the
|
|
1501
1679
|
// message in the internal buffer after the header. If the message is
|
|
1502
|
-
// larger, the
|
|
1680
|
+
// larger, the remainder is sent directly from the message buffer to avoid
|
|
1503
1681
|
// copying.
|
|
1504
1682
|
//
|
|
1505
1683
|
|
|
@@ -1688,7 +1866,9 @@ IceInternal::WSTransceiver::prepareWriteHeader(uint8_t opCode, IceInternal::Buff
|
|
|
1688
1866
|
// Use an extra 16 bits to encode the payload length.
|
|
1689
1867
|
//
|
|
1690
1868
|
*_writeBuffer.i++ = byte{126};
|
|
1691
|
-
|
|
1869
|
+
// memcpy avoids the alignment UB of a direct uint16_t* store.
|
|
1870
|
+
const uint16_t length = htons(static_cast<uint16_t>(payloadLength));
|
|
1871
|
+
memcpy(_writeBuffer.i, &length, sizeof(length));
|
|
1692
1872
|
_writeBuffer.i += 2;
|
|
1693
1873
|
}
|
|
1694
1874
|
else if (payloadLength > USHRT_MAX)
|
|
@@ -10,16 +10,26 @@
|
|
|
10
10
|
#include "ProtocolInstance.h"
|
|
11
11
|
#include "Transceiver.h"
|
|
12
12
|
|
|
13
|
+
#include <set>
|
|
14
|
+
#include <string>
|
|
15
|
+
#include <string_view>
|
|
16
|
+
|
|
13
17
|
namespace IceInternal
|
|
14
18
|
{
|
|
15
19
|
class ConnectorI;
|
|
16
20
|
class AcceptorI;
|
|
17
21
|
|
|
22
|
+
// Canonicalize an origin string: lowercase scheme and host, omit the default port (80 for http, 443 for https).
|
|
23
|
+
// A single trailing slash is tolerated. Throws std::invalid_argument if the input is not a syntactically valid
|
|
24
|
+
// origin per RFC 6454 -- "scheme://host[:port]" with no path beyond a trailing slash, no query, fragment, or
|
|
25
|
+
// userinfo.
|
|
26
|
+
std::string canonicalizeOrigin(std::string_view origin);
|
|
27
|
+
|
|
18
28
|
class WSTransceiver final : public Transceiver
|
|
19
29
|
{
|
|
20
30
|
public:
|
|
21
31
|
WSTransceiver(ProtocolInstancePtr, TransceiverPtr, std::string, std::string);
|
|
22
|
-
WSTransceiver(ProtocolInstancePtr, TransceiverPtr);
|
|
32
|
+
WSTransceiver(ProtocolInstancePtr, TransceiverPtr, std::set<std::string> allowedOrigins);
|
|
23
33
|
~WSTransceiver();
|
|
24
34
|
|
|
25
35
|
NativeInfoPtr getNativeInfo() final;
|
|
@@ -66,6 +76,7 @@ namespace IceInternal
|
|
|
66
76
|
const TransceiverPtr _delegate;
|
|
67
77
|
const std::string _host;
|
|
68
78
|
const std::string _resource;
|
|
79
|
+
const std::set<std::string> _allowedOrigins;
|
|
69
80
|
const bool _incoming;
|
|
70
81
|
|
|
71
82
|
enum State
|
|
@@ -106,7 +117,7 @@ namespace IceInternal
|
|
|
106
117
|
size_t _readHeaderLength;
|
|
107
118
|
size_t _readPayloadLength;
|
|
108
119
|
Buffer::Container::iterator _readStart;
|
|
109
|
-
|
|
120
|
+
size_t _readFrameOffset{0};
|
|
110
121
|
std::byte _readMask[4];
|
|
111
122
|
|
|
112
123
|
enum WriteState
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) ZeroC, Inc.
|
|
2
2
|
|
|
3
|
-
// slice2cpp version 3.8.
|
|
3
|
+
// slice2cpp version 3.8.3
|
|
4
4
|
// <auto-generated>Generated from Slice file 'BuiltinSequences.ice'.</auto-generated>
|
|
5
5
|
|
|
6
6
|
#ifndef ICE_API_EXPORTS
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
# if ICE_INT_VERSION % 100 >= 50
|
|
35
35
|
# error Beta header file detected
|
|
36
36
|
# endif
|
|
37
|
-
# if ICE_INT_VERSION % 100 <
|
|
37
|
+
# if ICE_INT_VERSION % 100 < 3
|
|
38
38
|
# error Ice patch level mismatch!
|
|
39
39
|
# endif
|
|
40
40
|
#endif
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) ZeroC, Inc.
|
|
2
2
|
|
|
3
|
-
// slice2cpp version 3.8.
|
|
3
|
+
// slice2cpp version 3.8.3
|
|
4
4
|
// <auto-generated>Generated from Slice file 'Context.ice'.</auto-generated>
|
|
5
5
|
|
|
6
6
|
#ifndef ICE_API_EXPORTS
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
# if ICE_INT_VERSION % 100 >= 50
|
|
35
35
|
# error Beta header file detected
|
|
36
36
|
# endif
|
|
37
|
-
# if ICE_INT_VERSION % 100 <
|
|
37
|
+
# if ICE_INT_VERSION % 100 < 3
|
|
38
38
|
# error Ice patch level mismatch!
|
|
39
39
|
# endif
|
|
40
40
|
#endif
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) ZeroC, Inc.
|
|
2
2
|
|
|
3
|
-
// slice2cpp version 3.8.
|
|
3
|
+
// slice2cpp version 3.8.3
|
|
4
4
|
// <auto-generated>Generated from Slice file 'EndpointTypes.ice'.</auto-generated>
|
|
5
5
|
|
|
6
6
|
#ifndef ICE_API_EXPORTS
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
# if ICE_INT_VERSION % 100 >= 50
|
|
35
35
|
# error Beta header file detected
|
|
36
36
|
# endif
|
|
37
|
-
# if ICE_INT_VERSION % 100 <
|
|
37
|
+
# if ICE_INT_VERSION % 100 < 3
|
|
38
38
|
# error Ice patch level mismatch!
|
|
39
39
|
# endif
|
|
40
40
|
#endif
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) ZeroC, Inc.
|
|
2
2
|
|
|
3
|
-
// slice2cpp version 3.8.
|
|
3
|
+
// slice2cpp version 3.8.3
|
|
4
4
|
// <auto-generated>Generated from Slice file 'Identity.ice'.</auto-generated>
|
|
5
5
|
|
|
6
6
|
#ifndef ICE_API_EXPORTS
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
# if ICE_INT_VERSION % 100 >= 50
|
|
35
35
|
# error Beta header file detected
|
|
36
36
|
# endif
|
|
37
|
-
# if ICE_INT_VERSION % 100 <
|
|
37
|
+
# if ICE_INT_VERSION % 100 < 3
|
|
38
38
|
# error Ice patch level mismatch!
|
|
39
39
|
# endif
|
|
40
40
|
#endif
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) ZeroC, Inc.
|
|
2
2
|
|
|
3
|
-
// slice2cpp version 3.8.
|
|
3
|
+
// slice2cpp version 3.8.3
|
|
4
4
|
// <auto-generated>Generated from Slice file 'Locator.ice'.</auto-generated>
|
|
5
5
|
|
|
6
6
|
#ifndef ICE_API_EXPORTS
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
# if ICE_INT_VERSION % 100 >= 50
|
|
35
35
|
# error Beta header file detected
|
|
36
36
|
# endif
|
|
37
|
-
# if ICE_INT_VERSION % 100 <
|
|
37
|
+
# if ICE_INT_VERSION % 100 < 3
|
|
38
38
|
# error Ice patch level mismatch!
|
|
39
39
|
# endif
|
|
40
40
|
#endif
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) ZeroC, Inc.
|
|
2
2
|
|
|
3
|
-
// slice2cpp version 3.8.
|
|
3
|
+
// slice2cpp version 3.8.3
|
|
4
4
|
// <auto-generated>Generated from Slice file 'LocatorRegistry.ice'.</auto-generated>
|
|
5
5
|
|
|
6
6
|
#ifndef ICE_API_EXPORTS
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
# if ICE_INT_VERSION % 100 >= 50
|
|
35
35
|
# error Beta header file detected
|
|
36
36
|
# endif
|
|
37
|
-
# if ICE_INT_VERSION % 100 <
|
|
37
|
+
# if ICE_INT_VERSION % 100 < 3
|
|
38
38
|
# error Ice patch level mismatch!
|
|
39
39
|
# endif
|
|
40
40
|
#endif
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) ZeroC, Inc.
|
|
2
2
|
|
|
3
|
-
// slice2cpp version 3.8.
|
|
3
|
+
// slice2cpp version 3.8.3
|
|
4
4
|
// <auto-generated>Generated from Slice file 'Metrics.ice'.</auto-generated>
|
|
5
5
|
|
|
6
6
|
#ifndef ICE_API_EXPORTS
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
# if ICE_INT_VERSION % 100 >= 50
|
|
34
34
|
# error Beta header file detected
|
|
35
35
|
# endif
|
|
36
|
-
# if ICE_INT_VERSION % 100 <
|
|
36
|
+
# if ICE_INT_VERSION % 100 < 3
|
|
37
37
|
# error Ice patch level mismatch!
|
|
38
38
|
# endif
|
|
39
39
|
#endif
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) ZeroC, Inc.
|
|
2
2
|
|
|
3
|
-
// slice2cpp version 3.8.
|
|
3
|
+
// slice2cpp version 3.8.3
|
|
4
4
|
// <auto-generated>Generated from Slice file 'OperationMode.ice'.</auto-generated>
|
|
5
5
|
|
|
6
6
|
#ifndef ICE_API_EXPORTS
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
# if ICE_INT_VERSION % 100 >= 50
|
|
35
35
|
# error Beta header file detected
|
|
36
36
|
# endif
|
|
37
|
-
# if ICE_INT_VERSION % 100 <
|
|
37
|
+
# if ICE_INT_VERSION % 100 < 3
|
|
38
38
|
# error Ice patch level mismatch!
|
|
39
39
|
# endif
|
|
40
40
|
#endif
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) ZeroC, Inc.
|
|
2
2
|
|
|
3
|
-
// slice2cpp version 3.8.
|
|
3
|
+
// slice2cpp version 3.8.3
|
|
4
4
|
// <auto-generated>Generated from Slice file 'Process.ice'.</auto-generated>
|
|
5
5
|
|
|
6
6
|
#ifndef ICE_API_EXPORTS
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
# if ICE_INT_VERSION % 100 >= 50
|
|
34
34
|
# error Beta header file detected
|
|
35
35
|
# endif
|
|
36
|
-
# if ICE_INT_VERSION % 100 <
|
|
36
|
+
# if ICE_INT_VERSION % 100 < 3
|
|
37
37
|
# error Ice patch level mismatch!
|
|
38
38
|
# endif
|
|
39
39
|
#endif
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) ZeroC, Inc.
|
|
2
2
|
|
|
3
|
-
// slice2cpp version 3.8.
|
|
3
|
+
// slice2cpp version 3.8.3
|
|
4
4
|
// <auto-generated>Generated from Slice file 'PropertiesAdmin.ice'.</auto-generated>
|
|
5
5
|
|
|
6
6
|
#ifndef ICE_API_EXPORTS
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
# if ICE_INT_VERSION % 100 >= 50
|
|
34
34
|
# error Beta header file detected
|
|
35
35
|
# endif
|
|
36
|
-
# if ICE_INT_VERSION % 100 <
|
|
36
|
+
# if ICE_INT_VERSION % 100 < 3
|
|
37
37
|
# error Ice patch level mismatch!
|
|
38
38
|
# endif
|
|
39
39
|
#endif
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) ZeroC, Inc.
|
|
2
2
|
|
|
3
|
-
// slice2cpp version 3.8.
|
|
3
|
+
// slice2cpp version 3.8.3
|
|
4
4
|
// <auto-generated>Generated from Slice file 'PropertyDict.ice'.</auto-generated>
|
|
5
5
|
|
|
6
6
|
#ifndef ICE_API_EXPORTS
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
# if ICE_INT_VERSION % 100 >= 50
|
|
35
35
|
# error Beta header file detected
|
|
36
36
|
# endif
|
|
37
|
-
# if ICE_INT_VERSION % 100 <
|
|
37
|
+
# if ICE_INT_VERSION % 100 < 3
|
|
38
38
|
# error Ice patch level mismatch!
|
|
39
39
|
# endif
|
|
40
40
|
#endif
|