Comparing version 0.1.6 to 0.1.7
@@ -241,4 +241,7 @@ /* | ||
it('tls connection', function(done) { | ||
while_running(done, [example('tls/tls_server.js', ['-p', '8888']).produces('Connected: TestClient\n')]).verify([example('tls/tls_client.js', ['-p', '8888']).produces('Connected!\n')]); | ||
while_running(done, [example('tls/tls_server.js', ['-p', '8888']).produces('Connected: TestClient [localhost]\n')]).verify([example('tls/tls_client.js', ['-p', '8888']).produces('Connected!\n')]); | ||
}); | ||
it('tls connection with SNI', function(done) { | ||
while_running(done, [example('tls/tls_server.js', ['-p', '8888']).produces('Connected: TestClient [localhost]\n')]).verify([example('tls/tls_client.js', ['-p', '8888', '-h', '127.0.0.1', '-s', 'localhost']).produces('Connected!\n')]); | ||
}); | ||
it('sasl anonymous', function(done) { | ||
@@ -245,0 +248,0 @@ while_running(done, [example('sasl/sasl_anonymous_server.js', ['-p', '8888']).produces('Connected!\n')] |
@@ -20,4 +20,6 @@ /* | ||
var args = require('yargs').options({ | ||
'p': { alias: 'port', default: 5671, describe: 'port to connect to'} | ||
}).help('help').argv; | ||
's': {alias: 'servername', default: undefined, describe: 'name to use for SNI'}, | ||
'h': {alias: 'host', default: 'localhost', describe: 'host to connect to'}, | ||
'p': { alias: 'port', default: 5671, describe: 'port to connect to'} | ||
}).help('help').argv; | ||
@@ -29,3 +31,4 @@ | ||
}); | ||
container.connect({port:args.port, transport:'tls', | ||
container.connect({host:args.host, port:args.port, transport:'tls', | ||
servername:args.servername, | ||
//enable_sasl_external:true, | ||
@@ -32,0 +35,0 @@ // These are necessary only if using the client certificate authentication |
@@ -27,3 +27,6 @@ /* | ||
if (cert && cert.subject) cn = cert.subject.CN; | ||
console.log('Connected: ' + cn); | ||
var tls = context.connection.get_tls_socket(); | ||
var servername; | ||
if (tls && tls.servername) servername = tls.servername; | ||
console.log('Connected: ' + cn + ((tls && tls.servername) ? ' [' + tls.servername + ']' : '')); | ||
}); | ||
@@ -30,0 +33,0 @@ var listener = container.listen({port:args.port, transport:'tls', |
@@ -379,2 +379,4 @@ /* | ||
this.socket.end(); | ||
} else if (this.is_open() && this.remote.open.idle_time_out && !this.heartbeat_out) { | ||
this.heartbeat_out = setTimeout(this._write_frame.bind(this), this.remote.open.idle_time_out / 2); | ||
} | ||
@@ -527,2 +529,10 @@ }; | ||
Connection.prototype.get_tls_socket = function() { | ||
if (this.socket && (this.options.transport === 'tls' || this.options.transport === 'ssl')) { | ||
return this.socket; | ||
} else { | ||
return undefined; | ||
} | ||
}; | ||
Connection.prototype._context = function (c) { | ||
@@ -529,0 +539,0 @@ var context = c ? c : {}; |
@@ -167,5 +167,6 @@ /* | ||
var MAX_UINT = 4294967296; // 2^32 | ||
var MIN_INT = -2147483647; | ||
function write_ulong(buffer, value, offset) { | ||
if ((typeof value) === "number" || value instanceof Number) { | ||
var hi = Math.round(value / MAX_UINT); | ||
var hi = Math.floor(value / MAX_UINT); | ||
var lo = value % MAX_UINT; | ||
@@ -192,3 +193,3 @@ buffer.writeUInt32BE(hi, offset); | ||
var abs = Math.abs(value); | ||
var hi = Math.round(abs / MAX_UINT); | ||
var hi = Math.floor(abs / MAX_UINT); | ||
var lo = abs % MAX_UINT; | ||
@@ -365,8 +366,16 @@ buffer.writeInt32BE(hi, offset); | ||
} else if (o > 0) { | ||
return types.wrap_uint(o); | ||
if (o < MAX_UINT) { | ||
return types.wrap_uint(o); | ||
} else { | ||
return types.wrap_ulong(o); | ||
} | ||
} else { | ||
return types.wrap_int(o); | ||
if (o > MIN_INT) { | ||
return types.wrap_int(o); | ||
} else { | ||
return types.wrap_long(o); | ||
} | ||
} | ||
} else if (o instanceof Date) { | ||
//??? TODO ??? | ||
return types.wrap_timestamp(o.getTime()); | ||
} else if (o instanceof Typed) { | ||
@@ -373,0 +382,0 @@ return o; |
{ | ||
"name" : "rhea", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "reactive AMQP 1.0 library", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/grs/rhea", |
@@ -189,2 +189,6 @@ # rhea | ||
If the transport is TLS, the options may additionally specify a | ||
'servername' property. This allows the SNI to be controlled separately | ||
from the host option. If servername is not specified, the SNI will | ||
default to the host. | ||
@@ -191,0 +195,0 @@ ##### listen(options) |
@@ -67,2 +67,8 @@ /* | ||
})); | ||
it('sends and receives long property', transfer_test({application_properties:{big:1467407965596}}, function(message) { | ||
assert.equal(message.application_properties.big, 1467407965596); | ||
})); | ||
it('sends and receives ulong property', transfer_test({application_properties:{bigneg:-1234567898765}}, function(message) { | ||
assert.equal(message.application_properties.bigneg, -1234567898765); | ||
})); | ||
it('sends and receives string message annotation', transfer_test({message_annotations:{colour:'blue'}}, function(message) { | ||
@@ -113,2 +119,3 @@ assert.equal(message.message_annotations.colour, 'blue'); | ||
large_negative:amqp_types.wrap_long(-1000000000), | ||
awkward:amqp_types.wrap_long(1467407965596), | ||
max:amqp_types.wrap_long(9007199254740992), | ||
@@ -123,2 +130,3 @@ min:amqp_types.wrap_long(-9007199254740992) | ||
assert.equal(message.body.large_negative, -1000000000); | ||
assert.equal(message.body.awkward, 1467407965596); | ||
assert.equal(message.body.max, 9007199254740992); | ||
@@ -125,0 +133,0 @@ assert.equal(message.body.min, -9007199254740992); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
309506
6585
443