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

nodecaf

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodecaf - npm Package Compare versions

Comparing version 0.11.0-rc4 to 0.11.0-rc5

21

lib/http.js
const { URL } = require('url');
const querystring = require('querystring');
const cookie = require('cookie');
const cookieSignature = require('cookie-signature');
const http = require('http');

@@ -25,4 +27,13 @@

function handleCookies(app, req, res){
return forMiddleware(app._cookies, req, res);
function parseCookies(cconf, req){
req.cookies = cookie.parse(req.headers.cookie);
req.signedCookies = {};
for(let key in req.cookies)
if(req.cookies[key] && req.cookies[key].substr(0, 2) == 's:'){
let val = cookieSignature.unsign(req.cookies[key].substr(2), cconf.secret);
if(val){
req.signedCookies[key] = val;
delete req.cookies[key];
}
}
}

@@ -37,4 +48,8 @@

await forMiddleware(app._compress, req, res);
await handleCookies(app, req, res);
if(app.conf.cookie)
req.secret = app.conf.cookie.secret;
if(req.headers.cookie)
parseCookies(app.conf.cookie, req);
if(app.conf.cors)

@@ -41,0 +56,0 @@ await handleCORS(app, req, res);

4

lib/main.js

@@ -6,4 +6,3 @@ const

Logger = require('golog'),
compression = require('compression'),
cookieParser = require('cookie-parser');
compression = require('compression');

@@ -80,3 +79,2 @@ const { startServer } = require('./http');

this._cors = cors(this.conf.cors);
this._cookies = cookieParser(this.conf.cookie && this.conf.cookie.secret);
this._compress = compression();

@@ -83,0 +81,0 @@

{
"name": "nodecaf",
"version": "0.11.0-rc4",
"version": "0.11.0-rc5",
"description": "Nodecaf is a light framework for developing RESTful Apps in a quick and convenient manner.",

@@ -44,3 +44,2 @@ "main": "lib/main.js",

"cookie": "^0.4.1",
"cookie-parser": "^1.4.5",
"cookie-signature": "^1.1.0",

@@ -47,0 +46,0 @@ "cors": "^2.8.5",

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