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

Allow redirecting to the same URL when referrer is overwritten #754

Merged
merged 1 commit into from
Oct 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion browser/net/brave_network_delegate_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ void BraveNetworkDelegateBase::RunNextCallback(

if (ctx->event_type == brave::kOnBeforeRequest) {
if (!ctx->new_url_spec.empty() &&
ctx->new_url_spec != ctx->request_url.spec() &&
(ctx->new_url_spec != ctx->request_url.spec() ||
ctx->referrer_changed) &&
IsRequestIdentifierValid(ctx->request_identifier)) {
*ctx->new_url = GURL(ctx->new_url_spec);
}
Expand Down
4 changes: 3 additions & 1 deletion browser/net/brave_site_hacks_network_delegate_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ int OnBeforeURLRequest_SiteHacksWork(
const ResponseCallback& next_callback,
std::shared_ptr<BraveRequestInfo> ctx) {

if (ApplyPotentialReferrerBlock(ctx->request))
if (ApplyPotentialReferrerBlock(ctx->request)) {
ctx->new_url_spec = ctx->request_url.spec();
ctx->referrer_changed = true;
}

return net::OK;
}
Expand Down
1 change: 1 addition & 0 deletions browser/net/url_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct BraveRequestInfo {
bool allow_brave_shields = true;
bool allow_ads = false;
bool allow_http_upgradable_resource = false;
bool referrer_changed = false;
int render_process_id = 0;
int render_frame_id = 0;
int frame_tree_node_id = 0;
Expand Down