Commit Graph

215 Commits

Author SHA1 Message Date
Ben Noordhuis
aa3a572e6b
build: remove dtrace & etw support
There are no clear indicators anyone is using the dtrace USDT probes.

ETW support is very intertwined with the dtrace infrastructure. It's not
clear if anyone uses ETW so to keep things simple it too is removed.

Fixes: https://github.com/nodejs/node/issues/43649

PR-URL: https://github.com/nodejs/node/pull/43652
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2022-07-17 17:33:52 +01:00
Paolo Insogna
736a7d8d60 http: do not leak error listeners
PR-URL: https://github.com/nodejs/node/pull/43587
Fixes: https://github.com/nodejs/node/issues/43548
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
2022-07-01 08:17:26 +02:00
Paolo Insogna
4267b92604 http: use Keep-Alive by default in global agents
PR-URL: https://github.com/nodejs/node/pull/43522
Fixes: https://github.com/nodejs/node/issues/37184
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-06-29 12:48:52 +02:00
Antoine du Hamel
a055337a02
lib: refactor to avoid unsafe regex primordials
PR-URL: https://github.com/nodejs/node/pull/43475
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2022-06-27 17:16:06 +02:00
theanarkh
d96a2ea615
http: add perf_hooks detail for http request and client
PR-URL: https://github.com/nodejs/node/pull/43361
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2022-06-25 11:37:20 +01:00
theanarkh
cb4a558eeb
perf_hooks: fix start_time of perf_hooks
PR-URL: https://github.com/nodejs/node/pull/43069
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2022-05-26 22:13:31 +08:00
Shogun
abc175e745 http: add uniqueHeaders option to request and createServer
PR-URL: https://github.com/nodejs/node/pull/41397
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2022-05-23 10:23:41 +02:00
Shogun
f714a0fa6e http: added connection closing methods
Fixes: https://github.com/nodejs/node/issues/41578

PR-URL: https://github.com/nodejs/node/pull/42812
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-05-03 14:04:07 +02:00
Paolo Insogna
3caa2c1a00
http: refactor headersTimeout and requestTimeout logic
PR-URL: https://github.com/nodejs/node/pull/41263
Fixes: https://github.com/nodejs/node/issues/33440
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2022-04-13 15:47:59 +01:00
theanarkh
3f3fa6d990
http: trace http client by perf_hooks
PR-URL: https://github.com/nodejs/node/pull/42345
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
2022-03-18 15:15:08 +00:00
Paolo Insogna
eacd45656a
http: make TCP noDelay enabled by default
PR-URL: https://github.com/nodejs/node/pull/42163
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2022-03-09 14:37:49 +00:00
Paolo Insogna
45b5ca810a
net: add new options to net.Socket and net.Server
PR-URL: https://github.com/nodejs/node/pull/41310
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-02-22 10:58:30 +00:00
Rich Trott
55ceaec111 tools,benchmark,lib,test: enable no-case-declarations lint rule
PR-URL: https://github.com/nodejs/node/pull/41385
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2022-01-05 07:42:19 -08:00
Shaw
bad65ea69d http: remove duplicate code
This line of code has been implemented in the prepareError function.

PR-URL: https://github.com/nodejs/node/pull/39239
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2022-01-04 19:55:40 -08:00
Robert Nagy
3b9044b5b2 http: response should always emit 'close'
Fixes: https://github.com/nodejs/node/issues/40528

PR-URL: https://github.com/nodejs/node/pull/40543
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-10-25 07:35:24 +00:00
Artur K
44b173e013 http: use 0 as default for requests limit
PR-URL: https://github.com/nodejs/node/pull/40192
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
2021-09-27 11:45:24 +02:00
Artur K
4e8f11dee3 http: limit requests per connection
Fixes: https://github.com/nodejs/node/issues/40071
PR-URL: https://github.com/nodejs/node/pull/40082
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
2021-09-19 16:28:20 +02:00
shfshanyue
e9fc67815e http: remove CRLF variable
PR-URL: https://github.com/nodejs/node/pull/40101
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2021-09-16 09:44:12 -04:00
Robert Nagy
ac621ff5e7 stream: add readableDidRead if has been read from
Adds did read accessor used to determine whether a readable has been
read from.

PR-URL: https://github.com/nodejs/node/pull/39589
Refs: https://github.com/nodejs/undici/pull/907
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-08-02 05:59:18 -07:00
Robert Nagy
8306051001 stream: add readableDidRead
Adds readableDidRead to streams and applies usage to http, http2 and quic.

PR-URL: https://github.com/nodejs/node/pull/36820
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-07-14 12:01:41 +02:00
Qingyu Deng
8a8c7f41e1 http,https: align server option of https with http
Fixes: https://github.com/nodejs/node/issues/38954

PR-URL: https://github.com/nodejs/node/pull/38992
Refs: https://github.com/nodejs/node/pull/30570
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-06-26 14:21:57 +00:00
Robert Nagy
f4609bdf3f
stream: bypass legacy destroy for pipeline and async iteration
PR-URL: https://github.com/nodejs/node/pull/38505
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-06-15 19:43:49 +02:00
Antoine du Hamel
ee9e2a2eb6 lib: revert primordials in a hot path
Evidence has shown that use of primordials have sometimes an impact of
performance. This commit reverts the changes who are most likely to be
responsible for performance regression in the HTTP response path.

