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

Side by Side 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: Shorten the quoted RFC text for the 205 status code. 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_stream_parser.h" 5 #include "net/http/http_stream_parser.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 << "\n\"" 956 << "\n\""
957 << " headers = \"" 957 << " headers = \""
958 << GetResponseHeaderLines(*response_->headers.get()) << "\""; 958 << GetResponseHeaderLines(*response_->headers.get()) << "\"";
959 return OK; 959 return OK;
960 } 960 }
961 961
962 void HttpStreamParser::CalculateResponseBodySize() { 962 void HttpStreamParser::CalculateResponseBodySize() {
963 // Figure how to determine EOF: 963 // Figure how to determine EOF:
964 964
965 // For certain responses, we know the content length is always 0. From 965 // For certain responses, we know the content length is always 0. From
966 // RFC 2616 Section 4.3 Message Body: 966 // RFC 7230 Section 3.3 Message Body:
967 // 967 //
968 // For response messages, whether or not a message-body is included with 968 // The presence of a message body in a response depends on both the
969 // a message is dependent on both the request method and the response 969 // request method to which it is responding and the response status code
970 // status code (section 6.1.1). All responses to the HEAD request method 970 // (Section 3.1.2). Responses to the HEAD request method (Section 4.3.2
971 // MUST NOT include a message-body, even though the presence of entity- 971 // of [RFC7231]) never include a message body because the associated
972 // header fields might lead one to believe they do. All 1xx 972 // response header fields (e.g., Transfer-Encoding, Content-Length,
973 // (informational), 204 (no content), and 304 (not modified) responses 973 // etc.), if present, indicate only what their values would have been if
974 // MUST NOT include a message-body. All other responses do include a 974 // the request method had been GET (Section 4.3.1 of [RFC7231]). 2xx
975 // message-body, although it MAY be of zero length. 975 // (Successful) responses to a CONNECT request method (Section 4.3.6 of
976 // [RFC7231]) switch to tunnel mode instead of having a message body.
977 // All 1xx (Informational), 204 (No Content), and 304 (Not Modified)
978 // responses do not include a message body. All other responses do
979 // include a message body, although the body might be of zero length.
980 //
981 // From RFC 7231 Section 6.3.6 205 Reset Content:
982 //
983 // Since the 205 status code implies that no additional content will be
984 // provided, a server MUST NOT generate a payload in a 205 response.
976 if (response_->headers->response_code() / 100 == 1) { 985 if (response_->headers->response_code() / 100 == 1) {
977 response_body_length_ = 0; 986 response_body_length_ = 0;
978 } else { 987 } else {
979 switch (response_->headers->response_code()) { 988 switch (response_->headers->response_code()) {
980 case 204: // No Content 989 case 204: // No Content
981 case 205: // Reset Content 990 case 205: // Reset Content
982 case 304: // Not Modified 991 case 304: // Not Modified
983 response_body_length_ = 0; 992 response_body_length_ = 0;
984 break; 993 break;
985 } 994 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 request_body->IsInMemory() && 1097 request_body->IsInMemory() &&
1089 request_body->size() > 0) { 1098 request_body->size() > 0) {
1090 uint64 merged_size = request_headers.size() + request_body->size(); 1099 uint64 merged_size = request_headers.size() + request_body->size();
1091 if (merged_size <= kMaxMergedHeaderAndBodySize) 1100 if (merged_size <= kMaxMergedHeaderAndBodySize)
1092 return true; 1101 return true;
1093 } 1102 }
1094 return false; 1103 return false;
1095 } 1104 }
1096 1105
1097 } // namespace net 1106 } // namespace net
OLDNEW
« 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