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

Unified Diff: net/tools/quic/quic_in_memory_cache.h

Issue 1777083002: Make QuicSimpleServerStream supports multipart response body (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@quicsmaller
Patch Set: Rebased Created 4 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/quic_in_memory_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/quic_in_memory_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698