[cpp-xmltooling] branch master updated: Hide fallback cookies from higher layers.
Scott Cantor
cantor.2 at osu.edu
Tue Feb 25 10:41:49 EST 2020
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository cpp-xmltooling.
View the commit online:
http://git.shibboleth.net/view/?p=cpp-xmltooling.git;a=commit;h=c457f012d4a3a0cd4d3663321419feecd6feb3e3
The following commit(s) were added to refs/heads/master by this push:
new c457f01 Hide fallback cookies from higher layers.
c457f01 is described below
commit c457f012d4a3a0cd4d3663321419feecd6feb3e3
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Feb 25 10:41:12 2020 -0500
Hide fallback cookies from higher layers.
---
xmltooling/io/HTTPRequest.cpp | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/xmltooling/io/HTTPRequest.cpp b/xmltooling/io/HTTPRequest.cpp
index d0edd55..3c00372 100644
--- a/xmltooling/io/HTTPRequest.cpp
+++ b/xmltooling/io/HTTPRequest.cpp
@@ -223,6 +223,9 @@ namespace {
split(nvpair, s, is_any_of("="));
if (nvpair.size() == 2) {
trim(nvpair[0]);
+ if (ends_with(nvpair[0], "_fgwars")) {
+ nvpair[0].erase(nvpair[0].cend() - 7, nvpair[0].cend());
+ }
cookieMap[nvpair[0]] = nvpair[1];
}
}
@@ -234,7 +237,8 @@ const map<string,string>& HTTPRequest::getCookies() const
string cookies=getHeader("Cookie");
vector<string> nvpair;
tokenizer< char_separator<char> > nvpairs(cookies, char_separator<char>(";"));
- for_each(nvpairs.begin(), nvpairs.end(), boost::bind(handle_cookie_fn, boost::ref(m_cookieMap), boost::ref(nvpair), _1));
+ for_each(nvpairs.begin(), nvpairs.end(),
+ boost::bind(handle_cookie_fn, boost::ref(m_cookieMap), boost::ref(nvpair), _1));
}
return m_cookieMap;
}
@@ -246,15 +250,12 @@ const char* HTTPRequest::getCookie(const char* name) const
const char* HTTPRequest::getCookie(const char* name, bool sameSiteFallback) const
{
+ // The fallback support is implemented via the getCookies() load above
+ // so we ignore it here.
+
map<string,string>::const_iterator lookup = getCookies().find(name);
if (lookup != m_cookieMap.end()) {
return lookup->second.c_str();
- } else if (sameSiteFallback) {
- string hackeryName(name);
- lookup = getCookies().find(hackeryName.append("_fgwars"));
- if (lookup != m_cookieMap.end()) {
- return lookup->second.c_str();
- }
}
return nullptr;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list