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

node-http-server

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-http-server - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0

2

package.json
{
"name": "node-http-server",
"version": "2.1.0",
"version": "3.0.0",
"description": "A very simple and fast http server for node, bash, and spawnable from C, Python etc. It is lightweight and great for embedded solutions as well as everyday development or public facing apps.",

@@ -5,0 +5,0 @@ "main": "server/http.js",

@@ -0,1 +1,4 @@

/*jslint node: true */
'use strict';
var http = require('http'),

@@ -35,3 +38,3 @@ url = require('url'),

function config(userConfig){
var config={
var configObj={
verbose : (args.verbose=='true')||false,

@@ -82,7 +85,7 @@ port : args.port||defaults.port,

}
}
};
if(userConfig){
for(var k in userConfig){
config[k]=userConfig[k];
configObj[k]=userConfig[k];
}

@@ -93,3 +96,3 @@ }

fs.exists(
config.log,
configObj.log,
function(exists){

@@ -101,6 +104,6 @@ data.timestamp=new Date().getTime();

if(!exists)
method='writeFile'
method='writeFile';
fs[method](
config.log,
configObj.log,
JSONData,

@@ -116,6 +119,6 @@ function (err) {

return config;
};
return configObj;
}
function deploy(userConfig){
function deploy(userConfig, readyCallback){
var server=http.createServer(

@@ -130,7 +133,12 @@ requestRecieved

server.listen(server.config.port);
server.listen(
server.config.port,
function() {
if(server.config.verbose)
console.log(server.config.logID+' listening on port '+server.config.port+' ###\n\n');
if (readyCallback)
readyCallback();
}
);
if(server.config.verbose)
console.log(server.config.logID+' listening on port '+server.config.port+' ###\n\n');
function serveFile(filename,exists,response) {

@@ -204,3 +212,3 @@ if(!exists) {

'Content-Type' : server.config.contentType[contentType]
}
};

@@ -235,3 +243,3 @@ if(server.config.server.noCache)

'Content-type':'text/plain'
}
};

@@ -261,3 +269,3 @@ if(server.config.verbose)

headers : request.headers
}
};

@@ -276,4 +284,4 @@ server.config.logFunction(

var hostname= [];
if (request.headers.host != undefined)
var hostname= [];
if (request.headers.host !== undefined)
hostname = request.headers.host.split(':');

@@ -291,7 +299,7 @@ var root = server.config.root;

if(server.config.verbose){
console.log(server.config.logID+' REQUEST ###\n\n',
request.headers,'\n',
uri,'\n\n',
hostname,'\n\n'
);
console.log(server.config.logID+' REQUEST ###\n\n',
request.headers,'\n',
uri,'\n\n',
hostname,'\n\n'
);
}

@@ -310,3 +318,3 @@

function(exists){
serveFile(filename,exists,response)
serveFile(filename,exists,response);
}

@@ -323,2 +331,2 @@ );

configTemplate : config
}
};
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