summaryrefslogtreecommitdiff
path: root/lib/_http_outgoing.js
AgeCommit message (Collapse)Author
2018-12-10tools: capitalize sentencesRuben Bridgewater
This adds the `capitalized-comments` eslint rule to verify that actual sentences use capital letters as starting letters. It ignores special words and all lines below 62 characters. PR-URL: https://github.com/nodejs/node/pull/24808 Reviewed-By: Sam Ruby <rubys@intertwingly.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-12-08lib: improve error creation performanceRuben Bridgewater
In case of an error where we only care about a cleaned up stack trace it is cheaper to reset the stack trace limit for the error that is created. That way the stack frames do not have to be computed twice. PR-URL: https://github.com/nodejs/node/pull/24747 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2018-12-05lib: use ES6 class inheritance styleRuben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/24755 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-12-05lib: remove `inherits()` usageRuben Bridgewater
This switches all `util.inherits()` calls to use `Object.setPrototypeOf()` instead. In fact, `util.inherits()` is mainly a small wrapper around exactly this function while adding the `_super` property on the object as well. Refs: #24395 PR-URL: https://github.com/nodejs/node/pull/24755 Refs: https://github.com/nodejs/node/issues/24395 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-11-22http: change DEP0066 to a runtime deprecationMorgan Roderick
Change doc-only deprecation for _headers and _headerNames accessors to a runtime deprecation. PR-URL: https://github.com/nodejs/node/pull/24167 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-11-13http: remove obsolete function escapeHeaderValueLauri Piisang
There are test cases which validate the useful path of the function never runs the functionality of it is obsoleted by checkInvalidHeaderChar PR-URL: https://github.com/nodejs/node/pull/24173 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-08-22http: adding doc and debug for calling empty string on write functionAnto Aravinth
PR-URL: https://github.com/nodejs/node/pull/22118 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-08-07lib: extract validateString validatorJon Moss
Pulls out a common argument validator to `internal/validators` PR-URL: https://github.com/nodejs/node/pull/22101 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-08-04http,tls: name anonymous callbacksMarco Levrero
This commit is to help in the effort to name all anonymous functions to help when heap debugging. Specifically, this commit fixes some anonymous functions used as listeners in the lib/ folder. PR-URL: https://github.com/nodejs/node/pull/21412 Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Refs: https://github.com/nodejs/node/issues/8913
2018-07-09lib: consolidate redundant require() callscjihrig
PR-URL: https://github.com/nodejs/node/pull/21699 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Jon Moss <me@jonathanmoss.me>
2018-04-27http: refactor outgoing headers processingAnatoli Papirovski
Use a shared function, for..in instead of Object.keys, do less work in `setHeader` and instead defer some of it until later, and other minor changes to improve clarity, as well as a slight boost in performance. PR-URL: https://github.com/nodejs/node/pull/20250 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-04-22http: simplify connection: close searchAnatoli Papirovski
Remove upgrade from the regular expression as it is no longer used and switch to using `.test()` instead of `.match()` as the value matched is irrelevant. PR-URL: https://github.com/nodejs/node/pull/20131 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-04-22http: use switch in matchHeaderAnatoli Papirovski
Using a switch improves clarity of the code but also performance for all but a few edge cases which remain on par with the old code. PR-URL: https://github.com/nodejs/node/pull/20131 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-04-22http: simplify isCookieFieldAnatoli Papirovski
Handrolling and checking char by char is no longer faster than just using toLowerCase and strict comparison. PR-URL: https://github.com/nodejs/node/pull/20131 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-04-16http: relax requirements on upgrade listenerAnatoli Papirovski
The http spec does not say anything about Upgrade headers making protocol switch mandatory but Node.js implements them as if they are. Relax the requirements to only destroy the socket if no upgrade listener exists on the client when status code is 101. PR-URL: https://github.com/nodejs/node/pull/19981 Fixes: https://github.com/nodejs/node/issues/11552 Refs: https://tools.ietf.org/html/rfc7230#section-6.7 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-03-25lib: improve error handlingRuben Bridgewater
This improves the error handling for a couple cases where the received value would not have been handled so far or where the name is wrong etc. PR-URL: https://github.com/nodejs/node/pull/19445 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-03-25lib: always show ERR_INVALID_ARG_TYPE received partRuben Bridgewater
This makes a effort to make sure all of these errors will actually also show the received input. On top of that it refactors a few tests for better maintainability. It will also change the returned type to always be a simple typeof instead of special handling null. PR-URL: https://github.com/nodejs/node/pull/19445 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-03-12stream: make virtual methods errors consistentLuigi Pinca
Use the same error code and always emit the error instead of throwing it. PR-URL: https://github.com/nodejs/node/pull/18813 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaë Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-03-08async_hooks,process: remove internalNextTickAnatoli Papirovski
Instead of having mostly duplicate code in form of internalNextTick, instead use the existing defaultAsyncTriggerIdScope with a slight modification which allows undefined triggerAsyncId to be passed in, which then just triggers the callback with the provided arguments. PR-URL: https://github.com/nodejs/node/pull/19147 Refs: https://github.com/nodejs/node/issues/19104 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-03-07lib: port remaining errors to new systemMichaël Zasso
PR-URL: https://github.com/nodejs/node/pull/19137 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2018-02-19http: OutgoingMessage.end() should return thisMatteo Collina
PR-URL: https://github.com/nodejs/node/pull/18780 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-02-16async_hooks: clean up usage in internal codeAnatoli Papirovski
Instead of exposing internals of async_hooks & async_wrap throughout the code base, create necessary helper methods within the internal async_hooks that allows easy usage by Node.js internals. This stops every single internal user of async_hooks from importing a ton of functions, constants and internal Aliased Buffers from C++ async_wrap. Adds functions initHooksExist, afterHooksExist, and destroyHooksExist to determine whether the related emit methods need to be triggered. Adds clearDefaultTriggerAsyncId and clearAsyncIdStack on the JS side as an alternative to always calling C++. Moves async_id_symbol and trigger_async_id_symbol to internal async_hooks as they are never used in C++. Renames newUid to newAsyncId for added clarity of its purpose. Adjusts usage throughout the codebase, as well as in a couple of tests. PR-URL: https://github.com/nodejs/node/pull/18720 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-01-27http: there is no `corked` property of `stream`Fedor Indutny
Do not check/use unexistent property, use `OutgoingMessage` instead. PR-URL: https://github.com/nodejs/node/pull/18325 Reviewed-By: Mithun Sasidharan <mithunsasidharan89@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-01-26http: switch on string valuesSeth Brenith
Long ago, V8 was much faster switching on string lengths than values. That is no longer the case, so we can simplify a couple of methods. PR-URL: https://github.com/nodejs/node/pull/18351 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Kyle Farnung <kfarnung@microsoft.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
2018-01-04http: remove duplicate exportEvan Lucas
5425e0dcbee1ed8f6687203eafb7c3cf214f3393 switched to using the module.exports pattern vs just exports, but left a duplicate export around for OutgoingMessage. PR-URL: https://github.com/nodejs/node/pull/17982 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-12-28lib: migrate _http_outgoing.js's remaining errorsAnton Paras
A couple of lib/_http_outgoing.js's errors were still in the "old style": `throw new Error(<some message here>)`. This commit migrates those 2 old style errors to the "new style": internal/errors.js's error-system. In the future, changes to these errors' messages won't break semver-major status. With the old style, changes to these errors' messages broke semver-major status. It was inconvenient. Refs: https://github.com/nodejs/node/issues/17709 PR-URL: https://github.com/nodejs/node/pull/17837 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-11-12lib: improve the usage of TypeError[INVALID_ARG_TYPE]Weijia Wang
The initials of expected in TypeError[ERR_INVALID_ARG_TYPE] are inconsistent. This change is to unify them. PR-URL: https://github.com/nodejs/node/pull/16401 Fixes: https://github.com/nodejs/node/issues/16383 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2017-11-06http: improve errors thrown in header validationJoyee Cheung
PR-URL: https://github.com/nodejs/node/pull/16719 Fixes: https://github.com/nodejs/node/issues/16714 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-19tools: enable additional eslint rulesAnatoli Papirovski
Enable additional rules that node either already adheres to or it makes sense to do so going forward: for-direction, accessor-pairs, no-lonely-if and symbol-description. Fix all instances of no-lonely-if in lib & test and disable accessor-pairs in test-util-inspect. PR-URL: https://github.com/nodejs/node/pull/16243 Refs: https://eslint.org/docs/rules/for-direction Refs: https://eslint.org/docs/rules/accessor-pairs Refs: https://eslint.org/docs/rules/no-lonely-if Refs: https://eslint.org/docs/rules/symbol-description Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-10-19async_hooks: skip runtime checks when disabledAndreas Madsen
PR-URL: https://github.com/nodejs/node/pull/15454 Ref: https://github.com/nodejs/node/pull/14387 Ref: https://github.com/nodejs/node/pull/14722 Ref: https://github.com/nodejs/node/issues/14717 Ref: https://github.com/nodejs/node/issues/15448 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-10-16lib: use destructuring for some constantsWeijia Wang
This change is to unify the declaration for constants into using destructuring on the top-level-module scope, reducing some redundant code. PR-URL: https://github.com/nodejs/node/pull/16063 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-09-20http: revert #14024 writable is never set to falseMatteo Collina
Setting writable = false in IncomingMessage.end made some errors being swallowed in some very popular OSS libraries that we must support. This commit add some of those use cases to the tests, so we avoid further regressions. We should reevaluate how to set writable = false in IncomingMessage in a way that does not break the ecosystem. See: https://github.com/nodejs/node/pull/14024 Fixes: https://github.com/nodejs/node/issues/15029 PR-URL: https://github.com/nodejs/node/pull/15404 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-08-14errors: migrate _http_outgoingWeijia Wang
PR-URL: https://github.com/nodejs/node/pull/14735 Refs: https://github.com/nodejs/node/issues/11273 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-08-04http2: introducing HTTP/2James M Snell
At long last: The initial *experimental* implementation of HTTP/2. This is an accumulation of the work that has been done in the nodejs/http2 repository, squashed down to a couple of commits. The original commit history has been preserved in the nodejs/http2 repository. This PR introduces the nghttp2 C library as a new dependency. This library provides the majority of the HTTP/2 protocol implementation, with the rest of the code here providing the mapping of the library into a usable JS API. Within src, a handful of new node_http2_*.c and node_http2_*.h files are introduced. These provide the internal mechanisms that interface with nghttp and define the `process.binding('http2')` interface. The JS API is defined within `internal/http2/*.js`. There are two APIs provided: Core and Compat. The Core API is HTTP/2 specific and is designed to be as minimal and as efficient as possible. The Compat API is intended to be as close to the existing HTTP/1 API as possible, with some exceptions. Tests, documentation and initial benchmarks are included. The `http2` module is gated by a new `--expose-http2` command line flag. When used, `require('http2')` will be exposed to users. Note that there is an existing `http2` module on npm that would be impacted by the introduction of this module, which is the main reason for gating this behind a flag. When using `require('http2')` the first time, a process warning will be emitted indicating that an experimental feature is being used. To run the benchmarks, the `h2load` tool (part of the nghttp project) is required: `./node benchmarks/http2/simple.js benchmarker=h2load`. Only two benchmarks are currently available. Additional configuration options to enable verbose debugging are provided: ``` $ ./configure --debug-http2 --debug-nghttp2 $ NODE_DEBUG=http2 ./node ``` The `--debug-http2` configuration option enables verbose debug statements from the `src/node_http2_*` files. The `--debug-nghttp2` enables the nghttp library's own verbose debug output. The `NODE_DEBUG=http2` enables JS-level debug output. The following illustrates as simple HTTP/2 server and client interaction: (The HTTP/2 client and server support both plain text and TLS connections) ```jt client = http2.connect('http://localhost:80'); const req = client.request({ ':path': '/some/path' }); req.on('data', (chunk) => { /* do something with the data */ }); req.on('end', () => { client.destroy(); }); // Plain text (non-TLS server) const server = http2.createServer(); server.on('stream', (stream, requestHeaders) => { stream.respond({ ':status': 200 }); stream.write('hello '); stream.end('world'); }); server.listen(80); ``` ```js const http2 = require('http2'); const client = http2.connect('http://localhost'); ``` Author: Anna Henningsen <anna@addaleax.net> Author: Colin Ihrig <cjihrig@gmail.com> Author: Daniel Bevenius <daniel.bevenius@gmail.com> Author: James M Snell <jasnell@gmail.com> Author: Jun Mukai Author: Kelvin Jin Author: Matteo Collina <matteo.collina@gmail.com> Author: Robert Kowalski <rok@kowalski.gd> Author: Santiago Gimeno <santiago.gimeno@gmail.com> Author: Sebastiaan Deckers <sebdeckers83@gmail.com> Author: Yosuke Furukawa <yosuke.furukawa@gmail.com> PR-URL: https://github.com/nodejs/node/pull/14239 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-08-04http: move utcDate to internal/http.jsJames M Snell
PR-URL: https://github.com/nodejs/node/pull/14239 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-07-25http: disable OutgoingMessage pipe methodRoee Kasher
OutgoingMessage should be a write-only stream, and it shouldn't be piped. This commit disables the `pipe` method by throwing an exception (if this method is called). PR-URL: https://github.com/nodejs/node/pull/14358 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2017-07-20http: do not abort if socket is missingMatteo Collina
Fixes: https://github.com/nodejs/node/issues/14368 PR-URL: https://github.com/nodejs/node/pull/14387 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2017-07-17http: OutgoingMessage change writable after endRoee Kasher
When an OutgoingMessage is closed (for example, using the `end` method), its 'writable' property should be changed to false - since it is not writable anymore. The 'writable' property should have the opposite value of the 'finished' property. PR-URL: https://github.com/nodejs/node/pull/14024 Fixes: https://github.com/nodejs/node/issues/14023 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2017-06-23benchmark,lib,test: use braces for multiline blockRich Trott
For if/else and loops where the bodies span more than one line, use curly braces. PR-URL: https://github.com/nodejs/node/pull/13828 Ref: https://github.com/nodejs/node/pull/13623#discussion_r123048602 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-06-13http: edit _storeHeader to check for Trailer headerArtur G Vieira
Test non-chunked message does not have trailer header set, message will be terminated by the first empty line after the header fields, regardless of the header fields present in the message, and thus cannot contain a message body or 'trailers'. PR-URL: https://github.com/nodejs/node/pull/12990 Ref: https://github.com/nodejs/node/issues/2842 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
2017-06-12http: always cork outgoing writesBrian White
PR-URL: https://github.com/nodejs/node/pull/13522 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2017-05-26http: improve outgoing string write performanceBrian White
PR-URL: https://github.com/nodejs/node/pull/13013 Reviewed-By: James M Snell <jasnell@gmail.com>
2017-05-10lib: implement async_hooks API in coreTrevor Norris
Implement async_hooks support in the following: * fatalException handler * process.nextTick * Timers * net/dgram/http PR-URL: https://github.com/nodejs/node/pull/12892 Ref: https://github.com/nodejs/node/pull/11883 Ref: https://github.com/nodejs/node/pull/8531 Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2017-05-05lib,test: use regular expression literalsRich Trott
Replace RegExp constructors with regular expression literals where possible. PR-URL: https://github.com/nodejs/node/pull/12807 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-05-03http: fix first body chunk fast case for UTF-16Anna Henningsen
`http.OutgoingMessage` tried to send the first chunk together with the headers by concatenating them together as a string, but the list of encodings for which that works was incorrect. Change it from a blacklist to a whitelist. Fixes: https://github.com/nodejs/node/issues/11788 PR-URL: https://github.com/nodejs/node/pull/12747 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2017-03-24lib: use Object.create(null) directlyTimothy Gu
After V8 5.6, using Object.create(null) directly is now faster than using a constructor for map-like objects. PR-URL: https://github.com/nodejs/node/pull/11930 Refs: https://github.com/emberjs/ember.js/issues/15001 Refs: https://crrev.com/532c16eca071df3ec8eed394dcebb932ef584ee6 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-03-20http: replace uses of selfJames M Snell
PR-URL: https://github.com/nodejs/node/pull/11594 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-03-20http: use more efficient module.exports patternJames M Snell
PR-URL: https://github.com/nodejs/node/pull/11594 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-03-10meta: restore original copyright headerJames M Snell
A prior io.js era commit inappropriately removed the original copyright statements from the source. This restores those in any files still remaining from that edit. Ref: https://github.com/nodejs/TSC/issues/174 Ref: https://github.com/nodejs/node/pull/10599 PR-URL: https://github.com/nodejs/node/pull/10155 Note: This PR was required, reviewed-by and approved by the Node.js Foundation Legal Committee and the TSC. There is no `Approved-By:` meta data.
2017-03-09http: concatenate outgoing Cookie headersBrian White
This commit enables automatic concatenation of multiple Cookie header values with a semicolon, except when 2D header arrays are used. Fixes: https://github.com/nodejs/node/issues/11256 PR-URL: https://github.com/nodejs/node/pull/11259 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>