Skip to content

Commit

Permalink
Merge pull request #754 from brave/fix_referrer_and_httpse
Browse files Browse the repository at this point in the history
Allow redirecting to the same URL when referrer is overwritten
  • Loading branch information
bbondy committed Oct 28, 2018
1 parent a7e7cf8 commit 84dee7f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
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

0 comments on commit 84dee7f

Please sign in to comment.