-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate Authorization
headers should not be ignored.
#45699
Comments
Can you share a minimal repro, the expected result, and the actual result? |
Proof-of-conceptimport Network from "node:net";
import HTTP from "node:http";
const server = HTTP.createServer(request => console.log(request.headers))
.listen(_ => {
const client = Network.createConnection(
server.address().port,
_ => client.write(
"GET / HTTP/1.1\r\n"
+ `Authorization: Digest username="ha"\r\n`
+ `Authorization: realm="no"\r\n\r\n`
)
);
}); The actual output
The expected output
|
But now that I think of it, splitting the |
@nodejs/http |
I am not sure whether the “value” in the section §11.6.2 means a “(combined) field value” or “field line value.” If it means the former,
would be valid (meaning, Node.js should respect multiple occurrences of and if it means the latter, invalid (meaning, Node.js is fine as is). |
According to section https://www.rfc-editor.org/rfc/rfc9110#name-changes-from-rfc-7230, if there is no clear indication of "field line value" then it refers to combined value. Now, AFAIK Node implements RFC 7230 and not RFC 9110, so I wonder whether we should implement this or not. @nodejs/http @nodejs/tsc WDYT? |
One problem I see is there's a non-zero risk of breaking existing programs if we make this change. |
If we want to support this it would be behind an option. |
We can leave the default behaviour as it is and implement a flag in |
That sounds good to me. The future documentation on that option would refer to RFC 9110. |
As I said, I would recommend adding an option and possibly documenting it as experimental. I don't have much time to look into RFC 9110 and how it changed things. Note that a lot of old clients and servers are very lenient on HTTP semantics, so they can expect whatever. |
I will open a PR |
PR-URL: #45982 Fixes: #45699 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Paolo Insogna <[email protected]>
PR-URL: nodejs#45982 Fixes: nodejs#45699 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Paolo Insogna <[email protected]>
PR-URL: nodejs#45982 Fixes: nodejs#45699 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Paolo Insogna <[email protected]>
PR-URL: #45982 Backport-PR-URL: #46240 Fixes: #45699 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Paolo Insogna <[email protected]>
PR-URL: #45982 Fixes: #45699 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Paolo Insogna <[email protected]>
PR-URL: #45982 Fixes: #45699 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Paolo Insogna <[email protected]>
The context
A sender can send multiple
Authorization
headers in a request, because theAuthorization
header’s definition,credentials
, allows multipleauth-param
s to be recombined as a comma-separated list.RFC 9110 — HTTP semantics
Node.js MAY join them together with
,
.RFC 9110 — HTTP semantics
Currently, Node.js ignores duplicate
Authorization
headers when it createsmessage.headers
.Node.js 19.2.0 documentation — HTTP
Suggestion
I suggest Node.js join the field line values of multiple
Authorization
headers in a request with,
, instead of ignoring them, when it createsmessage.headers
.The related issue
#3591
The text was updated successfully, but these errors were encountered: