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

Side by Side Diff: net/tools/quic/quic_in_memory_cache.cc

Issue 113413003: Fix uninitialized access in QuicInMemoryCache::GetKey (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "net/tools/quic/quic_in_memory_cache.h" 5 #include "net/tools/quic/quic_in_memory_cache.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_enumerator.h" 8 #include "base/files/file_enumerator.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 file = file_list.Next(); 207 file = file_list.Next();
208 } 208 }
209 } 209 }
210 210
211 QuicInMemoryCache::~QuicInMemoryCache() { 211 QuicInMemoryCache::~QuicInMemoryCache() {
212 STLDeleteValues(&responses_); 212 STLDeleteValues(&responses_);
213 } 213 }
214 214
215 string QuicInMemoryCache::GetKey(const BalsaHeaders& request_headers) const { 215 string QuicInMemoryCache::GetKey(const BalsaHeaders& request_headers) const {
216 StringPiece uri = request_headers.request_uri(); 216 StringPiece uri = request_headers.request_uri();
217 if (uri.size() == 0) {
218 return "";
219 }
217 StringPiece host; 220 StringPiece host;
218 if (uri[0] == '/') { 221 if (uri[0] == '/') {
219 host = request_headers.GetHeader("host"); 222 host = request_headers.GetHeader("host");
220 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "https://")) { 223 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "https://")) {
221 uri.remove_prefix(8); 224 uri.remove_prefix(8);
222 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "http://")) { 225 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "http://")) {
223 uri.remove_prefix(7); 226 uri.remove_prefix(7);
224 } 227 }
225 return host.as_string() + uri.as_string(); 228 return host.as_string() + uri.as_string();
226 } 229 }
227 230
228 } // namespace tools 231 } // namespace tools
229 } // namespace net 232 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698