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

Unified Diff: net/spdy/spdy_http_stream.cc

Issue 2526003002: Disallow multiple HEADERS frames on pushed streams. (Closed)
Patch Set: Rename enum, enum entry, and member. Created 4 years, 1 month 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/spdy/spdy_http_stream.h ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_http_stream.cc
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc
index 1d739b22504083ec9395b5c0b0b4503798da0ff1..36e02a26c99ec531844cfbff5c8a854f551809ca 100644
--- a/net/spdy/spdy_http_stream.cc
+++ b/net/spdy/spdy_http_stream.cc
@@ -42,7 +42,7 @@ SpdyHttpStream::SpdyHttpStream(const base::WeakPtr<SpdySession>& spdy_session,
closed_stream_sent_bytes_(0),
request_info_(NULL),
response_info_(NULL),
- response_headers_status_(RESPONSE_HEADERS_ARE_INCOMPLETE),
+ response_headers_complete_(false),
user_buffer_len_(0),
request_body_buf_size_(0),
buffered_read_callback_pending_(false),
@@ -105,7 +105,7 @@ int SpdyHttpStream::ReadResponseHeaders(const CompletionCallback& callback) {
CHECK(stream_.get());
// Check if we already have the response headers. If so, return synchronously.
- if (response_headers_status_ == RESPONSE_HEADERS_ARE_COMPLETE) {
+ if (response_headers_complete_) {
CHECK(!stream_->IsIdle());
return OK;
}
@@ -301,7 +301,7 @@ void SpdyHttpStream::Cancel() {
}
}
-void SpdyHttpStream::OnRequestHeadersSent() {
+void SpdyHttpStream::OnHeadersSent() {
if (HasUploadData()) {
ReadAndSendRequestBodyData();
} else {
@@ -309,9 +309,10 @@ void SpdyHttpStream::OnRequestHeadersSent() {
}
}
-SpdyResponseHeadersStatus SpdyHttpStream::OnResponseHeadersUpdated(
+void SpdyHttpStream::OnHeadersReceived(
const SpdyHeaderBlock& response_headers) {
- CHECK_EQ(response_headers_status_, RESPONSE_HEADERS_ARE_INCOMPLETE);
+ DCHECK(!response_headers_complete_);
+ response_headers_complete_ = true;
if (!response_info_) {
DCHECK_EQ(stream_->type(), SPDY_PUSH_STREAM);
@@ -319,13 +320,11 @@ SpdyResponseHeadersStatus SpdyHttpStream::OnResponseHeadersUpdated(
response_info_ = push_response_info_.get();
}
- if (!SpdyHeadersToHttpResponse(response_headers, response_info_)) {
- // We do not have complete headers yet.
- return RESPONSE_HEADERS_ARE_INCOMPLETE;
- }
+ const bool headers_valid =
+ SpdyHeadersToHttpResponse(response_headers, response_info_);
+ DCHECK(headers_valid);
response_info_->response_time = stream_->response_time();
- response_headers_status_ = RESPONSE_HEADERS_ARE_COMPLETE;
// Don't store the SSLInfo in the response here, HttpNetworkTransaction
// will take care of that part.
response_info_->was_alpn_negotiated = was_alpn_negotiated_;
@@ -339,12 +338,10 @@ SpdyResponseHeadersStatus SpdyHttpStream::OnResponseHeadersUpdated(
if (!response_callback_.is_null()) {
DoResponseCallback(OK);
}
-
- return RESPONSE_HEADERS_ARE_COMPLETE;
}
void SpdyHttpStream::OnDataReceived(std::unique_ptr<SpdyBuffer> buffer) {
- CHECK_EQ(response_headers_status_, RESPONSE_HEADERS_ARE_COMPLETE);
+ DCHECK(response_headers_complete_);
// Note that data may be received for a SpdyStream prior to the user calling
// ReadResponseBody(), therefore user_buffer_ may be NULL. This may often
« no previous file with comments | « net/spdy/spdy_http_stream.h ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698