| 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/files/file_enumerator.h" |    7 #include "base/files/file_enumerator.h" | 
|    8 #include "base/files/file_util.h" |    8 #include "base/files/file_util.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 11 matching lines...) Expand all  Loading... | 
|   22 namespace tools { |   22 namespace tools { | 
|   23  |   23  | 
|   24 std::string FLAGS_quic_in_memory_cache_dir = ""; |   24 std::string FLAGS_quic_in_memory_cache_dir = ""; | 
|   25  |   25  | 
|   26 namespace { |   26 namespace { | 
|   27  |   27  | 
|   28 // BalsaVisitor implementation (glue) which caches response bodies. |   28 // BalsaVisitor implementation (glue) which caches response bodies. | 
|   29 class CachingBalsaVisitor : public NoOpBalsaVisitor { |   29 class CachingBalsaVisitor : public NoOpBalsaVisitor { | 
|   30  public: |   30  public: | 
|   31   CachingBalsaVisitor() : done_framing_(false) {} |   31   CachingBalsaVisitor() : done_framing_(false) {} | 
|   32   virtual void ProcessBodyData(const char* input, size_t size) OVERRIDE { |   32   virtual void ProcessBodyData(const char* input, size_t size) override { | 
|   33     AppendToBody(input, size); |   33     AppendToBody(input, size); | 
|   34   } |   34   } | 
|   35   virtual void MessageDone() OVERRIDE { |   35   virtual void MessageDone() override { | 
|   36     done_framing_ = true; |   36     done_framing_ = true; | 
|   37   } |   37   } | 
|   38   virtual void HandleHeaderError(BalsaFrame* framer) OVERRIDE { |   38   virtual void HandleHeaderError(BalsaFrame* framer) override { | 
|   39     UnhandledError(); |   39     UnhandledError(); | 
|   40   } |   40   } | 
|   41   virtual void HandleHeaderWarning(BalsaFrame* framer) OVERRIDE { |   41   virtual void HandleHeaderWarning(BalsaFrame* framer) override { | 
|   42     UnhandledError(); |   42     UnhandledError(); | 
|   43   } |   43   } | 
|   44   virtual void HandleChunkingError(BalsaFrame* framer) OVERRIDE { |   44   virtual void HandleChunkingError(BalsaFrame* framer) override { | 
|   45     UnhandledError(); |   45     UnhandledError(); | 
|   46   } |   46   } | 
|   47   virtual void HandleBodyError(BalsaFrame* framer) OVERRIDE { |   47   virtual void HandleBodyError(BalsaFrame* framer) override { | 
|   48     UnhandledError(); |   48     UnhandledError(); | 
|   49   } |   49   } | 
|   50   void UnhandledError() { |   50   void UnhandledError() { | 
|   51     LOG(DFATAL) << "Unhandled error framing HTTP."; |   51     LOG(DFATAL) << "Unhandled error framing HTTP."; | 
|   52   } |   52   } | 
|   53   void AppendToBody(const char* input, size_t size) { |   53   void AppendToBody(const char* input, size_t size) { | 
|   54     body_.append(input, size); |   54     body_.append(input, size); | 
|   55   } |   55   } | 
|   56   bool done_framing() const { return done_framing_; } |   56   bool done_framing() const { return done_framing_; } | 
|   57   const string& body() const { return body_; } |   57   const string& body() const { return body_; } | 
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  233   } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "https://")) { |  233   } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "https://")) { | 
|  234     uri.remove_prefix(8); |  234     uri.remove_prefix(8); | 
|  235   } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "http://")) { |  235   } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "http://")) { | 
|  236     uri.remove_prefix(7); |  236     uri.remove_prefix(7); | 
|  237   } |  237   } | 
|  238   return host.as_string() + uri.as_string(); |  238   return host.as_string() + uri.as_string(); | 
|  239 } |  239 } | 
|  240  |  240  | 
|  241 }  // namespace tools |  241 }  // namespace tools | 
|  242 }  // namespace net |  242 }  // namespace net | 
| OLD | NEW |