bare-http1 4.1.5 → 4.1.6

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.
@@ -18,6 +18,7 @@ module.exports = class HTTPClientRequest extends HTTPOutgoingMessage {
18
18
  const path = opts.path || '/'
19
19
  const host = (opts.host = opts.host || 'localhost')
20
20
  const port = (opts.port = opts.port || 80)
21
+ const headers = { host: host + (port === 80 ? '' : ':' + port), ...opts.headers }
21
22
 
22
23
  super()
23
24
 
@@ -25,7 +26,7 @@ module.exports = class HTTPClientRequest extends HTTPOutgoingMessage {
25
26
 
26
27
  this.method = method
27
28
  this.path = path
28
- this.headers = { host: host + ':' + port, ...opts.headers }
29
+ this.headers = headers
29
30
 
30
31
  this._chunked = method !== 'GET' && method !== 'HEAD'
31
32
 
@@ -1,4 +1,3 @@
1
- const tcp = require('bare-tcp')
2
1
  const { isEnded, isFinished, getStreamError } = require('bare-stream')
3
2
  const HTTPParser = require('bare-http-parser')
4
3
  const HTTPIncomingMessage = require('./incoming-message')
@@ -77,9 +76,7 @@ module.exports = class HTTPServerConnection {
77
76
 
78
77
  this._idle = true
79
78
 
80
- if (this.server._state & tcp.constants.state.CLOSING) {
81
- this.socket.destroy()
82
- }
79
+ if (this.server.closing) this.socket.destroy()
83
80
  })
84
81
 
85
82
  // Eagerly open the request stream
package/lib/server.js CHANGED
@@ -34,7 +34,7 @@ module.exports = class HTTPServer extends TCPServer {
34
34
  close(onclose) {
35
35
  super.close(onclose)
36
36
 
37
- for (const socket of this._connections) {
37
+ for (const socket of this.connections) {
38
38
  const connection = HTTPServerConnection.for(socket)
39
39
 
40
40
  if (connection === null || connection.idle) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-http1",
3
- "version": "4.1.5",
3
+ "version": "4.1.6",
4
4
  "description": "Native HTTP/1 library for JavaScript",
5
5
  "exports": {
6
6
  "./package": "./package.json",
@@ -39,7 +39,7 @@
39
39
  "bare-events": "^2.6.0",
40
40
  "bare-http-parser": "^1.0.0",
41
41
  "bare-stream": "^2.3.0",
42
- "bare-tcp": "^2.0.3"
42
+ "bare-tcp": "^2.2.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "bare-buffer": "^3.0.2",