PR-URL: https://github.com/nodejs/node/pull/38248
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-04-19 10:23:01 +02:00
Fedor Indutny
6a1986d50a deps: update llhttp to 5.1.0
PR-URL: https://github.com/nodejs/node/pull/38146
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Daniele Belardi <dwon.dnl@gmail.com>
2021-04-10 14:31:34 -07:00
James M Snell
40ace47396
http: fixup perf regression
Only call into hrtime if there's an observer

Also, fix up some previously missed changes from the original refactor

Signed-off-by: James M Snell <jasnell@gmail.com>
Refs: https://github.com/nodejs/node/issues/37937
Refs: https://github.com/nodejs/node/pull/37136

PR-URL: https://github.com/nodejs/node/pull/38110
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-04-09 16:58:58 -07:00
Michaël Zasso
3dee23334d
http: optimize debug function correctly
Exporting a variable that will be mutated later doesn't work.

Refs: https://github.com/nodejs/node/issues/37937

PR-URL: https://github.com/nodejs/node/pull/37966
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-03-31 18:21:20 +02:00
Matteo Collina
16920db55e Revert "http: align with stream.Writable"
This reverts commit e2f5bb7574.

Reverted as it caused a significant performance regression.

See: https://github.com/nodejs/node/issues/37937

PR-URL: https://github.com/nodejs/node/pull/37963
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2021-03-31 17:18:30 +02:00
Robert Nagy
e2f5bb7574 http: align with stream.Writable
Futher aligns OutgoingMessage with stream.Writable. In particular
re-uses the construct/destroy logic from streams.

Due to a lot of subtle assumptions this PR unfortunately touches
a lot of different parts.

PR-URL: https://github.com/nodejs/node/pull/36816
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-03-10 15:04:00 +01:00
Antoine du Hamel
f34d8de65a lib: remove use of array destructuring
PR-URL: https://github.com/nodejs/node/pull/36818
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-03-03 19:53:24 +01:00
James M Snell
f3eb224c83
perf_hooks: complete overhaul of the implementation
* Update the user timing implementation to conform to
  User Timing Level 3.
* Reimplement user timing and timerify with pure JavaScript
  implementations
* Simplify the C++ implementation for gc and http2 perf
* Runtime deprecate additional perf entry properties
  in favor of the standard detail argument
* Disable the `buffered` option on PerformanceObserver,
  all entries are queued and dispatched on setImmediate.
  Only entries with active observers are buffered.
* This does remove the user timing and timerify
  trace events. Because the trace_events are still
  considered experimental, those can be removed without
  a deprecation cycle. They are removed to improve
  performance and reduce complexity.

Old: `perf_hooks/usertiming.js n=100000: 92,378.01249733355`
New: perf_hooks/usertiming.js n=100000: 270,393.5280638482`

PR-URL: https://github.com/nodejs/node/pull/37136
Refs: https://github.com/nodejs/diagnostics/issues/464
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-02-22 08:46:11 -08:00
Antoine du Hamel
4a113be836 http: refactor to avoid unsafe array iteration
PR-URL: https://github.com/nodejs/node/pull/37124
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-02-01 05:47:21 -08:00
Ian Storm Taylor
fc3f1c3c71 http: attach request as res.req
This change makes it possible for userland http-related modules
to pave over edge cases that require referencing the original request
when handling a response--making a "Lodash for HTTP" library possible.
More information and research in https://github.com/nodejs/node/issues/28673

Fixes: https://github.com/nodejs/node/issues/28673

PR-URL: https://github.com/nodejs/node/pull/36505
Reviewed-By: Robert Nagy <ronagy@icloud.com>
2021-01-19 00:33:04 +01:00
Robert Nagy
708728ddcc
http: abortIncoming only on socket close
Don't call abortIncombin twice for same socket, i.e. both during
'end' and 'close'.

PR-URL: https://github.com/nodejs/node/pull/36821
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-01-18 14:01:16 -08:00
Antoine du Hamel
8cf5ae07e9 http: refactor to use more primordials
PR-URL: https://github.com/nodejs/node/pull/36194
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-29 16:06:05 +01:00
Daniele Belardi
55e83cbe95 http: use autoDestroy: true in incoming message
Enable the default `autoDestroy: true` option in IncomingMessage.

Refactor `_http_client` and `_http_server` to remove any manual
destroying/closing of IncomingMessage.
Refactor IncomingMessage `destroy` method to use the standard
implementation of the stream module and move the early termination
event emitting inside of it.

PR-URL: https://github.com/nodejs/node/pull/33035
Refs: https://github.com/nodejs/node/issues/30625
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-17 10:31:07 +00:00
Hollow Man
0d468ab200 http: fix typo in comment
alredy -> already

PR-URL: https://github.com/nodejs/node/pull/36193
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Pranshu Srivastava <rexagod@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
2020-11-22 10:50:40 +08:00
Stephen Belanger
7231b5139e http: report request start and end with diagnostics_channel
PR-URL: https://github.com/nodejs/node/pull/34895
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2020-10-31 21:24:12 +00:00
Robert Nagy
d70c0ed250 http: allow passing array of key/val into writeHead
Enables an optimization when the user already has the headers
in an array form, e.g. when proxying.

PR-URL: https://github.com/nodejs/node/pull/35274
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-10-10 10:11:41 +02:00
Robert Nagy
5461794b12 https: set requestTimeout default to 0
Fixes: https://github.com/nodejs/node/issues/35261

PR-URL: https://github.com/nodejs/node/pull/35264
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-09-21 08:32:26 -07:00
Matteo Collina
df08d527c2
http: add requestTimeout
This commits introduces a new http.Server option called requestTimeout
with a default value in milliseconds of 0.

If requestTimeout is set to a positive value, the server will start a new
timer set to expire in requestTimeout milliseconds when a new connection
is established. The timer is also set again if new requests after the
first are received on the socket (this handles pipelining and keep-alive
cases).
The timer is cancelled when:

1. the request body is completely received by the server.
2. the response is completed. This handles the case where the
application responds to the client without consuming the request body.
3. the connection is upgraded, like in the WebSocket case.

If the timer expires, then the server responds with status code 408 and
closes the connection.

CVE-2020-8251

PR-URL: https://github.com/nodejs-private/node-private/pull/208
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Co-Authored-By: Paolo Insogna <paolo@cowtech.it>
Co-Authored-By: Robert Nagy <ronagy@icloud.com>
2020-09-15 15:39:54 -04:00
Voltra
9594b54f96 http: add RFC references for each status code
Reference format: `RFC <rfc id> <section path>`

PR-URL: https://github.com/nodejs/node/pull/33671
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Pranshu Srivastava <rexagod@gmail.com>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
2020-08-15 21:35:10 +08:00
Robert Nagy
849d9e7b90 http: provide keep-alive timeout response header
In http 1.1 persistent connection protocol there is a
timing race where the client sends the request and then
the server kills the connection (due to inactivity)
before receiving the client's request.

By providing a keep-alive header it is possible to provide
the client a hint of when idle timeout would occur and
avoid the race.

Fixes: https://github.com/nodejs/node/issues/34560

PR-URL: https://github.com/nodejs/node/pull/34561
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Pranshu Srivastava <rexagod@gmail.com>
2020-08-01 15:04:35 +02:00
Robert Nagy
e8d7fedf7c http: don't write error to socket
The state of the connection is unknown at this point and
writing to it can corrupt client state before it is aware
of an error.

PR-URL: https://github.com/nodejs/node/pull/34465
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-07-25 09:59:41 +02:00
Robert Nagy
a55b77d2d3 stream: finished on closed OutgoingMessage
finished should invoke callback on closed OutgoingMessage the
same way as for regular streams.

Fixes: https://github.com/nodejs/node/issues/34301

PR-URL: https://github.com/nodejs/node/pull/34313
Fixes: https://github.com/nodejs/node/issues/34274
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-07-16 08:37:01 +02:00
Robert Nagy
e8f57456be http: add note about timer unref
PR-URL: https://github.com/nodejs/node/pull/34143
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-07-09 09:14:12 +02:00
sapics
ee3416b055 lib: replace http to https of comment link urls
PR-URL: https://github.com/nodejs/node/pull/34158
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-07-06 07:03:08 -07:00
Yash Ladha
1a90d32d92
http: used already defined validator for boolean check
We already importing the validator for integer check. So leveraging the
boolean check validator to remove already defined logic in the code and
thus making it DRY.

PR-URL: https://github.com/nodejs/node/pull/33731
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-06-24 15:32:22 -07:00
Robert Nagy
30cc54275d http: don't emit error after close
Refs: https://github.com/nodejs/node/issues/33591

PR-URL: https://github.com/nodejs/node/pull/33654
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-06-21 17:21:12 +02:00
iskore
32b641e528 http: fixed socket.setEncoding fatal error
Applied updates from previous pull-requests to disallow
socket.setEncoding before a http connection is parsed.
Wrapped `socket.setEncoding` to throw an error.
This previously resulted in a fatal error.

PR-URL: https://github.com/nodejs/node/pull/33405
Fixes: https://github.com/nodejs/node/issues/18118
Refs: https://github.com/nodejs/node/pull/18178
Refs: https://github.com/nodejs/node/pull/19344
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2020-05-23 21:29:49 +02:00
Robert Nagy
8a6fab02ad http: emit 'error' on aborted server request
Server requests aka. IncomingMessage emits 'aborted'
instead of 'error' which causes confusion when
the object is used as a regular stream, i.e. if
functions working on streams are passed a
server request object they might not work properly
unless they take this into account.

Refs: https://github.com/nodejs/web-server-frameworks/issues/41

PR-URL: https://github.com/nodejs/node/pull/33172
Fixes: https://github.com/nodejs/node/issues/28172
Refs: https://github.com/nodejs/node/pull/28677
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-05-10 22:11:21 +02:00