mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:37:34 +00:00
LibWeb: Implement the CORS settings attribute credentials mode AO
This commit is contained in:
parent
9070aaebee
commit
9701128145
2 changed files with 22 additions and 0 deletions
|
@ -26,4 +26,24 @@ CORSSettingAttribute cors_setting_attribute_from_keyword(Optional<String> const&
|
||||||
return CORSSettingAttribute::Anonymous;
|
return CORSSettingAttribute::Anonymous;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attribute-credentials-mode
|
||||||
|
Fetch::Infrastructure::Request::CredentialsMode cors_settings_attribute_credentials_mode(CORSSettingAttribute attribute)
|
||||||
|
{
|
||||||
|
switch (attribute) {
|
||||||
|
// -> No CORS
|
||||||
|
// -> Anonymous
|
||||||
|
case CORSSettingAttribute::NoCORS:
|
||||||
|
case CORSSettingAttribute::Anonymous:
|
||||||
|
// "same-origin"
|
||||||
|
return Fetch::Infrastructure::Request::CredentialsMode::SameOrigin;
|
||||||
|
|
||||||
|
// -> Use Credentials
|
||||||
|
case CORSSettingAttribute::UseCredentials:
|
||||||
|
// "include"
|
||||||
|
return Fetch::Infrastructure::Request::CredentialsMode::Include;
|
||||||
|
}
|
||||||
|
|
||||||
|
VERIFY_NOT_REACHED();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <AK/Optional.h>
|
#include <AK/Optional.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
|
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
|
@ -19,5 +20,6 @@ enum class CORSSettingAttribute {
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] CORSSettingAttribute cors_setting_attribute_from_keyword(Optional<String> const& keyword);
|
[[nodiscard]] CORSSettingAttribute cors_setting_attribute_from_keyword(Optional<String> const& keyword);
|
||||||
|
[[nodiscard]] Fetch::Infrastructure::Request::CredentialsMode cors_settings_attribute_credentials_mode(CORSSettingAttribute);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue