mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Fix cookie exclusion for fetch CORS pre-flight requests (fixes #3596)
Cookies (and other credentials) will be excluded when appropriate by downgrading |credentials_mode| from kSameOrigin to kOmit. Improve logic for Origin header inclusion, including a fix for Referrer/Origin calculation in URLRequestJob::ComputeReferrerForPolicy when used with custom standard schemes. Specify correct CookiePartitionKeyCollection when loading cookies. To test: - Run tests from https://browseraudit.com/ with and without `--disable-request-handling-for-testing`. Results are the same. - Run `ceftests --gtest_filter=CorsTest.*`.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#include "include/base/cef_callback.h"
|
||||
@@ -67,6 +68,14 @@ enum class HandlerType {
|
||||
std::string GetOrigin(HandlerType handler) {
|
||||
switch (handler) {
|
||||
case HandlerType::SERVER:
|
||||
// TODO: Only call test_server::GetOrigin() after test server
|
||||
// initialization.
|
||||
if (!kUseHttpsServerScheme) {
|
||||
std::stringstream ss;
|
||||
ss << "http://" << test_server::kHttpServerAddress << ":"
|
||||
<< test_server::kHttpServerPort;
|
||||
return ss.str();
|
||||
}
|
||||
return test_server::GetOrigin(kUseHttpsServerScheme);
|
||||
case HandlerType::HTTP_SCHEME:
|
||||
// Use HTTPS because requests from HTTP to the loopback address will be
|
||||
|
Reference in New Issue
Block a user