Browse Source

docs: add restricted header info to ClientRequest docs (#25075)

* docs: add restricted header info to docs

* docs: clarify header language

Co-authored-by: Jeremy Rose <[email protected]>

Co-authored-by: Jeremy Rose <[email protected]>
Keeley Hammond 4 years ago
parent
commit
7704954505
1 changed files with 14 additions and 0 deletions
  1. 14 0
      docs/api/client-request.md

+ 14 - 0
docs/api/client-request.md

@@ -171,6 +171,20 @@ lowercasing. It can be called only before first write. Calling this method after
 the first write will throw an error. If the passed value is not a `String`, its
 `toString()` method will be called to obtain the final value.
 
+Certain headers are restricted from being set by apps. These headers are
+listed below. More information on restricted headers can be found in
+[Chromium's header utils](https://source.chromium.org/chromium/chromium/src/+/master:services/network/public/cpp/header_util.cc;drc=1562cab3f1eda927938f8f4a5a91991fefde66d3;bpv=1;bpt=1;l=22).
+
+* `Content-Length`
+* `Host`
+* `Trailer` or `Te`
+* `Upgrade`
+* `Cookie2`
+* `Keep-Alive`
+* `Transfer-Encoding`
+
+Additionally, setting the `Connection` header to the value `upgrade` is also disallowed.
+
 #### `request.getHeader(name)`
 
 * `name` String - Specify an extra header name.