mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
http: simplify drain()
Simplify and slightly optimize draining outgoing http streams. Avoid extra event listener and inline with rest of the drain logic. PR-URL: https://github.com/nodejs/node/pull/29081 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
@@ -31,7 +31,6 @@ const { methods, HTTPParser } =
|
||||
internalBinding('http_parser') : internalBinding('http_parser_llhttp');
|
||||
|
||||
const FreeList = require('internal/freelist');
|
||||
const { ondrain } = require('internal/http');
|
||||
const incoming = require('_http_incoming');
|
||||
const {
|
||||
IncomingMessage,
|
||||
@@ -201,12 +200,6 @@ function freeParser(parser, req, socket) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function httpSocketSetup(socket) {
|
||||
socket.removeListener('drain', ondrain);
|
||||
socket.on('drain', ondrain);
|
||||
}
|
||||
|
||||
const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;
|
||||
/**
|
||||
* Verifies that the given val is a valid HTTP token
|
||||
@@ -253,7 +246,6 @@ module.exports = {
|
||||
CRLF: '\r\n',
|
||||
debug,
|
||||
freeParser,
|
||||
httpSocketSetup,
|
||||
methods,
|
||||
parsers,
|
||||
kIncomingMessage,
|
||||
|
||||
Reference in New Issue
Block a user