[cpp-xmltooling COMMIT] in /branches/REL_1/xmltooling/io: HTTPRequest.cpp HTTPRequest.h
noreply at shibboleth.net
noreply at shibboleth.net
Fri Apr 27 03:31:25 BST 2012
Author: scantor
Date: Fri Apr 27 03:31:24 2012
New Revision: 971
URL: http://svn.shibboleth.net/view/cpp-xmltooling?rev=971&view=rev
Log:
Expose cookie map
Modified:
branches/REL_1/xmltooling/io/HTTPRequest.cpp
branches/REL_1/xmltooling/io/HTTPRequest.h
Modified: branches/REL_1/xmltooling/io/HTTPRequest.cpp
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/io/HTTPRequest.cpp?rev=971&r1=970&r2=971&view=diff
==============================================================================
--- branches/REL_1/xmltooling/io/HTTPRequest.cpp (original)
+++ branches/REL_1/xmltooling/io/HTTPRequest.cpp Fri Apr 27 03:31:24 2012
@@ -228,7 +228,7 @@
}
}
-const char* HTTPRequest::getCookie(const char* name) const
+const map<string,string>& HTTPRequest::getCookies() const
{
if (m_cookieMap.empty()) {
string cookies=getHeader("Cookie");
@@ -236,6 +236,11 @@
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));
}
- map<string,string>::const_iterator lookup=m_cookieMap.find(name);
+ return m_cookieMap;
+}
+
+const char* HTTPRequest::getCookie(const char* name) const
+{
+ map<string,string>::const_iterator lookup = getCookies().find(name);
return (lookup==m_cookieMap.end()) ? nullptr : lookup->second.c_str();
}
Modified: branches/REL_1/xmltooling/io/HTTPRequest.h
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/io/HTTPRequest.h?rev=971&r1=970&r2=971&view=diff
==============================================================================
--- branches/REL_1/xmltooling/io/HTTPRequest.h (original)
+++ branches/REL_1/xmltooling/io/HTTPRequest.h Fri Apr 27 03:31:24 2012
@@ -101,6 +101,13 @@
*/
virtual const char* getCookie(const char* name) const;
+ /**
+ * Gets all the cookies supplied by the client.
+ *
+ * @return a map of cookie name/value pairs
+ */
+ virtual const std::map<std::string,std::string>& getCookies() const;
+
private:
mutable std::map<std::string,std::string> m_cookieMap;
};
More information about the commits
mailing list