bare-http1 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,8 @@ const HTTPIncomingMessage = require('./incoming-message')
2
2
  const constants = require('./constants')
3
3
  const errors = require('./errors')
4
4
 
5
+ const empty = Buffer.alloc(0)
6
+
5
7
  module.exports = class HTTPClientConnection {
6
8
  constructor (socket, opts = {}) {
7
9
  const {
@@ -189,7 +191,7 @@ module.exports = class HTTPClientConnection {
189
191
  req.upgrade = true
190
192
  req.destroy()
191
193
 
192
- if (req.emit('upgrade', this.res, this.socket, head)) return
194
+ if (req.emit('upgrade', this.res, this.socket, head || empty)) return
193
195
 
194
196
  this.socket.destroy()
195
197
  }
@@ -2,6 +2,8 @@ const HTTPIncomingMessage = require('./incoming-message')
2
2
  const HTTPServerResponse = require('./server-response')
3
3
  const constants = require('./constants')
4
4
 
5
+ const empty = Buffer.alloc(0)
6
+
5
7
  module.exports = class HTTPServerConnection {
6
8
  constructor (server, socket, opts = {}) {
7
9
  const {
@@ -180,7 +182,7 @@ module.exports = class HTTPServerConnection {
180
182
  req.upgrade = true
181
183
  req.destroy()
182
184
 
183
- this.server.emit('upgrade', req, this.socket, head)
185
+ this.server.emit('upgrade', req, this.socket, head || empty)
184
186
  }
185
187
 
186
188
  _onfinished () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-http1",
3
- "version": "3.5.0",
3
+ "version": "3.5.1",
4
4
  "description": "Native HTTP/1 library for JavaScript",
5
5
  "exports": {
6
6
  ".": "./index.js",