| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Wrapped streams are expected to behave the same as socket with handle. Remove unnecessary difference in handling.
|
As a side note... there is a lot that could be improved in the tls code... However, it's kind of risky and difficult to work with. Is this something we would like to do or should I just leave it alone? |
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
I think it’s similar to streams – it’s hard to work with until somebody puts in a lot of work to clear it up. :/ |
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Wrapped streams are expected to behave the same as socket with handle. Remove unnecessary difference in handling. PR-URL: #34105 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Wrapped streams are expected to behave the same as socket with handle. Remove unnecessary difference in handling. PR-URL: #34105 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Wrapped streams are expected to behave the same as socket with handle. Remove unnecessary difference in handling. PR-URL: #34105 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Wrapped streams are expected to behave the same as socket with handle. Remove unnecessary difference in handling. PR-URL: #34105 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
|
@ronag const http2 = require('http2')
const net = require('net')
const {Duplex} = require('stream')
class JsSocket extends Duplex {
constructor(socket) {
super({autoDestroy: true, allowHalfOpen: false})
socket.on('data', (data) => this.push(data))
socket.on('end', (data) => this.push(null))
socket.on('close', () => this.destroy())
this.socket = socket
}
unref() {}
ref() {}
setNoDelay() {}
setTimeout() {}
_write(data, encoding, callback) {
this.socket.write(data, encoding, callback)
}
_final(callback) {
callback()
}
_read(size) {}
_destroy(error, callback) {
callback()
}
}
const realSocket = net.connect({host: 'www.example.com', port: '443'},
() => {
console.log('connected')
const connection = http2.connect('https://www.example.com', {
socket: new JsSocket(realSocket), // crash!!!
// socket: realSocket, // but not crash!!!
})
const h2Stream = connection.request({[http2.constants.HTTP2_HEADER_PATH]: '/'})
setTimeout(() => {realSocket.destroy()}, 2e3)
setTimeout(() => {connection.close()}, 3e3)
}
)output: internal/js_stream_socket.js:210
handle.finishWrite(req, errCode);
^
TypeError: Cannot read property 'finishWrite' of null
at JSStreamSocket.finishWrite (internal/js_stream_socket.js:210:12)
at Immediate.<anonymous> (internal/js_stream_socket.js:195:14)
at processImmediate (internal/timers.js:461:21)
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Wrapped streams are expected to behave the same as socket with handle.
Remove unnecessary difference in handling.
Checklist