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

Unified Diff: third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp

Issue 1526903002: Make FetchResponseData::createCORSFilteredResponse() consult isForbiddenResponseHeaderName() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « no previous file | third_party/WebKit/Source/modules/fetch/FetchResponseDataTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp b/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp
index 67242fe2f2e3c620217532d177b75e8acc0b5478..a11b2049d24d82a9936c2a784b348c615706a6ff 100644
--- a/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp
+++ b/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp
@@ -7,6 +7,7 @@
#include "core/dom/DOMArrayBuffer.h"
#include "core/fetch/CrossOriginAccessControl.h"
+#include "core/fetch/FetchUtils.h"
#include "modules/fetch/BodyStreamBuffer.h"
#include "modules/fetch/DataConsumerHandleUtil.h"
#include "modules/fetch/DataConsumerTee.h"
@@ -76,7 +77,7 @@ FetchResponseData* FetchResponseData::createBasicFilteredResponse()
response->m_url = m_url;
for (size_t i = 0; i < m_headerList->size(); ++i) {
const FetchHeaderList::Header* header = m_headerList->list()[i].get();
- if (header->first == "set-cookie" || header->first == "set-cookie2")
+ if (FetchUtils::isForbiddenResponseHeaderName(header->first))
continue;
response->m_headerList->append(header->first, header->second);
}
@@ -103,9 +104,9 @@ FetchResponseData* FetchResponseData::createCORSFilteredResponse()
parseAccessControlExposeHeadersAllowList(accessControlExposeHeaders, accessControlExposeHeaderSet);
for (size_t i = 0; i < m_headerList->size(); ++i) {
const FetchHeaderList::Header* header = m_headerList->list()[i].get();
- if (!isOnAccessControlResponseHeaderWhitelist(header->first) && !accessControlExposeHeaderSet.contains(header->first))
- continue;
- response->m_headerList->append(header->first, header->second);
+ const String& name = header->first;
+ if (isOnAccessControlResponseHeaderWhitelist(name) || (accessControlExposeHeaderSet.contains(name) && !FetchUtils::isForbiddenResponseHeaderName(name)))
+ response->m_headerList->append(name, header->second);
}
response->m_buffer = m_buffer;
response->m_mimeType = m_mimeType;
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/fetch/FetchResponseDataTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698