#include "third_party/blink/renderer/platform/loader/cors/cors.h"
#include <string>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "net/http/http_util.h"
#include "services/network/public/cpp/cors/cors.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_response.h"
#include "third_party/blink/renderer/platform/network/http_names.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
namespace blink {
namespace {
class HTTPHeaderNameListParser { … };
}
namespace cors {
bool IsCorsEnabledRequestMode(network::mojom::RequestMode request_mode) { … }
bool IsCorsSafelistedMethod(const String& method) { … }
bool IsCorsSafelistedContentType(const String& media_type) { … }
bool IsNoCorsSafelistedHeader(const String& name, const String& value) { … }
bool IsPrivilegedNoCorsHeaderName(const String& name) { … }
bool IsNoCorsSafelistedHeaderName(const String& name) { … }
PLATFORM_EXPORT Vector<String> PrivilegedNoCorsHeaderNames() { … }
bool IsForbiddenRequestHeader(const String& name, const String& value) { … }
bool ContainsOnlyCorsSafelistedHeaders(const HTTPHeaderMap& header_map) { … }
bool CalculateCorsFlag(const KURL& url,
const SecurityOrigin* initiator_origin,
const SecurityOrigin* isolated_world_origin,
network::mojom::RequestMode request_mode) { … }
HTTPHeaderSet ExtractCorsExposedHeaderNamesList(
network::mojom::CredentialsMode credentials_mode,
const ResourceResponse& response) { … }
bool IsCorsSafelistedResponseHeader(const String& name) { … }
bool IsNoCorsAllowedContext(mojom::blink::RequestContextType context) { … }
}
}