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

Unified Diff: net/tools/quic/quic_simple_server_stream.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/quic_in_memory_cache.cc ('k') | net/tools/quic/quic_simple_server_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_simple_server_stream.h
diff --git a/net/tools/quic/quic_simple_server_stream.h b/net/tools/quic/quic_simple_server_stream.h
index 90cb0dcf31f975317284d0d00c3c4421257e50b7..a0edbd9f093abb2558c65b61e1c696f8d295c3b8 100644
--- a/net/tools/quic/quic_simple_server_stream.h
+++ b/net/tools/quic/quic_simple_server_stream.h
@@ -13,6 +13,7 @@
#include "net/quic/quic_protocol.h"
#include "net/quic/quic_spdy_stream.h"
#include "net/spdy/spdy_framer.h"
+#include "net/tools/quic/quic_in_memory_cache.h"
namespace net {
@@ -46,9 +47,13 @@ class QuicSimpleServerStream : public QuicSpdyStream {
static const char* const kNotFoundResponseBody;
protected:
- // Sends a basic 200 response using SendHeaders for the headers and WriteData
- // for the body.
- virtual void SendResponse();
+ enum State {
+ INIT,
+ SEND_HEADERS,
+ SEND_BODY,
+ SEND_TRAILERS,
+ NONE,
+ };
// Sends a basic 500 response using SendHeaders for the headers and WriteData
// for the body.
@@ -58,17 +63,22 @@ class QuicSimpleServerStream : public QuicSpdyStream {
// for the body.
void SendNotFoundResponse();
- void SendHeadersAndBody(const SpdyHeaderBlock& response_headers,
- base::StringPiece body);
- void SendHeadersAndBodyAndTrailers(const SpdyHeaderBlock& response_headers,
- base::StringPiece body,
- const SpdyHeaderBlock& response_trailers);
+ // Starts or resumes the response as indicated |next_state_|.
+ void DoLoop();
SpdyHeaderBlock* request_headers() { return &request_headers_; }
const std::string& body() { return body_; }
+ State next_state_;
+ QuicInMemoryCache::Response response_;
+
private:
+ void Init();
+ void SendHeaders();
+ void SendBody();
+ void SendTrailers();
+
friend class test::QuicSimpleServerStreamPeer;
// The parsed headers received from the client.
@@ -76,6 +86,10 @@ class QuicSimpleServerStream : public QuicSpdyStream {
int content_length_;
std::string body_;
+ // How many body chunks have been sent. Only relevant to
+ // QuicInMemoryCache::BIDIRECTIONAL.
+ size_t body_chunks_consumed_;
+
DISALLOW_COPY_AND_ASSIGN(QuicSimpleServerStream);
};
« no previous file with comments | « net/tools/quic/quic_in_memory_cache.cc ('k') | net/tools/quic/quic_simple_server_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698