mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 07:40:16 +00:00

socket.parser can be undefined under unknown circumstances. This is a fix for a bug I cannot reproduce but it is affecting people. Fixes: https://github.com/nodejs/node/issues/26366 PR-URL: https://github.com/nodejs/node/pull/26402 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
25 lines
451 B
JavaScript
25 lines
451 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const http = require('http');
|
|
|
|
const server = http.createServer(common.mustCall((req, res) => {
|
|
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
|
res.write('okay', common.mustCall(() => {
|
|
delete res.socket.parser;
|
|
}));
|
|
res.end();
|
|
}));
|
|
|
|
server.listen(1337, '127.0.0.1');
|
|
server.unref();
|
|
|
|
const req = http.request({
|
|
port: 1337,
|
|
host: '127.0.0.1',
|
|
method: 'GET',
|
|
});
|
|
|
|
req.end();
|