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

Unified Diff: net/http/http_stream_parser.cc

Issue 1169603002: Update references to RFC2616. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Describe the 205 case. Created 5 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_parser.cc
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index 46a1702674c43a4905e43e3af4896bd8de95fef8..684ea860d34ec62a8ad95d9e81228eb667ccd091 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -963,16 +963,33 @@ void HttpStreamParser::CalculateResponseBodySize() {
// Figure how to determine EOF:
// For certain responses, we know the content length is always 0. From
- // RFC 2616 Section 4.3 Message Body:
+ // RFC 7230 Section 3.3 Message Body:
//
- // For response messages, whether or not a message-body is included with
- // a message is dependent on both the request method and the response
- // status code (section 6.1.1). All responses to the HEAD request method
- // MUST NOT include a message-body, even though the presence of entity-
- // header fields might lead one to believe they do. All 1xx
- // (informational), 204 (no content), and 304 (not modified) responses
- // MUST NOT include a message-body. All other responses do include a
- // message-body, although it MAY be of zero length.
+ // The presence of a message body in a response depends on both the
+ // request method to which it is responding and the response status code
+ // (Section 3.1.2). Responses to the HEAD request method (Section 4.3.2
+ // of [RFC7231]) never include a message body because the associated
+ // response header fields (e.g., Transfer-Encoding, Content-Length,
+ // etc.), if present, indicate only what their values would have been if
+ // the request method had been GET (Section 4.3.1 of [RFC7231]). 2xx
+ // (Successful) responses to a CONNECT request method (Section 4.3.6 of
+ // [RFC7231]) switch to tunnel mode instead of having a message body.
wtc 2015/06/05 01:51:05 I studied the relevant code. It seems useful to se
Bence 2015/06/05 11:28:33 I think this will naturally come up if someone wan
+ // All 1xx (Informational), 204 (No Content), and 304 (Not Modified)
+ // responses do not include a message body. All other responses do
+ // include a message body, although the body might be of zero length.
+ //
+ // From RFC 7231 Section 6.3.6 205 Reset Content:
+ //
+ // Since the 205 status code implies that no additional content will be
+ // provided, a server MUST NOT generate a payload in a 205 response. In
+ // other words, a server MUST do one of the following for a 205
wtc 2015/06/05 01:51:04 Chris: do you think we need to quote the entire pa
Bence 2015/06/05 11:28:33 I think the first sentence is enough. Even better
cbentzel 2015/06/05 14:07:30 Agree that first sentence is enough. Thanks for fi
wtc 2015/06/05 17:28:50 Done.
+ // response: a) indicate a zero-length body for the response by
+ // including a Content-Length header field with a value of 0; b)
+ // indicate a zero-length payload for the response by including a
+ // Transfer-Encoding header field with a value of chunked and a message
+ // body consisting of a single chunk of zero-length; or, c) close the
+ // connection immediately after sending the blank line terminating the
+ // header section.
if (response_->headers->response_code() / 100 == 1) {
response_body_length_ = 0;
} else {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698