Skip to content
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

Add new protocol interceptor that allows delegating to URLRequestHttpJob #16421

Open
ibash opened this issue Jan 16, 2019 · 4 comments
Open

Add new protocol interceptor that allows delegating to URLRequestHttpJob #16421

ibash opened this issue Jan 16, 2019 · 4 comments

Comments

@ibash
Copy link
Contributor

ibash commented Jan 16, 2019

Is your feature request related to a problem? Please describe.
As a user of electron, I want to be able to intercept http requests and optionally send a response back. If I don't choose to send a response I want it to be handled by chrome's network stack.

Describe the solution you'd like
I'd like to add a new protocol like interceptFooProtocol that:

  • Calls into a handler at various points in the request job (at the start of the request, after headers are constructed, when headers are received, etc)
  • Allows optionally providing a http response for the job
  • If an http response is not provided, delegates to URLRequestHttpJob in chrome

Describe alternatives you've considered

  • Use interceptStreamProtocol and use the node network stack
    • The problem with this is that URLRequestHttpJob does a lot under the hood, and rewriting it in js is possible, but a lot of work. Among other things it adds headers, manages cookies, and checks ssl certs for pinning.
    • The other problem is that as bugs arise with interceptStreamProtocol it still needs to go through electron to be fixed, vs calling into URLRequestHttpJob and knowing that it will be handled the same as chrome.
  • Use WebRequest to intercept
    • This only allows inspecting the request or cancelling it, you can't provide an http response as far as I can see.

Additional context

@ibash
Copy link
Contributor Author

ibash commented Jan 16, 2019

If there's consensus on what this can/should look like I'd be happy to take a stab at making a PR.

@maxosprojects
Copy link

+1

@nornagon
Copy link
Member

nornagon commented Mar 9, 2022

This might be a duplicate of #15434?

@giuliopaci
Copy link

@nornagon I also think so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants