diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-09-24 12:35:38 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-09-24 12:35:38 +0200 |
commit | c74b14cc8d247109c8a877e4c9b948a9d9143d61 (patch) | |
tree | 87ad62ab9e03e960f6081fd55ec1483774e95a88 /js/src/Ice/EndpointFactoryManager.js | |
parent | bug fix in IceGrid admin client (diff) | |
download | ice-c74b14cc8d247109c8a877e4c9b948a9d9143d61.tar.bz2 ice-c74b14cc8d247109c8a877e4c9b948a9d9143d61.tar.xz ice-c74b14cc8d247109c8a877e4c9b948a9d9143d61.zip |
Fixed ICE-5535, WSS hang and other minor issues
- ICE-5535: added support for parsing TCP/SSL/WS/WSS endpoints even if the transport isn't supported
- WSS implementation could hang under Java/C# if the SSL transport read too much data
- The opaque endpoint un-marshalling code in Java/C# could raise an EncapsulationException where it should have raised an UnarmshalOutOfBoundsException if the marshalled endpoint was invalid.
- Cleaned up JavaScript run methods for tests
- Few other minor fixes
Diffstat (limited to 'js/src/Ice/EndpointFactoryManager.js')
-rw-r--r-- | js/src/Ice/EndpointFactoryManager.js | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/js/src/Ice/EndpointFactoryManager.js b/js/src/Ice/EndpointFactoryManager.js index af60f12dc7c..0e502600114 100644 --- a/js/src/Ice/EndpointFactoryManager.js +++ b/js/src/Ice/EndpointFactoryManager.js @@ -61,23 +61,15 @@ var EndpointFactoryManager = Ice.Class({ throw new EndpointParseException("value has no non-whitespace characters"); } - var protocol; - var rest = ""; - var i, length; - var pos = s.search(/[ \t\n\r]+/); - if(pos === -1) + var arr = s.split(/[ \t\n\r]+/); + if(arr.length === 0) { - protocol = s; - } - else - { - protocol = s.substring(0, pos); - if(pos < s.length) - { - rest = s.substring(pos); - } + throw new EndpointParseException("value has no non-whitespace characters"); } + var protocol = arr[0]; + arr.splice(0, 1); + if(protocol === "default") { protocol = this._instance.defaultsAndOverrides().defaultProtocol; @@ -87,7 +79,13 @@ var EndpointFactoryManager = Ice.Class({ { if(this._factories[i].protocol() === protocol) { - return this._factories[i].create(rest, oaEndpoint); + var e = this._factories[i].create(arr, oaEndpoint); + if(arr.length > 0) + { + throw new EndpointParseException("unrecognized argument `" + arr[0] + "' in endpoint `" + + str + "'"); + } + return e; } } @@ -97,7 +95,13 @@ var EndpointFactoryManager = Ice.Class({ // if(protocol === "opaque") { - var ue = OpaqueEndpointI.fromString(rest); + var ue = new OpaqueEndpointI(); + ue.initWithOptions(arr); + if(arr.length > 0) + { + throw new EndpointParseException("unrecognized argument `" + arr[0] + "' in endpoint `" + str + "'"); + } + for(i = 0, length = this._factories.length; i < length; ++i) { if(this._factories[i].type() == ue.type()) @@ -108,10 +112,14 @@ var EndpointFactoryManager = Ice.Class({ // the actual endpoint. // var bs = new BasicStream(this._instance, Protocol.currentProtocolEncoding, true); + bs.writeShort(ue.type()); ue.streamWrite(bs); bs.pos = 0; bs.readShort(); // type - return this._factories[i].read(bs); + bs.startReadEncaps(); + var e = this._factories[i].read(bs); + bs.endReadEncaps(); + return e; } } return ue; // Endpoint is opaque, but we don't have a factory for its type. @@ -122,15 +130,21 @@ var EndpointFactoryManager = Ice.Class({ read: function(s) { var type = s.readShort(); - for(var i = 0; i < this._factories.length; ++i) { if(this._factories[i].type() == type) { - return this._factories[i].read(s); + s.startReadEncaps(); + var e = this._factories[i].read(s); + s.endReadEncaps(); + return e; } } - return OpaqueEndpointI.fromStream(type, s); + s.startReadEncaps(); + var e = new OpaqueEndpointI(type); + e.initWithStream(s); + s.endReadEncaps(); + return e; }, destroy: function() { |