Index: net/tools/quic/quic_in_memory_cache.h |
diff --git a/net/tools/quic/quic_in_memory_cache.h b/net/tools/quic/quic_in_memory_cache.h |
index 0cedc1e0f9af87cef694fa1d3cae746b6861dd6a..ea3384d3f6ea03486f942af0aa7140658ccc0537 100644 |
--- a/net/tools/quic/quic_in_memory_cache.h |
+++ b/net/tools/quic/quic_in_memory_cache.h |
@@ -8,6 +8,7 @@ |
#include <map> |
#include <string> |
#include <unordered_map> |
+#include <vector> |
#include "base/containers/hash_tables.h" |
#include "base/macros.h" |
@@ -59,6 +60,7 @@ class QuicInMemoryCache { |
REGULAR_RESPONSE, // Send the headers and body like a server should. |
CLOSE_CONNECTION, // Close the connection (sending the close packet). |
IGNORE_REQUEST, // Do nothing, expect the client to time out. |
+ BIDIRECTIONAL, // Send headers, multiple chuncks of body and trailers. |
}; |
// Container for response header/body pairs. |
@@ -71,6 +73,7 @@ class QuicInMemoryCache { |
const SpdyHeaderBlock& headers() const { return headers_; } |
const SpdyHeaderBlock& trailers() const { return trailers_; } |
const base::StringPiece body() const { return base::StringPiece(body_); } |
+ const std::vector<std::string>& body_chunks() const { return body_chunks_; } |
void set_response_type(SpecialResponseType response_type) { |
response_type_ = response_type; |
@@ -78,12 +81,18 @@ class QuicInMemoryCache { |
void set_headers(const SpdyHeaderBlock& headers) { headers_ = headers; } |
void set_trailers(const SpdyHeaderBlock& trailers) { trailers_ = trailers; } |
void set_body(base::StringPiece body) { body.CopyToString(&body_); } |
+ void SetBodyChunks(std::vector<std::string> body_chunks) { |
+ for (auto i : body_chunks) { |
+ body_chunks_.push_back(i); |
+ } |
+ } |
private: |
SpecialResponseType response_type_; |
SpdyHeaderBlock headers_; |
SpdyHeaderBlock trailers_; |
std::string body_; |
+ std::vector<std::string> body_chunks_; |
DISALLOW_COPY_AND_ASSIGN(Response); |
}; |
@@ -103,6 +112,12 @@ class QuicInMemoryCache { |
int response_code, |
base::StringPiece body); |
+ void AddBidirectionalResponse(StringPiece host, |
+ StringPiece path, |
+ int response_code, |
+ const std::vector<std::string>& body_chunks, |
+ const SpdyHeaderBlock& response_trailers); |
+ |
// Add a simple response to the cache as AddSimpleResponse() does, and add |
// some server push resources(resource path, corresponding response status and |
// path) associated with it. |
@@ -160,6 +175,14 @@ class QuicInMemoryCache { |
base::StringPiece response_body, |
const SpdyHeaderBlock& response_trailers); |
+ void AddResponseImpl(base::StringPiece host, |
+ base::StringPiece path, |
+ SpecialResponseType response_type, |
+ const SpdyHeaderBlock& response_headers, |
+ base::StringPiece response_body, |
+ const std::vector<std::string>& body_chunks, |
+ const SpdyHeaderBlock& response_trailers); |
+ |
string GetKey(base::StringPiece host, base::StringPiece path) const; |
// Add some server push urls with given responses for specified |