Skip to content

Commit

Permalink
Merge pull request #2114 from brave/storage_proxy_crlsets
Browse files Browse the repository at this point in the history
Issue 3920: Proxy requests for resources from storage.googleapis.com through the crlset redirector
  • Loading branch information
jumde authored Apr 1, 2019
2 parents 6d697aa + e1cdeaa commit 6290c65
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions browser/net/brave_static_redirect_network_delegate_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ int OnBeforeURLRequest_StaticRedirectWork(
URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS, kCRLSetPrefix2);
static URLPattern crlSet_pattern3(
URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS, kCRLSetPrefix3);
static URLPattern crlSet_pattern4(
URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS, kCRLSetPrefix4);
static URLPattern crxDownload_pattern(
URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS, kCRXDownloadPrefix);

Expand Down Expand Up @@ -68,6 +70,13 @@ int OnBeforeURLRequest_StaticRedirectWork(
return net::OK;
}

if (crlSet_pattern4.MatchesURL(ctx->request_url)) {
replacements.SetSchemeStr("https");
replacements.SetHostStr("crlsets.brave.com");
ctx->new_url_spec = ctx->request_url.ReplaceComponents(replacements).spec();
return net::OK;
}

#if !defined(NDEBUG)
GURL gurl = ctx->request_url;
static std::vector<URLPattern> allowed_patterns({
Expand Down
3 changes: 3 additions & 0 deletions common/network_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ const char kCRLSetPrefix2[] =
"*://*.gvt1.com/edgedl/release2/chrome_component/*crl-set*";
const char kCRLSetPrefix3[] =
"*://www.google.com/dl/release2/chrome_component/*crl-set*";
const char kCRLSetPrefix4[] =
"*://storage.googleapis.com/update-delta/hfnkpimlhhgieaddgfemjhofmfblmnib"
"/*crxd";
const char kGoogleTagManagerPattern[] =
"https://www.googletagmanager.com/gtm.js";
const char kGoogleTagServicesPattern[] =
Expand Down
1 change: 1 addition & 0 deletions common/network_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern const char kSafeBrowsingPrefix[];
extern const char kCRLSetPrefix1[];
extern const char kCRLSetPrefix2[];
extern const char kCRLSetPrefix3[];
extern const char kCRLSetPrefix4[];
extern const char kTwitterPattern[];
extern const char kTwitterReferrer[];
extern const char kTwitterRedirectURL[];
Expand Down

0 comments on commit 6290c65

Please sign in to comment.