Skip to content

Loading…

Replace 'node-crc' with MIT licensed 'buffer-crc32' #714

Merged
merged 1 commit into from

2 participants

@mdp

The 'crc' package is using code that is not freely licensed(MIT/BSD)
alexgorbatchev/node-crc#2

Express also moved to 'buffer-crc32' recently because of this issue.

Fixes senchalabs/connect#712

@mdp mdp Replace 'node-crc' with 'buffer-crc32', fixes licensing
The 'crc' package is using code that is not freely licensed(MIT/BSD)
alexgorbatchev/node-crc#2

Express also moved to 'buffer-crc32' recently because of this issue.

Fixes senchalabs/connect#712
fe6ba40
@tj tj merged commit 5f61298 into senchalabs:master

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 21, 2012
  1. @mdp

    Replace 'node-crc' with 'buffer-crc32', fixes licensing

    mdp committed
    The 'crc' package is using code that is not freely licensed(MIT/BSD)
    alexgorbatchev/node-crc#2
    
    Express also moved to 'buffer-crc32' recently because of this issue.
    
    Fixes senchalabs/connect#712
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 6 deletions.
  1. +3 −3 lib/middleware/cookieSession.js
  2. +2 −2 lib/middleware/session.js
  3. +1 −1 package.json
View
6 lib/middleware/cookieSession.js
@@ -13,7 +13,7 @@ var utils = require('./../utils')
, Cookie = require('./session/cookie')
, debug = require('debug')('connect:cookieSession')
, signature = require('cookie-signature')
- , crc16 = require('crc').crc16;
+ , crc32 = require('buffer-crc32');
/**
* Cookie Session:
@@ -71,7 +71,7 @@ module.exports = function cookieSession(options){
if (rawCookie) {
var unsigned = utils.parseSignedCookie(rawCookie, secret);
if (unsigned) {
- var originalHash = crc16(unsigned);
+ var originalHash = crc32.signed(unsigned);
req.session = utils.parseJSONCookie(unsigned) || {};
}
}
@@ -101,7 +101,7 @@ module.exports = function cookieSession(options){
var val = 'j:' + JSON.stringify(req.session);
// compare hashes, no need to set-cookie if unchanged
- if (originalHash == crc16(val)) return debug('unmodified session');
+ if (originalHash == crc32.signed(val)) return debug('unmodified session');
// set-cookie
val = 's:' + signature.sign(val, secret);
View
4 lib/middleware/session.js
@@ -18,7 +18,7 @@ var Session = require('./session/session')
, Store = require('./session/store')
, utils = require('./../utils')
, parse = utils.parseUrl
- , crc16 = require('crc').crc16;
+ , crc32 = require('buffer-crc32');
// environment
@@ -346,7 +346,7 @@ function session(options){
*/
function hash(sess) {
- return crc16(JSON.stringify(sess, function(key, val){
+ return crc32.signed(JSON.stringify(sess, function(key, val){
if ('cookie' != key) return val;
}));
}
View
2 package.json
@@ -9,7 +9,7 @@
"qs": "0.5.1",
"formidable": "1.0.11",
"cookie-signature": "0.0.1",
- "crc": "0.2.0",
+ "buffer-crc32": "0.1.1",
"cookie": "0.0.5",
"bytes": "0.0.1",
"send": "0.1.0",
Something went wrong with that request. Please try again.