|
@@ -46,6 +46,12 @@ bool HttpCookie::parse(const std::string& str) {
|
|
|
stricmp(val.c_str(), "None") == 0 ? HttpCookie::SameSite::None :
|
|
stricmp(val.c_str(), "None") == 0 ? HttpCookie::SameSite::None :
|
|
|
HttpCookie::SameSite::Default;
|
|
HttpCookie::SameSite::Default;
|
|
|
}
|
|
}
|
|
|
|
|
+ else if (stricmp(pkey, "Priority") == 0) {
|
|
|
|
|
+ priority = stricmp(val.c_str(), "Low") == 0 ? HttpCookie::Priority::Low :
|
|
|
|
|
+ stricmp(val.c_str(), "Medium") == 0 ? HttpCookie::Priority::Medium :
|
|
|
|
|
+ stricmp(val.c_str(), "High") == 0 ? HttpCookie::Priority::High :
|
|
|
|
|
+ HttpCookie::Priority::NotSet ;
|
|
|
|
|
+ }
|
|
|
else {
|
|
else {
|
|
|
if (name.empty()) {
|
|
if (name.empty()) {
|
|
|
name = key;
|
|
name = key;
|
|
@@ -75,19 +81,20 @@ std::string HttpCookie::dump() const {
|
|
|
assert(!name.empty() || !kv.empty());
|
|
assert(!name.empty() || !kv.empty());
|
|
|
std::string res;
|
|
std::string res;
|
|
|
|
|
|
|
|
- if (!kv.empty()) {
|
|
|
|
|
- for (auto& pair : kv) {
|
|
|
|
|
- if (!res.empty()) res += "; ";
|
|
|
|
|
- res += pair.first;
|
|
|
|
|
- res += "=";
|
|
|
|
|
- res += pair.second;
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
+ if (!name.empty()) {
|
|
|
res = name;
|
|
res = name;
|
|
|
res += "=";
|
|
res += "=";
|
|
|
res += value;
|
|
res += value;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ for (auto& pair : kv) {
|
|
|
|
|
+ if (pair.first == name) continue;
|
|
|
|
|
+ if (!res.empty()) res += "; ";
|
|
|
|
|
+ res += pair.first;
|
|
|
|
|
+ res += "=";
|
|
|
|
|
+ res += pair.second;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (!domain.empty()) {
|
|
if (!domain.empty()) {
|
|
|
res += "; Domain=";
|
|
res += "; Domain=";
|
|
|
res += domain;
|
|
res += domain;
|
|
@@ -113,6 +120,13 @@ std::string HttpCookie::dump() const {
|
|
|
"None" ;
|
|
"None" ;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (priority != HttpCookie::Priority::NotSet) {
|
|
|
|
|
+ res += "; Priority=";
|
|
|
|
|
+ res += priority == HttpCookie::Priority::Low ? "Low" :
|
|
|
|
|
+ priority == HttpCookie::Priority::Medium ? "Medium" :
|
|
|
|
|
+ "High" ;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (secure) {
|
|
if (secure) {
|
|
|
res += "; Secure";
|
|
res += "; Secure";
|
|
|
}
|
|
}
|