-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
[Bug]: net.fetch fails on manual redirect #43715
Comments
This is working as documented, the request is cancelled if you don't call Ref: https://www.electronjs.org/docs/latest/api/client-request#event-redirect |
I see I'm trying use |
@MarshallOfSound this might be a bug in our Node.js fetch response also seems different from the spec, ref wpt tests https://github.com/web-platform-tests/wpt/blob/master/fetch/api/redirect/redirect-mode.any.js
|
Okay Node.js implementation was initially following the spec but it was later changed per nodejs/undici#1193. What should be the behavior we match in our |
For browsers opaque responses are needed for preventing xss attacks https://fetch.spec.whatwg.org/#atomic-http-redirect-handling. In Electron, users already can use Node.js fetch in these process to get those responses, so if we were to align net.fetch behavior we are not increasing the risk any higher. Also, the api is meant to offer easy migration for users from Node.js fetch to use chromium network stack, so aligning their behaviors would be better in this case. |
this also prevents (AFAIK) conditionally but completely intercepting http/s protocol by preventing the browser from following redirects. Appologies for the dumb question but Is anyone aware of an alternative solution to implement this currently using net.request (the issue here being a complete reproduction of the GlobalRequest to ClientRequest to listen for the 'redirect' event)?
|
Preflight Checklist
Electron Version
30.4.0, 32.1.0
What operating system(s) are you using?
macOS
Operating System Version
Sonoma
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
unknown
Expected Behavior
using redirect: 'manual' net.fetch should return with the redirect response.
Actual Behavior
using redirect: 'manual' net.fetch fails with an 'Error: Redirect was cancelled'
Testcase Gist URL
https://gist.github.com/510aba6af66a8bbecf31682d8098cf25
Additional Information
No response
The text was updated successfully, but these errors were encountered: