ceftests: Fix CookieTest failure with --use-test-http-server (see issue #3348)
This commit is contained in:
parent
a895274add
commit
0b1c3938c6
|
@ -1111,10 +1111,12 @@ class CookieAccessResponseHandler {
|
|||
};
|
||||
|
||||
std::string GetHeaderValue(const CefServer::HeaderMap& header_map,
|
||||
const std::string& header_name) {
|
||||
CefServer::HeaderMap::const_iterator it = header_map.find(header_name);
|
||||
if (it != header_map.end())
|
||||
return it->second;
|
||||
const std::string& header_name_lower) {
|
||||
for (const auto& [name, value] : header_map) {
|
||||
if (AsciiStrToLower(name) == header_name_lower) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
|
@ -1131,7 +1133,7 @@ class CookieAccessSchemeHandler : public CefResourceHandler {
|
|||
|
||||
CefRequest::HeaderMap headerMap;
|
||||
request->GetHeaderMap(headerMap);
|
||||
const std::string& cookie_str = GetHeaderValue(headerMap, "Cookie");
|
||||
const std::string& cookie_str = GetHeaderValue(headerMap, "cookie");
|
||||
TestCookieString(cookie_str, data_->cookie_js_ct_, data_->cookie_net_ct_);
|
||||
|
||||
// Continue immediately.
|
||||
|
|
|
@ -11,6 +11,12 @@
|
|||
#include "include/cef_request_context_handler.h"
|
||||
#include "tests/gtest/include/gtest/gtest.h"
|
||||
|
||||
std::string AsciiStrToLower(const std::string& str) {
|
||||
std::string lowerStr = str;
|
||||
std::transform(lowerStr.begin(), lowerStr.end(), lowerStr.begin(), ::tolower);
|
||||
return lowerStr;
|
||||
}
|
||||
|
||||
void TestMapEqual(const CefRequest::HeaderMap& map1,
|
||||
const CefRequest::HeaderMap& map2,
|
||||
bool allowExtras) {
|
||||
|
@ -25,11 +31,9 @@ void TestMapEqual(const CefRequest::HeaderMap& map1,
|
|||
|
||||
for (it1 = map1.begin(); it1 != map1.end(); ++it1) {
|
||||
bool found = false;
|
||||
std::string name1 = it1->first;
|
||||
std::transform(name1.begin(), name1.end(), name1.begin(), ::tolower);
|
||||
std::string name1 = AsciiStrToLower(it1->first);
|
||||
for (it2 = map2.begin(); it2 != map2.end(); ++it2) {
|
||||
std::string name2 = it2->first;
|
||||
std::transform(name2.begin(), name2.end(), name2.begin(), ::tolower);
|
||||
std::string name2 = AsciiStrToLower(it2->first);
|
||||
if (name1 == name2 && it1->second == it2->second) {
|
||||
found = true;
|
||||
break;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
CefTime CefTimeFrom(CefBaseTime value);
|
||||
CefBaseTime CefBaseTimeFrom(const CefTime& value);
|
||||
|
||||
std::string AsciiStrToLower(const std::string& str);
|
||||
|
||||
// Test that CefRequest::HeaderMap objects are equal. Multiple values with the
|
||||
// same key are allowed, but not duplicate entries with the same key/value. If
|
||||
// |allowExtras| is true then additional header fields will be allowed in
|
||||
|
|
|
@ -453,8 +453,7 @@ std::string GetHeaderValue(const CefRequest::HeaderMap& header_map,
|
|||
const std::string& header_name_lower) {
|
||||
CefRequest::HeaderMap::const_iterator it = header_map.begin();
|
||||
for (; it != header_map.end(); ++it) {
|
||||
std::string name = it->first;
|
||||
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
|
||||
std::string name = AsciiStrToLower(it->first);
|
||||
if (name == header_name_lower)
|
||||
return it->second;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue