Natalia Venditto
a1869fa87e
http: expose websockets
...
PR-URL: https://github.com/nodejs/node/pull/53721
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-07-08 15:55:43 +00:00
Antoine du Hamel
cbd2c387ce
http: remove prototype primordials
...
Co-authored-by: Yagiz Nizipli <yagiz@nizipli.com >
PR-URL: https://github.com/nodejs/node/pull/53698
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2024-07-06 10:33:16 +02:00
Jungku Lee
6aa7101960
lib: update params in jsdoc for HTTPRequestOptions
...
PR-URL: https://github.com/nodejs/node/pull/49872
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2023-09-29 13:14:24 +02:00
Gerrard Lindsay
5ec0f39a7a
http: prevent writing to the body when not allowed by HTTP spec
...
PR-URL: https://github.com/nodejs/node/pull/47732
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2023-05-13 17:09:26 +00:00
HinataKah0
2fbe124e68
http: add highWaterMark opt in http.createServer
...
Add highWaterMark option when creating a new HTTP server.
This option will override the default (readable|writable)
highWaterMark values on sockets created.
Fixes: https://github.com/nodejs/node/issues/46606
PR-URL: https://github.com/nodejs/node/pull/47405
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com >
2023-04-24 05:35:38 +00:00
Antoine du Hamel
9dbb1623ff
lib: add trailing commas to all public core modules
...
PR-URL: https://github.com/nodejs/node/pull/46848
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
2023-02-28 12:10:24 +01:00
Marco Ippolito
4080bada1a
http: join authorization headers
...
PR-URL: https://github.com/nodejs/node/pull/45982
Fixes: https://github.com/nodejs/node/issues/45699
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
2023-01-03 10:43:21 +00:00
wwwzbwcom
ed3604cd64
http: server check Host header, to meet RFC 7230 5.4 requirement
...
PR-URL: https://github.com/nodejs/node/pull/45597
Fixes: https://github.com/nodejs/node/issues/39033
Co-authored-by: Luigi Pinca <luigipinca@gmail.com >
Co-authored-by: mscdex <mscdex@users.noreply.github.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2022-11-28 18:35:31 +01:00
Rich Trott
42c8f099ff
http: add JSDoc property descriptions
...
PR-URL: https://github.com/nodejs/node/pull/45370
Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2022-11-12 04:09:54 +00:00
theanarkh
20e372c242
http: make idle http parser count configurable
...
PR-URL: https://github.com/nodejs/node/pull/43974
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Feng Yu <F3n67u@outlook.com >
2022-07-29 10:00:38 +01:00
Antoine du Hamel
06d8606960
lib: use null-prototype objects for property descriptors
...
Refs: https://github.com/nodejs/node/pull/42921
PR-URL: https://github.com/nodejs/node/pull/43270
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2022-06-03 09:23:58 +01:00
Rich Trott
1e8b296c58
lib,test,tools: use consistent JSDoc types
...
This could be in preparation of implementing the jsdoc/check-types
ESLint rule.
PR-URL: https://github.com/nodejs/node/pull/40989
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2021-11-29 06:48:00 +00:00
Voltrex
d3162da8dd
typings: add JSDoc typings for http
...
PR-URL: https://github.com/nodejs/node/pull/38191
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-04-16 07:47:46 +02: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
Osher
e30a651937
http: tidy up exposure of header validation
...
PR-URL: https://github.com/nodejs/node/pull/33371
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2020-05-25 19:21:57 +02:00
osher
96faea137e
http: expose http.validate-header-name/value
...
The use-case is for any framework that provides user mw a response
replacement, that collects the desired response state, and applies them
only on conclusion. As such a framework, I'd want to validate the
header names and values as soon as the user-code provides them.
This - to eliminate errors on response-send time, and provide developer
stack trace that contains the line that submits the offending values.
PR-URL: https://github.com/nodejs/node/pull/33119
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2020-05-09 07:55:55 +02:00
Michaël Zasso
0646eda4fc
lib: flatten access to primordials
...
Store all primordials as properties of the primordials object.
Static functions are prefixed by the constructor's name and prototype
methods are prefixed by the constructor's name followed by "Prototype".
For example: primordials.Object.keys becomes primordials.ObjectKeys.
PR-URL: https://github.com/nodejs/node/pull/30610
Refs: https://github.com/nodejs/node/issues/29766
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-11-25 10:28:15 +01:00
Michaël Zasso
908292cf1f
lib: enforce the use of Object from primordials
...
PR-URL: https://github.com/nodejs/node/pull/27146
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2019-04-12 05:38:45 +02:00
Ruben Bridgewater
f86f5736da
benchmark,lib: change var to const
...
Refs: https://github.com/nodejs/node/pull/26679
PR-URL: https://github.com/nodejs/node/pull/26915
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2019-03-30 13:16:39 +01:00
Roy Sommer
5774688e26
lib: support overriding http\s.globalAgent
...
Overriding `require('http[s]').globalAgent` is now respected by
consequent requests.
In order to achieve that, the following changes were made:
1. Implmentation in `http`: `module.exports.globalAgent` is now defined
through `Object.defineProperty`. Its getter and setter return \ set
`require('_http_agent').globalAgent`.
2. Implementation in `https`: the https `globalAgent` is not the same
as `_http_agent`, and is defined in `https` module itself. Therefore,
the fix here was to simply use `module.exports.globalAgent` to support
mutation.
3. According tests were added for both `http` and `https`, where in
both we create a server, set the default agent to a newly created
instance and make a request to that server. We then assert that the
given instance was actually used by inspecting its sockets property.
Fixes: https://github.com/nodejs/node/issues/23281
PR-URL: https://github.com/nodejs/node/pull/25170
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-01-08 00:10:36 +01:00
cjihrig
9ac108d834
http: add maxHeaderSize property
...
This commit exposes the value of --max-http-header-size
as a property of the http module.
PR-URL: https://github.com/nodejs/node/pull/24860
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Shelley Vohr <codebytere@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-12-20 13:15:07 -05:00
Sam Ruby
f9b739ebbc
http: allow url and options to be passed to http*.request and http*.get
...
Fixes: https://github.com/nodejs/node/issues/20795
PR-URL: https://github.com/nodejs/node/pull/21616
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Ron Korving <ron@ronkorving.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-07-13 14:09:39 +01:00
Wes Todd
42d8ea0220
http: support server options on createServer
...
PR-URL: https://github.com/nodejs/node/pull/19461
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-25 11:51:32 +02:00
Tobias Nießen
e714da6f0a
http: use more destructuring
...
PR-URL: https://github.com/nodejs/node/pull/19481
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jackson Tian <shyvo1987@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-03-22 16:23:06 +01:00
Weijia Wang
212de3c5ec
lib: use destructuring for some constants
...
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-10-16 23:34:32 +02:00
James M Snell
5425e0dcbe
http: use more efficient module.exports pattern
...
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-20 16:01:31 -07:00
James M Snell
98e54b0bd4
meta: restore original copyright header
...
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-10 11:23:48 -08:00
maasencioh
accf410eb0
http: name anonymous functions in http
...
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-10-18 15:38:43 -07:00
Brian White
2cc7fa5e7d
http: remove deprecated Client interface
...
PR-URL: https://github.com/nodejs/node/pull/8104
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2016-08-29 21:44:58 -04:00
Sakthipriyan Vairamani
f32a606e37
lib,src: remove usage of events.EventEmitter
...
The `events` module already exports `EventEmitter` constructor function
So, we don't have to use `events.EventEmitter` to access it.
Refer: https://github.com/nodejs/node/pull/2896
PR-URL: https://github.com/nodejs/node/pull/2921
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Michaël Zasso <mic.besace@gmail.com >
2015-09-23 00:23:08 +05:30
Sakthipriyan Vairamani
9cd44bb2b6
util: prepend '(node) ' to deprecation messages
...
Changes included in this commit are
1. Making the deprecation messages consistent. The messages will be in
the following format
x is deprecated. Use y instead.
If there is no alternative for `x`, then the ` Use y instead.` part
will not be there in the message.
2. All the internal deprecation messages are printed with the prefix
`(node) `, except when the `--trace-deprecation` flag is set.
Fixes: https://github.com/nodejs/io.js/issues/1883
PR-URL: https://github.com/nodejs/io.js/pull/1892
Reviewed-By: Roman Reiss <me@silverwind.io >
2015-07-03 16:32:29 +02:00
Jonathan Ong
3e67d7e46b
http: replace util._extend() with [].slice()
...
PR-URL: https://github.com/iojs/io.js/pull/634
Reviewed-BY: Nicu Micleușanu <micnic90@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2015-02-02 14:52:02 -08:00
cjihrig
804e7aa9ab
lib: use const to define constants
...
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-21 16:21:31 -05:00
isaacs
3e1b1dd4a9
Remove excessive copyright/license boilerplate
...
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.
2015-01-12 15:30:28 -08:00
Ben Noordhuis
21130c7d6f
lib: turn on strict mode
...
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-11-22 17:23:30 +01:00
Ben Noordhuis
299cf84490
lib: unexport http.parsers
...
Unexport the http.parsers freelist. It was originally exported by Ryan
in commit 0003c701 but the commit log doesn't mention why and it's never
been documented. It's unclear if there are any users.
The lifecycle of parser objects changed recently and it seems better to
not let people shoot themselves in the foot so easily.
If it turns out there are actually users, we can always re-export it
again - probably under a slightly different name, to force people to
update their code to the new way of things.
Reviewed-by: Trevor Norris <trev.norris@gmail.com >
2014-09-05 09:34:43 -07:00
Brian White
03e9f84933
lib: remove unused variables
...
Signed-off-by: Fedor Indutny <fedor@indutny.com >
2014-06-11 20:41:12 -07:00
Nathan Rajlich
d6bbb19f1d
http, https: don't depend on globalAgent
...
For the `request()` and `get()` functions. I could never
really understand why these two functions go through agent
first... Especially since the user could be passing `agent: false`
or a different Agent instance completely, in which `globalAgent`
will be completely bypassed.
Moved the relevant logic from `Agent#request()` into the
`ClientRequest` constructor.
Incidentally, this commit fixes #7012 (which was the original
intent of this commit).
2014-02-26 13:18:54 -08:00
Ben Noordhuis
610022851a
http: expose supported methods
...
Expose the list of supported HTTP methods as a property on the 'http'
module object.
Fixes #6422 .
2013-10-28 13:35:34 +01:00
Brian White
6d842897c5
lib: remove unused variables and functions
2013-08-15 17:19:17 -07:00
isaacs
32fdae2ca3
http: Fix overlooked agent.globalAgent export
...
Noticed by @bnoordhuis in https://github.com/joyent/node/pull/5991#discussion_r5575946
2013-08-05 12:33:19 -07:00
isaacs
40e92650bb
http: Add agent.get/request methods
2013-07-09 22:31:11 -07:00
Ben Noordhuis
7124387b34
http: don't escape request path, reject bad chars
...
Commit 38149bb changes http.get() and http.request() to escape unsafe
characters. However, that creates an incompatibility with v0.10 that
is difficult to work around: if you escape the path manually, then in
v0.11 it gets escaped twice. Change lib/http.js so it no longer tries
to fix up bad request paths, simply reject them with an exception.
The actual check is rather basic right now. The full check for illegal
characters is difficult to implement efficiently because it requires a
few characters of lookahead. That's why it currently only checks for
spaces because those are guaranteed to create an invalid request.
Fixes #5474 .
2013-05-15 22:53:29 +02:00
Timothy J Fontaine
951e0b69fa
http: split Client into _http_client.js
2013-04-17 00:08:28 +02:00
Timothy J Fontaine
6717fdccb4
http: move Server and ServerResponse out
2013-04-17 00:08:28 +02:00
Timothy J Fontaine
dc9f97b7b9
http: move OutgoingMessage into it's own file
2013-04-17 00:08:28 +02:00
Timothy J Fontaine
bb56489f21
http: move parsers into _http_common.js
2013-04-17 00:08:28 +02:00
Timothy J Fontaine
5909a9c9bd
http: move IncomingMessage into its own file
2013-04-17 00:08:28 +02:00
Timothy J Fontaine
62e4f89765
http: split Agent into its own file
2013-04-17 00:08:28 +02:00
Ben Noordhuis
38149bb048
http: escape unsafe characters in request path
...
Make http.request() and friends escape unsafe characters in the request
path. That is, a request for '/foo bar' is now escaped as '/foo%20bar'.
Before this commit, the path was used as-is in the request status line,
creating an invalid HTTP request ("GET /foo bar HTTP/1.1").
Fixes #4381 .
2013-04-12 16:27:50 -07:00