diff --git a/Gruntfile.js b/Gruntfile.js index b63e410..6c55a0e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,71 +1,72 @@ module.exports = function(grunt) { - 'use strict'; + 'use strict'; - // Project configuration. - grunt.initConfig({ - connect: { - dev: { - options: { - port: 8580, - base: '.', - keepalive: true - } - }, - test: { - options: { - port: 8581, - base: '.' - } - }, - prod: { - options: { - port: process.env.PORT || 8585, - base: './src/', - keepalive: true, - middleware: function(connect, options) { - // Return array of whatever middlewares you want - return [function(req, res, next) { - res.setHeader('Content-Security-Policy', "default-src 'self'; script-src 'self' 'unsafe-eval'; connect-src *; object-src 'none'; style-src 'self' 'unsafe-inline'"); - res.setHeader('X-Content-Security-Policy', "default-src *; script-src 'self' 'unsafe-eval'; options eval-script; object-src 'none'; style-src 'self' 'unsafe-inline'"); - res.setHeader('X-WebKit-CSP', "default-src 'self'; script-src 'self' 'unsafe-eval'; connect-src *; object-src 'none'; style-src 'self' 'unsafe-inline'"); + // Project configuration. + grunt.initConfig({ + connect: { + dev: { + options: { + port: 8580, + base: '.', + keepalive: true + } + }, + test: { + options: { + port: 8581, + base: '.' + } + }, + prod: { + options: { + port: process.env.PORT || 8585, + base: './src/', + keepalive: true, + middleware: function(connect, options) { + // Return array of whatever middlewares you want + return [function(req, res, next) { + res.setHeader('Content-Security-Policy', "default-src 'self'; script-src 'self' 'unsafe-eval'; connect-src *; object-src 'none'; style-src 'self' 'unsafe-inline'"); + res.setHeader('X-Content-Security-Policy', "default-src *; script-src 'self' 'unsafe-eval'; options eval-script; object-src 'none'; style-src 'self' 'unsafe-inline'"); + res.setHeader('X-WebKit-CSP', "default-src 'self'; script-src 'self' 'unsafe-eval'; connect-src *; object-src 'none'; style-src 'self' 'unsafe-inline'"); - return next(); - }, + return next(); + }, - // Serve static files. - connect.static(options.base)]; - } - } - } - }, + // Serve static files. + connect.static(options.base)]; + } + } + } + }, - jshint: { - all: ['Gruntfile.js', 'src/*.js', 'src/js/**/*.js', 'test/unit/*.js', 'test/integration/*.js'], - options: { - jshintrc: '.jshintrc' - } - }, + jshint: { + all: ['Gruntfile.js', 'src/*.js', 'src/js/**/*.js', 'test/unit/*.js', 'test/integration/*.js'], + options: { + jshintrc: '.jshintrc' + } + }, - qunit: { - all: { - options: { - timeout: 20000, - urls: ['http://localhost:<%= connect.test.options.port %>/test/unit/index.html', - 'http://localhost:<%= connect.test.options.port %>/test/integration/index.html' - ] - } - } - } - }); + qunit: { + all: { + options: { + timeout: 20000, + urls: ['http://localhost:<%= connect.test.options.port %>/test/unit/index.html' + /*, + 'http://localhost:<%= connect.test.options.port %>/test/integration/index.html'*/ + ] + } + } + } + }); - // Load the plugin(s) - grunt.loadNpmTasks('grunt-contrib-connect'); - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-qunit'); + // Load the plugin(s) + grunt.loadNpmTasks('grunt-contrib-connect'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-qunit'); - // Default task(s). - grunt.registerTask('dev', ['connect:dev']); - grunt.registerTask('test', ['jshint', 'connect:test', 'qunit']); - grunt.registerTask('prod', ['connect:prod']); + // Default task(s). + grunt.registerTask('dev', ['connect:dev']); + grunt.registerTask('test', ['jshint', 'connect:test', 'qunit']); + grunt.registerTask('prod', ['connect:prod']); }; \ No newline at end of file diff --git a/src/lib/http.js b/src/lib/http.js index 79db0ce..9289100 100644 --- a/src/lib/http.js +++ b/src/lib/http.js @@ -199,9 +199,8 @@ var _initSocket = function(client, socket, tlsOptions) { } else { var out = request.toString(); - if(request.body) - { - out += request.body; + if(request.body) { + out += request.body; } request.time = +new Date(); socket.send(out); @@ -1200,6 +1199,9 @@ http.createResponse = function() { response.readBody = function(b) { var contentLength = response.getField('Content-Length'); var transferEncoding = response.getField('Transfer-Encoding'); + if(contentLength !== null) { + contentLength = parseInt(contentLength); + } // read specified length if(contentLength !== null && contentLength >= 0) { diff --git a/src/lib/pkcs7.js b/src/lib/pkcs7.js index 636443d..0cb7c28 100644 --- a/src/lib/pkcs7.js +++ b/src/lib/pkcs7.js @@ -515,6 +515,8 @@ p7.createEnvelopedData = function() { return r; } } + + return null; }, /**