New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bare-http1

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bare-http1 - npm Package Compare versions

Comparing version

to
3.8.2

18

lib/server-connection.js
const tcp = require('bare-tcp')
const { isEnded, isFinished, getStreamError } = require('bare-stream')
const HTTPIncomingMessage = require('./incoming-message')

@@ -36,3 +37,3 @@ const HTTPServerResponse = require('./server-response')

this._onerror = this._onerror.bind(this)
this._onclose = this._onclose.bind(this)
this._ondata = this._ondata.bind(this)

@@ -43,3 +44,4 @@ this._ondrain = this._ondrain.bind(this)

socket
.on('error', this._onerror)
.on('error', noop)
.on('close', this._onclose)
.on('data', this._ondata)

@@ -58,4 +60,7 @@ .on('drain', this._ondrain)

_onerror (err) {
this.socket.destroy(err)
_onclose () {
if (this.req && !isEnded(this.req)) this.req.destroy()
if (this.res && !isFinished(this.res)) this.res.destroy()
const err = getStreamError(this.socket)
if (err) this.socket.destroy(err)
}

@@ -238,3 +243,4 @@

this.socket
.off('error', this._onerror)
.off('error', noop)
.off('close', this._onclose)
.off('data', this._ondata)

@@ -247,1 +253,3 @@ .off('drain', this._ondrain)

}
function noop () {}
{
"name": "bare-http1",
"version": "3.8.1",
"version": "3.8.2",
"description": "Native HTTP/1 library for JavaScript",

@@ -29,3 +29,3 @@ "exports": {

"bare-events": "^2.0.0",
"bare-stream": "^2.0.0",
"bare-stream": "^2.3.0",
"bare-tcp": "^1.8.0"

@@ -32,0 +32,0 @@ },