fix(fetch): use case-insensitive host header lookup on redirect#41769
fix(fetch): use case-insensitive host header lookup on redirect#41769rahulrao85 wants to merge 2 commits into
Conversation
The redirect host header update used headers['host'] (lowercase only), but setHeader() preserves the original casing of header names. If extraHTTPHeaders set 'Host' (capital H), the redirect's host update was silently skipped. Now uses case-insensitive lookup like setHeader, getHeader, and removeHeader in the same file. Fixes: microsoft#41766
dgozman
left a comment
There was a problem hiding this comment.
Thank you for the PR, this looks good.
Could you please use the helper function and update the should update host header on redirect test in tests/library/browsercontext-fetch.spec.ts to pass HosT instead of host?
|
@rahulrao85 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Test results for "MCP"3 failed 7757 passed, 1249 skipped Merge workflow run. |
Test results for "tests 1"9 flaky49676 passed, 1156 skipped Merge workflow run. |
Summary
The redirect host header update used \headers['host']\ (lowercase only), but \setHeader()\ preserves the original casing of header names. If \extraHTTPHeaders\ set 'Host'\ (capital H), the host was never updated on redirect, causing the request to be sent with the original origin's Host header.
Now uses case-insensitive lookup (\Object.keys().find()), consistent with \setHeader, \getHeader, and
emoveHeader\ in the same file.
Fixes: #41766