-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit 2cde2a4
feat(node): Do not drop 300 and 304 status codes by default (#17686)
Looking at
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status#redirection_messages,
it seems that we should not filter out 300, 302 and 304 status codes by
default:
> [300 Multiple
Choices](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/300)
In [agent-driven content
negotiation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Content_negotiation#agent-driven_negotiation),
the request has more than one possible response and the user agent or
user should choose one of them. There is no standardized way for clients
to automatically choose one of the responses, so this is rarely used.
> [304 Not
Modified](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/304)
This is used for caching purposes. It tells the client that the response
has not been modified, so the client can continue to use the same
[cached](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Caching)
version of the response.
In contrast, the others seem safe to continue to filter:
> [301 Moved
Permanently](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/301)
The URL of the requested resource has been changed permanently. The new
URL is given in the response.
> [302
Found](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/302)
This response code means that the URI of requested resource has been
changed temporarily. Further changes in the URI might be made in the
future, so the same URI should be used by the client in future requests.
> [303 See
Other](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/303)
The server sent this response to direct the client to get the requested
resource at another URI with a
[GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods/GET)
request.
> [305 Use Proxy
Deprecated](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status#305_use_proxy)
Defined in a previous version of the HTTP specification to indicate that
a requested response must be accessed by a proxy. It has been deprecated
due to security concerns regarding in-band configuration of a proxy.
> [306
unused](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status#306_unused)
This response code is no longer used; but is reserved. It was used in a
previous version of the HTTP/1.1 specification.
> [307 Temporary
Redirect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/307)
The server sends this response to direct the client to get the requested
resource at another URI with the same method that was used in the prior
request. This has the same semantics as the 302 Found response code,
with the exception that the user agent must not change the HTTP method
used: if a
[POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods/POST)
was used in the first request, a POST must be used in the redirected
request.
> [308 Permanent
Redirect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/308)
This means that the resource is now permanently located at another URI,
specified by the
[Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Location)
response header. This has the same semantics as the 301 Moved
Permanently HTTP response code, with the exception that the user agent
must not change the HTTP method used: if a
[POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods/POST)
was used in the first request, a POST must be used in the second
request.
eventually it makes sense to unify this between node/node-core, but this
should happen when we merge the httpIntegration split PR.1 parent c022972 commit 2cde2a4
2 files changed
+54
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | - | ||
2 | + | ||
3 | + | ||
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
65 | - | ||
66 | + | ||
66 | 67 | | |
67 | 68 | | |
68 | - | ||
69 | + | ||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
118 | - | ||
119 | + | ||
120 | + | ||
121 | + | ||
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
| |||
133 | 136 | | |
134 | 137 | | |
135 | 138 | | |
136 | - | ||
137 | - | ||
138 | - | ||
139 | - | ||
140 | - | ||
141 | - | ||
142 | - | ||
143 | - | ||
144 | - | ||
145 | - | ||
146 | - | ||
147 | - | ||
139 | + | ||
140 | + | ||
141 | + | ||
142 | + | ||
143 | + | ||
144 | + | ||
148 | 145 | | |
149 | 146 | | |
150 | 147 | | |
151 | 148 | | |
152 | 149 | | |
153 | 150 | | |
154 | 151 | | |
152 | + | ||
153 | + | ||
154 | + | ||
155 | + | ||
156 | + | ||
157 | + | ||
158 | + | ||
159 | + | ||
160 | + | ||
161 | + | ||
162 | + | ||
163 | + | ||
164 | + | ||
165 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | - | ||
6 | + | ||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | + | ||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
87 | - | ||
88 | + | ||
88 | 89 | | |
89 | 90 | | |
90 | - | ||
91 | + | ||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| |||
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
198 | - | ||
199 | + | ||
200 | + | ||
201 | + | ||
199 | 202 | | |
200 | 203 | | |
201 | 204 | | |
| |||
225 | 228 | | |
226 | 229 | | |
227 | 230 | | |
228 | - | ||
229 | - | ||
230 | - | ||
231 | - | ||
232 | - | ||
233 | - | ||
234 | - | ||
235 | - | ||
236 | - | ||
237 | - | ||
238 | - | ||
239 | - | ||
231 | + | ||
232 | + | ||
233 | + | ||
234 | + | ||
235 | + | ||
236 | + | ||
240 | 237 | | |
241 | 238 | | |
242 | 239 | | |
| |||
282 | 279 | | |
283 | 280 | | |
284 | 281 | | |
282 | + | ||
283 | + | ||
284 | + | ||
285 | + | ||
286 | + | ||
287 | + | ||
288 | + | ||
289 | + | ||
290 | + | ||
291 | + | ||
292 | + | ||
293 | + | ||
294 | + | ||
295 | + | ||
0 commit comments