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

Side by Side Diff: third_party/WebKit/Source/core/fetch/MultipartImageResourceParser.h

Issue 1808353003: Make multipart/x-mixed-replace parser more robust (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@multipart-3
Patch Set: Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /* ***** BEGIN LICENSE BLOCK ***** 5 /* ***** BEGIN LICENSE BLOCK *****
6 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 6 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7 * 7 *
8 * The contents of this file are subject to the Mozilla Public License Version 8 * The contents of this file are subject to the Mozilla Public License Version
9 * 1.1 (the "License"); you may not use this file except in compliance with 9 * 1.1 (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at 10 * the License. You may obtain a copy of the License at
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 DEFINE_INLINE_VIRTUAL_TRACE() {} 60 DEFINE_INLINE_VIRTUAL_TRACE() {}
61 }; 61 };
62 62
63 MultipartImageResourceParser(const ResourceResponse&, const Vector<char>& bo undary, Client*); 63 MultipartImageResourceParser(const ResourceResponse&, const Vector<char>& bo undary, Client*);
64 void appendData(const char* bytes, size_t); 64 void appendData(const char* bytes, size_t);
65 void finish(); 65 void finish();
66 void cancel() { m_isCancelled = true; } 66 void cancel() { m_isCancelled = true; }
67 67
68 DECLARE_TRACE(); 68 DECLARE_TRACE();
69 69
70 static size_t pushOverLineForTest(const Vector<char>& data, size_t size) { r eturn pushOverLine(data, size); } 70 static size_t skippableLengthForTest(const Vector<char>& data, size_t size) { return skippableLength(data, size); }
71 static size_t findBoundaryForTest(const Vector<char>& data, Vector<char>* bo undary) { return findBoundary(data, boundary); } 71 static size_t findBoundaryForTest(const Vector<char>& data, Vector<char>* bo undary) { return findBoundary(data, boundary); }
72 72
73 private: 73 private:
74 bool parseHeaders(); 74 bool parseHeaders();
75 bool isCancelled() const { return m_isCancelled; } 75 bool isCancelled() const { return m_isCancelled; }
76 static size_t pushOverLine(const Vector<char>&, size_t); 76 static size_t skippableLength(const Vector<char>&, size_t);
77 // This function updates |*boundary|. 77 // This function updates |*boundary|.
78 static size_t findBoundary(const Vector<char>& data, Vector<char>* boundary) ; 78 static size_t findBoundary(const Vector<char>& data, Vector<char>* boundary) ;
79 79
80 const ResourceResponse m_originalResponse; 80 const ResourceResponse m_originalResponse;
81 Vector<char> m_boundary; 81 Vector<char> m_boundary;
82 RawPtrWillBeMember<Client> m_client; 82 RawPtrWillBeMember<Client> m_client;
83 83
84 Vector<char> m_data; 84 Vector<char> m_data;
85 bool m_isParsingTop = true; 85 bool m_isParsingTop = true;
86 bool m_isParsingHeaders = false; 86 bool m_isParsingHeaders = false;
87 bool m_sawLastBoundary = false; 87 bool m_sawLastBoundary = false;
88 bool m_isCancelled = false; 88 bool m_isCancelled = false;
89 }; 89 };
90 90
91 } // namespace blink 91 } // namespace blink
92 92
93 #endif // MultipartImageResourceParser_h 93 #endif // MultipartImageResourceParser_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698