summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMiles Elam <miles.elam@productops.com>2018-01-08 00:11:05 -0800
committerMatteo Collina <hello@matteocollina.com>2018-02-15 11:57:57 +0100
commitbaf84950781f253ab0244779a9e40b5dc0f4930e (patch)
treed58fc3d495bcd25ffc25914438c4c33348d37def /doc
parentcfad44105d6baae44a7b5dd6ea179f7550a5038f (diff)
downloadandroid-node-v8-baf84950781f253ab0244779a9e40b5dc0f4930e.tar.gz
android-node-v8-baf84950781f253ab0244779a9e40b5dc0f4930e.tar.bz2
android-node-v8-baf84950781f253ab0244779a9e40b5dc0f4930e.zip
http: process 100, 102-199 according to specs.
Adding ServerResponse.writeProcessing to send 102 status codes. Added an `'information'` event to ClientRequest to handle 1xx status codes except 101 Upgrade. 101 Upgrade is excluded due to its non-informational processing according to RFC7231, Section 6.2.2. This affects several modules downstream that use the http module, e.g., node-fetch, all of whom violate HTTP RFCs due to this module. As such, this could introduce a breaking change for downstream if HTTP standards were ignored in an ad-hoc fashion. See also RFC2518 RFC8297. PR-URL: https://github.com/nodejs/node/pull/18033 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/http.md40
1 files changed, 40 insertions, 0 deletions
diff --git a/doc/api/http.md b/doc/api/http.md
index 0a4fe95998..74ba9e8792 100644
--- a/doc/api/http.md
+++ b/doc/api/http.md
@@ -400,6 +400,37 @@ Emitted when the server sends a '100 Continue' HTTP response, usually because
the request contained 'Expect: 100-continue'. This is an instruction that
the client should send the request body.
+### Event: 'information'
+<!-- YAML
+added: REPLACEME
+-->
+
+Emitted when the server sends a 1xx response (excluding 101 Upgrade). This
+event is emitted with a callback containing an object with a status code.
+
+```js
+const http = require('http');
+
+const options = {
+ hostname: '127.0.0.1',
+ port: 8080,
+ path: '/length_request'
+};
+
+// Make a request
+const req = http.request(options);
+req.end();
+
+req.on('information', (res) => {
+ console.log('got information prior to main response: ' + res.statusCode);
+});
+```
+
+101 Upgrade statuses do not fire this event due to their break from the
+traditional HTTP request/response chain, such as web sockets, in-place TLS
+upgrades, or HTTP 2.0. To be notified of 101 Upgrade notices, listen for the
+[`'upgrade'`][] event instead.
+
### Event: 'response'
<!-- YAML
added: v0.1.0
@@ -1384,6 +1415,14 @@ which has been transmitted are equal or not.
Attempting to set a header field name or value that contains invalid characters
will result in a [`TypeError`][] being thrown.
+### response.writeProcessing()
+<!-- YAML
+added: REPLACEME
+-->
+
+Sends a HTTP/1.1 102 Processing message to the client, indicating that
+the request body should be sent.
+
## Class: http.IncomingMessage
<!-- YAML
added: v0.1.17
@@ -1937,6 +1976,7 @@ not abort the request or do anything besides add a `timeout` event.
[`'checkContinue'`]: #http_event_checkcontinue
[`'request'`]: #http_event_request
[`'response'`]: #http_event_response
+[`'upgrade'`]: #http_event_upgrade
[`Agent`]: #http_class_http_agent
[`Duplex`]: stream.html#stream_class_stream_duplex
[`EventEmitter`]: events.html#events_class_eventemitter