Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: history/HistoryItem.cpp

Issue 220010: Store non-standard HTTP headers in history. (WebKit side) Base URL: http://svn.webkit.org/repository/webkit/trunk/WebCore/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « history/HistoryItem.h ('k') | loader/FrameLoader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: history/HistoryItem.cpp
===================================================================
--- history/HistoryItem.cpp (revision 48585)
+++ history/HistoryItem.cpp (working copy)
@@ -447,10 +447,68 @@
return m_formContentType;
}
+void HistoryItem::setHTTPHeaderField(const String& name, const String& value)
+{
+ m_httpHeadersMap.set(name, value);
+}
+
+const HTTPHeaderMap& HistoryItem::httpHeaderFields() const
+{
+ return m_httpHeadersMap;
+}
+
+bool HistoryItem::excludeHTTPHeaderFromStorage(const String& name) const
+{
+ // All header names in this list must be in lower case.
+ static char* excludedList[] = {
+ "accept",
+ "accept-charset",
+ "accept-encoding",
+ "accept-language",
+ "accept-ranges",
+ "authorization",
+ "content-encoding",
+ "content-length",
+ "content-location",
+ "content-md5",
+ "content-range",
+ "content-type",
+ "cookie",
+ "expect",
+ "host",
+ "if-range",
+ "origin",
+ "proxy-authorization",
+ "range",
+ "referer",
+ "te",
+ "trailer",
+ "transfer-encoding",
+ "upgrade",
+ "user-agent",
+ "via",
+ };
+
+ String nameLower = name.lower();
+ for (size_t i = 0; i < sizeof(excludedList) / sizeof(char*); ++i) {
+ if (nameLower == excludedList[i])
+ return true;
+ }
+ return false;
+}
+
void HistoryItem::setFormInfoFromRequest(const ResourceRequest& request)
{
m_referrer = request.httpReferrer();
-
+
+ // Store HTTP headers
+ const HTTPHeaderMap& headerMap = request.httpHeaderFields();
+ HTTPHeaderMap::const_iterator it = headerMap.begin();
+ for (; it != headerMap.end(); ++it) {
+ if (!excludeHTTPHeaderFromStorage(it->first))
+ m_httpHeadersMap.set(it->first, it->second);
+ }
+
if (equalIgnoringCase(request.httpMethod(), "POST")) {
// FIXME: Eventually we have to make this smart enough to handle the case where
// we have a stream for the body to handle the "data interspersed with files" feature.
« no previous file with comments | « history/HistoryItem.h ('k') | loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698