Socket
Socket
Sign inDemoInstall

@loopback/http-server

Package Overview
Dependencies
3
Maintainers
7
Versions
142
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.12 to 2.2.0

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

# [2.2.0](https://github.com/strongloop/loopback-next/compare/@loopback/http-server@2.1.12...@loopback/http-server@2.2.0) (2020-08-27)
### Features
* **http-server:** add debugging statements for http-server package ([ffde907](https://github.com/strongloop/loopback-next/commit/ffde907c188ca48163eb0ba1bb7b0e0ecb612367))
* **rest:** make sure rest options are passed to http-server ([e9af196](https://github.com/strongloop/loopback-next/commit/e9af1961dfe2aaae3c07e3100f6fe538797943e0))
## [2.1.12](https://github.com/strongloop/loopback-next/compare/@loopback/http-server@2.1.11...@loopback/http-server@2.1.12) (2020-08-19)

@@ -8,0 +20,0 @@

2

dist/http-server.d.ts

@@ -59,3 +59,3 @@ /// <reference types="node" />

private _stoppable;
private serverOptions;
readonly serverOptions: HttpServerOptions;
/**

@@ -62,0 +62,0 @@ * @param requestListener

@@ -10,2 +10,3 @@ "use strict";

const assert_1 = tslib_1.__importDefault(require("assert"));
const debug_1 = tslib_1.__importDefault(require("debug"));
const events_1 = require("events");

@@ -16,2 +17,3 @@ const http_1 = tslib_1.__importDefault(require("http"));

const stoppable_1 = tslib_1.__importDefault(require("stoppable"));
const debug = debug_1.default('loopback:http-server');
/**

@@ -28,5 +30,11 @@ * HTTP / HTTPS server used by LoopBack's RestServer

this._listening = false;
debug('Http server options', serverOptions);
this.requestListener = requestListener;
this.serverOptions = Object.assign({ port: 0, host: undefined }, serverOptions);
this.serverOptions = {
port: 0,
host: undefined,
...serverOptions,
};
if (this.serverOptions.path) {
debug('Http server with IPC path %s', this.serverOptions.path);
const ipcPath = this.serverOptions.path;

@@ -46,2 +54,3 @@ checkNamedPipe(ipcPath);

if (typeof this.serverOptions.gracePeriodForClose === 'number') {
debug('Http server gracePeriodForClose %d', this.serverOptions.gracePeriodForClose);
this._stoppable = stoppable_1.default(this.server, this.serverOptions.gracePeriodForClose);

@@ -54,2 +63,3 @@ }

async start() {
debug('Starting http server', this.serverOptions);
this.server.listen(this.serverOptions);

@@ -61,2 +71,3 @@ await events_1.once(this.server, 'listening');

this._address = address;
debug('Http server is listening on', this.url);
}

@@ -69,3 +80,5 @@ /**

return;
debug('Stopping http server');
if (this._stoppable != null) {
debug('Stopping http server with graceful close');
this._stoppable.stop();

@@ -78,2 +91,3 @@ }

this._listening = false;
debug('Http server is stopped');
}

@@ -80,0 +94,0 @@ /**

{
"name": "@loopback/http-server",
"version": "2.1.12",
"version": "2.2.0",
"description": "A wrapper for creating HTTP/HTTPS servers",

@@ -24,2 +24,3 @@ "main": "dist/index.js",

"dependencies": {
"debug": "^4.1.1",
"stoppable": "^1.1.0",

@@ -29,6 +30,7 @@ "tslib": "^2.0.1"

"devDependencies": {
"@loopback/build": "^6.2.1",
"@loopback/core": "^2.9.4",
"@loopback/eslint-config": "^9.0.1",
"@loopback/testlab": "^3.2.3",
"@loopback/build": "^6.2.2",
"@loopback/core": "^2.9.5",
"@loopback/eslint-config": "^9.0.2",
"@loopback/testlab": "^3.2.4",
"@types/debug": "^4.1.5",
"@types/node": "^10.17.28",

@@ -48,3 +50,3 @@ "@types/stoppable": "^1.1.0"

},
"gitHead": "a056555744367da9caccb6be64095e27d2fe2e28"
"gitHead": "a3f54273814de63819e0d8bc86509f8a737800bb"
}

@@ -7,2 +7,3 @@ // Copyright IBM Corp. 2018,2020. All Rights Reserved.

import assert from 'assert';
import debugFactory from 'debug';
import {once} from 'events';

@@ -14,2 +15,3 @@ import http, {IncomingMessage, ServerResponse} from 'http';

import stoppable from 'stoppable';
const debug = debugFactory('loopback:http-server');

@@ -79,3 +81,3 @@ /**

private _stoppable: stoppable.StoppableServer;
private serverOptions: HttpServerOptions;
readonly serverOptions: HttpServerOptions;

@@ -90,8 +92,11 @@ /**

) {
debug('Http server options', serverOptions);
this.requestListener = requestListener;
this.serverOptions = Object.assign(
{port: 0, host: undefined},
serverOptions,
);
this.serverOptions = {
port: 0,
host: undefined,
...serverOptions,
};
if (this.serverOptions.path) {
debug('Http server with IPC path %s', this.serverOptions.path);
const ipcPath = this.serverOptions.path;

@@ -113,2 +118,6 @@ checkNamedPipe(ipcPath);

if (typeof this.serverOptions.gracePeriodForClose === 'number') {
debug(
'Http server gracePeriodForClose %d',
this.serverOptions.gracePeriodForClose,
);
this._stoppable = stoppable(

@@ -125,2 +134,3 @@ this.server,

public async start() {
debug('Starting http server', this.serverOptions);
this.server.listen(this.serverOptions);

@@ -133,2 +143,3 @@ await once(this.server, 'listening');

this._address = address!;
debug('Http server is listening on', this.url);
}

@@ -141,3 +152,5 @@

if (!this._listening) return;
debug('Stopping http server');
if (this._stoppable != null) {
debug('Stopping http server with graceful close');
this._stoppable.stop();

@@ -149,2 +162,3 @@ } else {

this._listening = false;
debug('Http server is stopped');
}

@@ -151,0 +165,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc