| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |