Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

restify

Package Overview
Dependencies
Maintainers
1
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restify - npm Package Compare versions

Comparing version 2.5.1 to 2.6.0

lib/upgrade.js

6

CHANGES.md

@@ -5,2 +5,8 @@ # restify Changelog

## 2.6.0
- EXPERIMENTAL: Native websocket support via watershed (Josh Clulow)
- Pass entire route, not just route.name to `after` (Dingman)
- Type coercion bug in Cache Control API (Chris Cannell)
## 2.5.1

@@ -7,0 +13,0 @@

@@ -155,2 +155,20 @@ // Copyright 2012 Mark Cavage, Inc. All rights reserved.

req.once('upgrade', function onUpgrade(res, socket, _head) {
clearTimeout(timer);
dtrace._rstfy_probes['client-response'].fire(function () {
return ([ id, res.statusCode, res.headers ]);
});
log.trace({client_res: res}, 'Upgrade Response received');
res.log = log;
var err;
if (res.statusCode >= 400)
err = errors.codeToHttpError(res.statusCode);
req.removeAllListeners('error');
req.removeAllListeners('socket');
req.emit('upgradeResult', (err || null), res, socket, _head);
});
req.once('socket', function onSocket(socket) {

@@ -447,1 +465,2 @@ if (socket.writable && !socket._connecting) {

};
// vim: set ts=8 sts=8 sw=8 et:

6

lib/plugins/static.js

@@ -48,4 +48,5 @@ // Copyright 2012 Mark Cavage, Inc. All rights reserved.

var fstream = fs.createReadStream(file + (isGzip ? '.gz' : ''));
var maxAge = opts.maxAge === undefined ? 3600 : opts.maxAge;
fstream.once('open', function (fd) {
res.cache({maxAge: opts.maxAge || 3600});
res.cache({maxAge: maxAge});
res.set('Content-Length', stats.size);

@@ -97,3 +98,4 @@ res.set('Content-Type', mime.lookup(file));

function serve(req, res, next) {
var file = path.join(opts.directory, req.path());
var file = path.join(opts.directory,
decodeURIComponent(req.path()));

@@ -100,0 +102,0 @@ if (req.method !== 'GET' && req.method !== 'HEAD') {

@@ -89,2 +89,7 @@ // Copyright 2012 Mark Cavage, Inc. All rights reserved.

// We should not attempt to read and parse the body of an
// Upgrade request, so force Content-Length to zero:
if (this.isUpgradeRequest())
return (0);
var len = this.header('content-length');

@@ -280,2 +285,10 @@ if (!len) {

Request.prototype.isUpgradeRequest = function isUpgradeRequest() {
if (this._upgradeRequest !== undefined)
return (this._upgradeRequest);
else
return (false);
};
Request.prototype.isUpload = function isUpload() {

@@ -282,0 +295,0 @@ var m = this.method;

@@ -33,3 +33,3 @@ // Copyright 2012 Mark Cavage, Inc. All rights reserved.

if (options && options.maxAge) {
if (options && options.maxAge !== undefined) {
assert.number(options.maxAge, 'options.maxAge');

@@ -36,0 +36,0 @@ type += ', max-age=' + options.maxAge;

@@ -20,2 +20,3 @@ // Copyright 2012 Mark Cavage, Inc. All rights reserved.

var shallowCopy = require('./utils').shallowCopy;
var upgrade = require('./upgrade');

@@ -45,4 +46,3 @@ var semver = require('semver');

'listening',
'secureConnection',
'upgrade'
'secureConnection'
];

@@ -221,2 +221,4 @@

if (!options.handleUpgrades && PROXY_EVENTS.indexOf('upgrade') === -1)
PROXY_EVENTS.push('upgrade');
PROXY_EVENTS.forEach(function (e) {

@@ -240,2 +242,12 @@ self.server.on(e, self.emit.bind(self, e));

if (options.handleUpgrades) {
this.server.on('upgrade', function onUpgrade(req, socket,
head) {
req._upgradeRequest = true;
var res = upgrade.createResponse(req, socket, head);
self._setupRequest(req, res);
self._handle(req, res);
});
}
this.server.on('request', function onRequest(req, res) {

@@ -571,4 +583,6 @@ /* JSSTYLED */

req.route = route.spec;
var chain = self.routes[route];
var r = route ? route.name : null;
var chain = self.routes[r];
self._run(req, res, route, chain, function done(e) {

@@ -624,3 +638,3 @@ self.emit('after', req, res, route, e);

} else {
cb(r, ctx);
cb(route, ctx);
}

@@ -780,1 +794,3 @@ });

};
// vim: set et ts=8 sts=8 sw=8:

@@ -7,2 +7,3 @@ {

"Dominic Barnes",
"Josh Clulow",
"Jonathan Dahan",

@@ -33,3 +34,3 @@ "Domenic Denicola",

"description": "REST framework",
"version": "2.5.1",
"version": "2.6.0",
"repository": {

@@ -74,3 +75,4 @@ "type": "git",

"filed": "0.0.7",
"nodeunit": "0.8.0"
"nodeunit": "0.8.0",
"watershed": "0.3.0"
},

@@ -77,0 +79,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc