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 protocol filtering of net.request #11804

Merged
merged 2 commits into from Feb 16, 2018

Conversation

Projects
None yet
6 participants
@tarruda
Contributor

tarruda commented Feb 1, 2018

net::URLRequest inherits from base::SupportsUserData, which allows
associating arbitrary data with the request. Use this mechanism as a
condition for filtering requests from custom protocols.

Close #11657

@tarruda tarruda requested a review from zcbenz Feb 1, 2018

@tarruda tarruda requested a review from electron/reviewers as a code owner Feb 1, 2018

@tarruda

This comment has been minimized.

Contributor

tarruda commented Feb 1, 2018

@pfrazee can you test this branch?

@deepak1556

Thanks for fixing this! This was also breaking custom protocols with plzNavigate and I was planning to go down the same route.

@@ -28,6 +28,7 @@ namespace atom {
namespace api {
const void* DisableProtocolInterceptFlagKey();

This comment has been minimized.

@deepak1556

deepak1556 Feb 1, 2018

Member

It would be better to declare the key in AtomURLRequestJobFactory and perform the check there. Should avoid the dependency of api class methods if possible.

This comment has been minimized.

@tarruda

tarruda Feb 1, 2018

Contributor

👍

@@ -121,6 +124,9 @@ void AtomURLRequest::DoInitialize(
request_->set_method(method);
// Do not send cookies from the cookie store.
DoSetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES);
// Set a flag to stop custom protocol from intercepting this request.
request_->SetUserData(api::DisableProtocolInterceptFlagKey(),

This comment has been minimized.

@deepak1556

deepak1556 Feb 1, 2018

Member

This can just be request_->SetUserData(key, base::MakeUnique<base::SupportsUserData::Data>()) , can avoid declaring class DisableProtocolInterceptFlag

This comment has been minimized.

@tarruda

tarruda Feb 1, 2018

Contributor

👍

@deepak1556

LGTM, is it possible to add some tests ?

@pfrazee

This comment has been minimized.

Contributor

pfrazee commented Feb 2, 2018

Hey, I'm traveling till monday so I'll try to get a quick second, may be next week

@pfrazee

This comment has been minimized.

Contributor

pfrazee commented Feb 7, 2018

Confirmed this PR fixes my issue.

@MarshallOfSound

This comment has been minimized.

Member

MarshallOfSound commented Feb 12, 2018

This is just pending some tests if possible @tarruda

@pfrazee

This comment has been minimized.

Contributor

pfrazee commented Feb 15, 2018

I made a PR with a test. Checked that it fails prior to this PR, and passes after. #11931

tarruda and others added some commits Feb 1, 2018

Fix protocol filtering of net.request
net::URLRequest inherits from base::SupportsUserData, which allows
associating arbitrary data with the request. Use this mechanism as a
condition for filtering requests from custom protocols.

Close #11657

@jkleinsc jkleinsc merged commit f3415c0 into master Feb 16, 2018

9 checks passed

WIP ready for review
Details
ci/circleci: electron-linux-arm Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm-test Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm64 Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm64-test Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-ia32 Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-x64 Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/jenkins/pr-head This commit looks good
Details

@jkleinsc jkleinsc deleted the fix-protocol-origin-filtering branch Feb 16, 2018

@zeke

This comment has been minimized.

Member

zeke commented Feb 16, 2018

@pfrazee was this one of your Beaker showstopper bugs, or was that something else?

@pfrazee

This comment has been minimized.

Contributor

pfrazee commented Feb 16, 2018

@zeke I think this was it

@zeke

This comment has been minimized.

Member

zeke commented Feb 16, 2018

🎉

@pfrazee

This comment has been minimized.

Contributor

pfrazee commented Feb 16, 2018

Thanks all!

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