bare-http1 3.5.0 → 3.5.2
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.
package/lib/client-connection.js
CHANGED
|
@@ -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
|
}
|
package/lib/client-request.js
CHANGED
package/lib/outgoing-message.js
CHANGED
|
@@ -3,7 +3,7 @@ const errors = require('./errors')
|
|
|
3
3
|
|
|
4
4
|
module.exports = class HTTPOutgoingMessage extends Writable {
|
|
5
5
|
constructor (socket) {
|
|
6
|
-
super(
|
|
6
|
+
super()
|
|
7
7
|
|
|
8
8
|
this.socket = socket
|
|
9
9
|
this.headers = {}
|
|
@@ -42,7 +42,3 @@ module.exports = class HTTPOutgoingMessage extends Writable {
|
|
|
42
42
|
if (this.upgrade === false) this.socket.destroy()
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
function mapWritable (data) {
|
|
47
|
-
return typeof data === 'string' ? Buffer.from(data) : data
|
|
48
|
-
}
|
package/lib/server-connection.js
CHANGED
|
@@ -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/lib/server-response.js
CHANGED
|
@@ -54,7 +54,7 @@ module.exports = class HTTPServerResponse extends HTTPOutgoingMessage {
|
|
|
54
54
|
return h
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
_write (data, cb) {
|
|
57
|
+
_write (data, encoding, cb) {
|
|
58
58
|
if (this.headersSent === false) {
|
|
59
59
|
if (this._finishing) {
|
|
60
60
|
this.setHeader('Content-Length', (data.byteLength + this._writableState.buffered).toString())
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bare-http1",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.2",
|
|
4
4
|
"description": "Native HTTP/1 library for JavaScript",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"homepage": "https://github.com/holepunchto/bare-http1#readme",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"bare-events": "^2.0.0",
|
|
29
|
-
"bare-stream": "^
|
|
29
|
+
"bare-stream": "^2.0.0",
|
|
30
30
|
"bare-tcp": "^1.1.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|