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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 BalsaFrame framer; | 163 BalsaFrame framer; |
164 framer.set_balsa_headers(&response_headers); | 164 framer.set_balsa_headers(&response_headers); |
165 framer.set_balsa_visitor(&caching_visitor); | 165 framer.set_balsa_visitor(&caching_visitor); |
166 size_t processed = 0; | 166 size_t processed = 0; |
167 while (processed < file_contents.length() && | 167 while (processed < file_contents.length() && |
168 !caching_visitor.done_framing()) { | 168 !caching_visitor.done_framing()) { |
169 processed += framer.ProcessInput(file_contents.c_str() + processed, | 169 processed += framer.ProcessInput(file_contents.c_str() + processed, |
170 file_contents.length() - processed); | 170 file_contents.length() - processed); |
171 } | 171 } |
172 | 172 |
173 string response_headers_str; | |
174 response_headers.DumpToString(&response_headers_str); | |
175 if (!caching_visitor.done_framing()) { | 173 if (!caching_visitor.done_framing()) { |
176 LOG(DFATAL) << "Did not frame entire message from file: " << file.value() | 174 LOG(DFATAL) << "Did not frame entire message from file: " << file.value() |
177 << " (" << processed << " of " << file_contents.length() | 175 << " (" << processed << " of " << file_contents.length() |
178 << " bytes)."; | 176 << " bytes)."; |
179 } | 177 } |
180 if (processed < file_contents.length()) { | 178 if (processed < file_contents.length()) { |
181 // Didn't frame whole file. Assume remainder is body. | 179 // Didn't frame whole file. Assume remainder is body. |
182 // This sometimes happens as a result of incompatibilities between | 180 // This sometimes happens as a result of incompatibilities between |
183 // BalsaFramer and wget's serialization of HTTP sans content-length. | 181 // BalsaFramer and wget's serialization of HTTP sans content-length. |
184 caching_visitor.AppendToBody(file_contents.c_str() + processed, | 182 caching_visitor.AppendToBody(file_contents.c_str() + processed, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "https://")) { | 233 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "https://")) { |
236 uri.remove_prefix(8); | 234 uri.remove_prefix(8); |
237 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "http://")) { | 235 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "http://")) { |
238 uri.remove_prefix(7); | 236 uri.remove_prefix(7); |
239 } | 237 } |
240 return host.as_string() + uri.as_string(); | 238 return host.as_string() + uri.as_string(); |
241 } | 239 } |
242 | 240 |
243 } // namespace tools | 241 } // namespace tools |
244 } // namespace net | 242 } // namespace net |
OLD | NEW |