Socket
Socket
Sign inDemoInstall

web-app-runner

Package Overview
Dependencies
31
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.90.27 to 0.90.28

bin/stop.js

23

lib/WebAppRunner.js

@@ -88,11 +88,18 @@ /**

/**
* shutdown middleware.
* @param request
* @param response
* @param next
*/
this.shutdown = function(request, response, next) {
var method = request.method,
url = request.url,
ip = request.ip,
msg = 'shutting down from pid: ' + process.pid;
var visitor = request.visitor,
url = visitor.url,
ip = visitor.ip,
method = visitor.method,
msg = [ 'shutting down from pid: ', process.pid, '\n' ].join('');
log.info('shutdown request from ip: ', ip, ', url: ', url);
if (ip === '127.0.0.1' && url === '/shutdown' && method === 'POST') {
log.info('shutdown request from ip: ', ip, ', url: ', url);
if (url === '/shutdown') {
response.writeHead(200, {

@@ -108,3 +115,2 @@ 'Content-Length': msg.length,

} else {
log.info('no shutdown...');
next();

@@ -118,3 +124,3 @@ }

this.stop = function() {
if (app) {
if (connection) {
log.info('closing connection...');

@@ -156,2 +162,3 @@ connection.close();

args.shift();
if (args[ 1 ] === childKey) {

@@ -158,0 +165,0 @@ server.start();

{
"name": "web-app-runner",
"version": "0.90.27",
"version": "0.90.28",
"description": "A simple HTTP application server that accepts or rejects connections based on authenticated attributes including ip, user agent, etc. The server can be used stand alone or as middleware for connect or express.",

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

@@ -26,2 +26,4 @@ # Web App Runner

require('web-app-runner').createInstance().start();
It's easy to stop this server--just hit ctrl-c.

@@ -42,3 +44,3 @@ ### Basic Server

runner.start();
runner.start();

@@ -75,2 +77,8 @@ ### Production Web Server

You can stop this server from the local host by doing this:
curl -d token=<appkey> http://127.0.0.1:<port>/shutdown
Where appkey is defined in options and the port is the current listening port. Alternatively, you can find the PID by looking in the logs and send a kill signal (-2 or -9).
#### Dynamic Configuration Example

@@ -202,2 +210,2 @@

- - -
<p><small><em>Copyright © 2014, rain city software | Version 0.90.27</em></small></p>
<p><small><em>Copyright © 2014, rain city software | Version 0.90.28</em></small></p>

@@ -58,2 +58,11 @@ /**

describe('shutdown', function() {
it('should reject a shutdown request from non-local host ip');
it('should issue a shutdown and stop from a local host ip');
});
describe('stop', function() {
it('should close an open connection');
});
describe('landingPageRouter', function() {

@@ -60,0 +69,0 @@ it('should read the index page and write to mock response');

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc