2023-11-17 00:19:27 +01:00
|
|
|
diff --git net/url_request/url_request_job.cc net/url_request/url_request_job.cc
|
2024-07-29 19:09:20 +02:00
|
|
|
index a2aa3c3361410..c5e91f6ddebe7 100644
|
2023-11-17 00:19:27 +01:00
|
|
|
--- net/url_request/url_request_job.cc
|
|
|
|
+++ net/url_request/url_request_job.cc
|
2024-07-29 19:09:20 +02:00
|
|
|
@@ -35,6 +35,7 @@
|
2023-11-17 00:19:27 +01:00
|
|
|
#include "net/ssl/ssl_private_key.h"
|
|
|
|
#include "net/url_request/redirect_util.h"
|
|
|
|
#include "net/url_request/url_request_context.h"
|
|
|
|
+#include "url/url_util.h"
|
|
|
|
|
|
|
|
namespace net {
|
|
|
|
|
2024-07-29 19:09:20 +02:00
|
|
|
@@ -47,6 +48,16 @@ base::Value::Dict SourceStreamSetParams(SourceStream* source_stream) {
|
2023-11-17 00:19:27 +01:00
|
|
|
return event_params;
|
|
|
|
}
|
|
|
|
|
|
|
|
+bool IsSecureScheme(const GURL& url) {
|
|
|
|
+ if (!url.has_scheme()) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if (GURL::SchemeIsCryptographic(url.scheme_piece())) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return base::Contains(url::GetSecureSchemes(), url.scheme_piece());
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
// Each SourceStreams own the previous SourceStream in the chain, but the
|
2024-07-29 19:09:20 +02:00
|
|
|
@@ -343,8 +354,7 @@ GURL URLRequestJob::ComputeReferrerForPolicy(
|
2023-11-17 00:19:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool secure_referrer_but_insecure_destination =
|
|
|
|
- original_referrer.SchemeIsCryptographic() &&
|
|
|
|
- !destination.SchemeIsCryptographic();
|
|
|
|
+ IsSecureScheme(original_referrer) && !IsSecureScheme(destination);
|
|
|
|
|
|
|
|
switch (policy) {
|
|
|
|
case ReferrerPolicy::CLEAR_ON_TRANSITION_FROM_SECURE_TO_INSECURE:
|