-
Notifications
You must be signed in to change notification settings - Fork 15.8k
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
fix: Don't ignore the referer header in net.request #23386
Conversation
a240622
to
7b488f6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for this! Would you mind adding a test in spec-main/api-net-spec.ts
? Thanks!
7b488f6
to
6543833
Compare
Done. Could please review my changes again. |
@@ -352,6 +352,7 @@ gin::Handle<SimpleURLLoaderWrapper> SimpleURLLoaderWrapper::Create( | |||
request->force_ignore_site_for_cookies = true; | |||
opts.Get("method", &request->method); | |||
opts.Get("url", &request->url); | |||
opts.Get("referrer", &request->referrer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this has to be a new option
and we can't just read it off the headers
object if it's defined? That would make it easier to use I think / be more expected that the header just works ™️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En, this way works too and less burden for user, but the current approach matches the window.fetch() better and even better if we'll introduce the referrer policy later. I don't have opinion which one is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should probably go with what @MarshallOfSound said and read this out of the headers option.
This API is designed to be similar to the NodeJS http API (though it doesn't match it in every respect). In the NodeJS API, setting the Referer
header is done through the headers
object (or setHeader
), so it would be more consistent with NodeJS for us to respect that here. Additionally, the two linked bugs in the PR description show two examples of how people expect the API to work, which is similarly to the NodeJS API. I think we can avoid confusion by matching NodeJS here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I just pushed the branch forcely and changed the code to read referrer url from headers instead.
6543833
to
7b3e418
Compare
7b3e418
to
528d622
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - just need to remove the unneeded ts change
528d622
to
1ac1779
Compare
I have the same issue on Windows 1909. Electron 8.2.5. Does this fix also solve the issue for Windows user? |
Yes, this pull request fixes the issue for all platforms. |
1ac1779
to
1924398
Compare
Release Notes Persisted
|
I was unable to backport this PR to "7-3-x" cleanly; |
I was unable to backport this PR to "8-x-y" cleanly; |
I was unable to backport this PR to "9-x-y" cleanly; |
welp |
Should we backport the 7e841ce to stable branches first? If we don't want backport it, I think I have to backport this pull manually. |
I don't think we should backport 7e841ce to older branches, please go ahead and create manual backports. (there's no need to backport to 7.x since this was only an issue since the 8.x branch) |
Ok. I'm going to backport this manually. |
@LuoJinghua has manually backported this PR to "9-x-y", please check out #23685 |
@LuoJinghua has manually backported this PR to "master", please check out #23686 |
@LuoJinghua has manually backported this PR to "8-x-y", please check out #23688 |
Description of Change
Don't ignore the referrer header for a request, fixes #22411 #23102.
@zcbenz @MarshallOfSound
Checklist
Release Notes
Notes: Don't ignore the referrer header in net.request