Changeset 252813 in webkit
- Timestamp:
- Nov 22, 2019 4:04:05 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252810 r252813 1 2019-11-22 Chris Dumez <cdumez@apple.com> 2 3 HTTPHeaderMap's operator== is not fully correct 4 https://bugs.webkit.org/show_bug.cgi?id=204361 5 6 Reviewed by Alex Christensen. 7 8 If headers are added in a different order, HTTPHeaderMap's operator==() would wrongly 9 return false because it is using a Vector internally to store the headers. Also, it 10 would incorrectly return false if the case of the headers did not match. 11 12 * platform/network/HTTPHeaderMap.cpp: 13 (WebCore::HTTPHeaderMap::get const): 14 (WebCore::HTTPHeaderMap::getUncommonHeader const): 15 * platform/network/HTTPHeaderMap.h: 16 (WebCore::HTTPHeaderMap::operator==): 17 1 18 2019-11-22 Zalan Bujtas <zalan@apple.com> 2 19 -
trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp
r248316 r252813 56 56 return get(headerName); 57 57 58 return getUncommonHeader(name); 59 } 60 61 String HTTPHeaderMap::getUncommonHeader(const String& name) const 62 { 58 63 auto index = m_uncommonHeaders.findMatching([&](auto& header) { 59 64 return equalIgnoringASCIICase(header.key, name); -
trunk/Source/WebCore/platform/network/HTTPHeaderMap.h
r248316 r252813 159 159 WEBCORE_EXPORT void append(const String& name, const String& value); 160 160 WEBCORE_EXPORT bool contains(const String&) const; 161 bool remove(const String&);161 WEBCORE_EXPORT bool remove(const String&); 162 162 163 163 #if USE(CF) … … 191 191 friend bool operator==(const HTTPHeaderMap& a, const HTTPHeaderMap& b) 192 192 { 193 return a.m_commonHeaders == b.m_commonHeaders && a.m_uncommonHeaders == b.m_uncommonHeaders; 193 if (a.m_commonHeaders.size() != b.m_commonHeaders.size() || a.m_uncommonHeaders.size() != b.m_uncommonHeaders.size()) 194 return false; 195 for (auto& commonHeader : a.m_commonHeaders) { 196 if (b.get(commonHeader.key) != commonHeader.value) 197 return false; 198 } 199 for (auto& uncommonHeader : a.m_uncommonHeaders) { 200 if (b.getUncommonHeader(uncommonHeader.key) != uncommonHeader.value) 201 return false; 202 } 203 return true; 194 204 } 195 205 … … 204 214 private: 205 215 void setUncommonHeader(const String& name, const String& value); 216 WEBCORE_EXPORT String getUncommonHeader(const String& name) const; 206 217 207 218 CommonHeadersVector m_commonHeaders; -
trunk/Tools/ChangeLog
r252805 r252813 1 2019-11-22 Chris Dumez <cdumez@apple.com> 2 3 HTTPHeaderMap's operator== is not fully correct 4 https://bugs.webkit.org/show_bug.cgi?id=204361 5 6 Reviewed by Alex Christensen. 7 8 Add API test coverage. 9 10 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 11 * TestWebKitAPI/Tests/WebCore/HTTPHeaderMap.cpp: Added. 12 (TestWebKitAPI::TEST): 13 1 14 2019-11-22 Sihui Liu <sihui_liu@apple.com> 2 15 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r252805 r252813 247 247 46E816F81E79E29C00375ADC /* RestoreStateAfterTermination.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46E816F71E79E29100375ADC /* RestoreStateAfterTermination.mm */; }; 248 248 46EBD8472372320F00223A6E /* RestoreScrollPosition.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46EBD846237231E600223A6E /* RestoreScrollPosition.mm */; }; 249 46FA2FEE23846CA5000CCB0C /* HTTPHeaderMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46FA2FED23846C9A000CCB0C /* HTTPHeaderMap.cpp */; }; 249 250 4909EE3A2D09480C88982D56 /* Markable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC79F168BE454E579E417B05 /* Markable.cpp */; }; 250 251 4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */; }; … … 1779 1780 46E816F71E79E29100375ADC /* RestoreStateAfterTermination.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RestoreStateAfterTermination.mm; sourceTree = "<group>"; }; 1780 1781 46EBD846237231E600223A6E /* RestoreScrollPosition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RestoreScrollPosition.mm; sourceTree = "<group>"; }; 1782 46FA2FED23846C9A000CCB0C /* HTTPHeaderMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPHeaderMap.cpp; sourceTree = "<group>"; }; 1781 1783 4A410F4B19AF7BD6002EBAB5 /* UserMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMedia.cpp; sourceTree = "<group>"; }; 1782 1784 4A410F4D19AF7BEF002EBAB5 /* getUserMedia.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = getUserMedia.html; sourceTree = "<group>"; }; … … 3104 3106 83B88A331C80056D00BB2418 /* HTMLParserIdioms.cpp */, 3105 3107 5CA1DEC71F71F40700E71BD3 /* HTTPHeaderField.cpp */, 3108 46FA2FED23846C9A000CCB0C /* HTTPHeaderMap.cpp */, 3106 3109 6B9ABE112086952F00D75DE6 /* HTTPParsers.cpp */, 3107 3110 7A909A731D877475007E10F8 /* IntPoint.cpp */, … … 4668 4671 7C83E0501D0A641800FEBCF3 /* HTMLParserIdioms.cpp in Sources */, 4669 4672 5CA1DEC81F71F70100E71BD3 /* HTTPHeaderField.cpp in Sources */, 4673 46FA2FEE23846CA5000CCB0C /* HTTPHeaderMap.cpp in Sources */, 4670 4674 6B9ABE122086952F00D75DE6 /* HTTPParsers.cpp in Sources */, 4671 4675 5C7C24FC237C975400599C91 /* HTTPServer.mm in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.