summaryrefslogtreecommitdiff
path: root/lib/_http_incoming.js
AgeCommit message (Collapse)Author
2019-02-13http: improve performance for incoming headersWeijia Wang
PR-URL: https://github.com/nodejs/node/pull/26041 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-12-17doc,lib,test: capitalize comment sentencesRuben Bridgewater
This activates the eslint capitalize comment rule for comments above 50 characters. PR-URL: https://github.com/nodejs/node/pull/24996 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.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-04-26http: added aborted property to requestRobert Nagy
PR-URL: https://github.com/nodejs/node/pull/20094 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-04-19http: fix _dump regressionAnatoli Papirovski
A recent set of changes removed _consuming tracking from server incoming messages which ensures that _dump only runs if the user has never attempted to read the incoming data. Fix by reintroducing _consuming which tracks whether _read was ever successfully called. PR-URL: https://github.com/nodejs/node/pull/20088 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-02-27http: do not replace .read() in IncomingMessageMatteo Collina
Remove the req._consumed property, as its use is completely superseded and not needed anymore. This was being set in the overridden .read(). PR-URL: https://github.com/nodejs/node/pull/18939 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> 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-05-31http: suppress data event if req abortedYihong Wang
Re-enable test-http-abort-stream-end and put it into parallel category. Use system random port when calling server.listen() and fix eslint errors. After calling request.abort(), in order to avoid the buffered data to trigger the 'data' event, explicitly remove 'data' event listeners. PR-URL: https://github.com/nodejs/node/pull/13260 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-03-20tools: ignore URLs in line length lintingRich Trott
Where inclusion of a lengthy URL causes a line to exceed 80 characters in our code base, do not report the line length as a linting error. PR-URL: https://github.com/nodejs/node/pull/11890 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@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: append Cookie header values with semicolonBrian White
Previously, separate incoming Cookie headers would be concatenated with a comma, which can cause confusion in userland code when it comes to parsing the final Cookie header value. This commit concatenates using a semicolon instead. 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>
2017-01-11http: try to avoid lowercasing incoming headersBrian White
PR-URL: https://github.com/nodejs/node/pull/10558 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-12-29http: reuse existing headers array for raw valuesBrian White
PR-URL: https://github.com/nodejs/node/pull/6533 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2016-10-18http: name anonymous functions in _http_incomingmaasencioh
Refs: https://github.com/nodejs/node/issues/8913 PR-URL: https://github.com/nodejs/node/pull/9055 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2016-06-15http: fix no dumping after `maybeReadMore`Fedor Indutny
When `maybeReadMore` kicks in on a first bytes of incoming data, the `req.read(0)` will be invoked and the `req._consuming` will be set to `true`. This seemingly harmless property leads to a dire consequences: the server won't call `req._dump()` and the whole HTTP/1.1 pipeline will hang (single connection). PR-URL: https://github.com/nodejs/node/pull/7211 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2016-02-15http: remove old, confusing commentBrian White
The comment refers to a property (called `_pendings`) that no longer exists. PR-URL: https://github.com/nodejs/node/pull/5233 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
2015-12-30http: fix non-string header value concatenationBrian White
Since headers are stored in an empty literal object ({}) instead of an object created with Object.create(null), care must be taken with property names inherited from Object. Currently there are only functions inherited, so we can safely check for existing strings instead. Fixes: https://github.com/nodejs/node/issues/4456 PR-URL: https://github.com/nodejs/node/pull/4460 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
2015-10-06http: do not allow multiple instances of certain response headersJames M Snell
Response headers such as ETag and Last-Modified do not permit multiple instances, and therefore the comma-separated syntax is not allowed. When multiple values for these headers are specified, use only the first instance. Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> PR-URL: https://github.com/nodejs/node/pull/3090
2015-05-31http: revert deprecation of client propertyMichaël Zasso
The improper deprecation of the property broke a feature in the request module used by the bundled npm. This reverts the deprecation part of this change. PR-URL: https://github.com/nodejs/io.js/pull/1852 Fixes: https://github.com/nodejs/io.js/issues/1850 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-25http: simplify code and remove unused propertiesBrian White
PR-URL: https://github.com/nodejs/io.js/pull/1572 Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-05-16http,net,tls: return this from setTimeout methodsEvan Lucas
Modifies the setTimeout methods for the following prototypes: - http.ClientRequest - http.IncomingMessage - http.OutgoingMessage - http.Server - https.Server - net.Socket - tls.TLSSocket Previously, the above functions returned undefined. They now return `this`. This is useful for chaining function calls. PR-URL: https://github.com/nodejs/io.js/pull/1699 Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-09lib: fix eslint stylesYosuke Furukawa
PR-URL: https://github.com/iojs/io.js/pull/1539 Fixes: https://github.com/iojs/io.js/issues/1253 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2015-01-31lib: reduce util.is*() usagecjihrig
Many of the util.is*() methods used to check data types simply compare against a single value or the result of typeof. This commit replaces calls to these methods with equivalent checks. This commit does not touch calls to the more complex methods (isRegExp(), isDate(), etc.). Fixes: https://github.com/iojs/io.js/issues/607 PR-URL: https://github.com/iojs/io.js/pull/647 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-21lib: use const to define constantscjihrig
This commit replaces a number of var statements throughout the lib code with const statements. PR-URL: https://github.com/iojs/io.js/pull/541 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-12Remove excessive copyright/license boilerplateisaacs
The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
2014-11-22lib: turn on strict modeBen Noordhuis
Turn on strict mode for the files in the lib/ directory. It helps catch bugs and can have a positive effect on performance. PR-URL: https://github.com/node-forward/node/pull/64 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-09-30http: Improve _addHeaderLines methodJackson Tian
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2014-08-21http: avoid create difference hidden classJackson Tian
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-01-25http: do not emit EOF non-readable socketFedor Indutny
Socket may become not `readable`, but http should not rely on this property and should not think that it means that no data will ever arrive from it. In fact, it may arrive in a next tick and, since `this.push(null)` was already called, it will result in a error like this: Error: stream.push() after EOF at readableAddChunk (_stream_readable.js:143:15) at IncomingMessage.Readable.push (_stream_readable.js:123:10) at HTTPParser.parserOnBody (_http_common.js:132:22) at Socket.socketOnData (_http_client.js:277:20) at Socket.EventEmitter.emit (events.js:101:17) at Socket.Readable.read (_stream_readable.js:367:10) at Socket.socketCloseListener (_http_client.js:196:10) at Socket.EventEmitter.emit (events.js:123:20) at TCP.close (net.js:479:12) fix #6784
2014-01-13http: concatenate duplicate headers by defaultAlex Kocharin
2013-12-20http: parse the status message in a http response.Cam Swords
2013-10-16http: provide backpressure for pipeline floodisaacs
If a client sends a lot more pipelined requests than we can handle, then we need to provide backpressure so that the client knows to back off. Do this by pausing both the stream and the parser itself when the responses are not being read by the downstream client. Fix GH-6214
2013-08-15http: Simplify IncomingMessage._dump methodisaacs
2013-08-15http: provide access to raw headers/trailersisaacs
The format is [key,value,key,value,...] because that seems to have the lowest overhead. Close #4844
2013-08-01src: Replace macros with util functionsisaacs
2013-07-24lib: macro-ify type checksBen Noordhuis
Increases the grep factor. Makes it easier to harmonize type checks across the code base.
2013-04-29http: forward-port missing bits from 01e2920Ben Noordhuis
Forward-port the comments from commit 01e2920 (v0.10) to the master branch. Everything else from that patch already exists in master. It didn't merge cleanly because lib/http.js has been split up in several files.
2013-04-22http: Don't try to destroy nonexistent socketsisaacs
Fixes #3740 In the case of pipelined requests, you can have a situation where the socket gets destroyed via one req/res object, but then trying to destroy *another* req/res on the same socket will cause it to call undefined.destroy(), since it was already removed from that message. Add a guard to OutgoingMessage.destroy and IncomingMessage.destroy to prevent this error.
2013-04-17http: move IncomingMessage into its own fileTimothy J Fontaine