Comparing version 0.17.0 to 0.18.0
@@ -393,15 +393,13 @@ /* | ||
function urlPropertyToPacketOption(url, req, property, option, separator) { | ||
if (url[property]) | ||
req.setOption(option, url[property].split(separator) | ||
.filter(function(part) { return part !== '' }) | ||
.map(function(part) { | ||
var buf = new Buffer(Buffer.byteLength(part)) | ||
buf.write(part) | ||
return buf | ||
})) | ||
req.setOption(option, url[property].normalize('NFC').split(separator) | ||
.filter(function(part) { return part !== '' }) | ||
.map(function(part) { | ||
var buf = new Buffer(Buffer.byteLength(part)) | ||
buf.write(part) | ||
return buf | ||
})) | ||
} | ||
module.exports = Agent |
@@ -12,2 +12,3 @@ /* | ||
var dgram = require('dgram') | ||
, os = require('os') | ||
, net = require('net') | ||
@@ -166,2 +167,21 @@ , util = require('util') | ||
function allAddresses(type) { | ||
var family = 'IPv4' | ||
if (type === 'udp6') { | ||
family = 'IPv6' | ||
} | ||
var addresses = []; | ||
var interfaces = os.networkInterfaces(); | ||
for (var ifname in interfaces) { | ||
if (interfaces.hasOwnProperty(ifname)) { | ||
interfaces[ifname].forEach(function (a) { | ||
if (a.family == family) { | ||
addresses.push(a.address) | ||
} | ||
}) | ||
} | ||
} | ||
return addresses; | ||
} | ||
CoAPServer.prototype.listen = function(port, address, done) { | ||
@@ -199,7 +219,3 @@ var that = this | ||
if (process.version.indexOf('v0.10') === -1) { | ||
this._sock = dgram.createSocket({type: this._options.type, reuseAddr : true}, handleRequest(this)) | ||
} else { | ||
this._sock = dgram.createSocket(this._options.type, handleRequest(this)) | ||
} | ||
this._sock = dgram.createSocket({type: this._options.type, reuseAddr : true}, handleRequest(this)) | ||
@@ -217,3 +233,5 @@ this._sock.on('error', function(error) { | ||
} else { | ||
that._sock.addMembership(that._multicastAddress) | ||
allAddresses(that._options.type).forEach(function(interface) { | ||
that._sock.addMembership(that._multicastAddress, interface) | ||
}) | ||
} | ||
@@ -220,0 +238,0 @@ } |
{ | ||
"name": "coap", | ||
"version": "0.17.0", | ||
"version": "0.18.0", | ||
"description": "A CoAP library for node modelled after 'http'", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -137,2 +137,17 @@ /* | ||
it('should normalize strings using NFC', function(done) { | ||
var req = coap.request({ | ||
port: port | ||
// U+210E (plank constant) becomes to U+0068 (h) in “compatible” normalizations (should not happen) | ||
// U+0065 (e) U+0301 (combining acute accent) becomes U+00e9 (é) in “composed” normalizations (should happen) | ||
, pathname: '/\u210e/\u0065\u0301' | ||
}).end() | ||
server.on('request', function(req, res) { | ||
expect(req.url).to.equal('/\u210e/\u00e9') | ||
done() | ||
res.end() | ||
}) | ||
}) | ||
describe('formats', function() { | ||
@@ -139,0 +154,0 @@ var formats = [ 'text/plain', 'application/link-format', |
@@ -224,3 +224,3 @@ /* | ||
expect(res.code).to.eql('5.00'); | ||
expect(res.payload.toString()).to.contain('ENOTFOUND'); | ||
expect(res.payload.toString()).to.match(/ENOTFOUND|EAI_AGAIN/); | ||
done() | ||
@@ -227,0 +227,0 @@ }) |
Sorry, the diff of this file is not supported yet
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
178458
4981