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

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

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/quic_in_memory_cache.h ('k') | net/tools/quic/quic_simple_server_stream.h » ('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.cc
diff --git a/net/tools/quic/quic_in_memory_cache.cc b/net/tools/quic/quic_in_memory_cache.cc
index 1f31b9cfe1362dc6a14a4e673ea4fbf68d90e6ec..f3fc367efe717b821b9cc78357284d46e8b82dba 100644
--- a/net/tools/quic/quic_in_memory_cache.cc
+++ b/net/tools/quic/quic_in_memory_cache.cc
@@ -72,6 +72,18 @@ void QuicInMemoryCache::AddSimpleResponse(StringPiece host,
AddResponse(host, path, response_headers, body);
}
+void QuicInMemoryCache::AddBidirectionalResponse(
+ StringPiece host,
+ StringPiece path,
+ int response_code,
+ const std::vector<std::string>& body_chunks,
+ const SpdyHeaderBlock& response_trailers) {
+ SpdyHeaderBlock response_headers;
+ response_headers[":status"] = IntToString(response_code);
+ AddResponseImpl(host, path, BIDIRECTIONAL, response_headers, "", body_chunks,
+ response_trailers);
+}
+
void QuicInMemoryCache::AddSimpleResponseWithServerPushResources(
StringPiece host,
StringPiece path,
@@ -207,6 +219,18 @@ void QuicInMemoryCache::AddResponseImpl(
const SpdyHeaderBlock& response_headers,
StringPiece response_body,
const SpdyHeaderBlock& response_trailers) {
+ std::vector<std::string> body_chunks;
+ AddResponseImpl(host, path, response_type, response_headers, response_body,
+ body_chunks, response_trailers);
+}
+void QuicInMemoryCache::AddResponseImpl(
+ StringPiece host,
+ StringPiece path,
+ SpecialResponseType response_type,
+ const SpdyHeaderBlock& response_headers,
+ StringPiece response_body,
+ const std::vector<std::string>& body_chunks,
+ const SpdyHeaderBlock& response_trailers) {
DCHECK(!host.empty()) << "Host must be populated, e.g. \"www.google.com\"";
string key = GetKey(host, path);
if (ContainsKey(responses_, key)) {
@@ -216,7 +240,12 @@ void QuicInMemoryCache::AddResponseImpl(
Response* new_response = new Response();
new_response->set_response_type(response_type);
new_response->set_headers(response_headers);
- new_response->set_body(response_body);
+ if (response_type != BIDIRECTIONAL) {
+ CHECK(body_chunks.empty());
+ new_response->set_body(response_body);
+ } else {
+ new_response->SetBodyChunks(body_chunks);
+ }
new_response->set_trailers(response_trailers);
responses_[key] = new_response;
}
« no previous file with comments | « net/tools/quic/quic_in_memory_cache.h ('k') | net/tools/quic/quic_simple_server_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698