OLD | NEW |
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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 } | 993 } |
994 | 994 |
995 // Check for multiple Content-Disposition or Location headers. If they exist, | 995 // Check for multiple Content-Disposition or Location headers. If they exist, |
996 // it's also a potential response smuggling attack. | 996 // it's also a potential response smuggling attack. |
997 if (HeadersContainMultipleCopiesOfField(*headers, "Content-Disposition")) | 997 if (HeadersContainMultipleCopiesOfField(*headers, "Content-Disposition")) |
998 return ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION; | 998 return ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION; |
999 if (HeadersContainMultipleCopiesOfField(*headers, "Location")) | 999 if (HeadersContainMultipleCopiesOfField(*headers, "Location")) |
1000 return ERR_RESPONSE_HEADERS_MULTIPLE_LOCATION; | 1000 return ERR_RESPONSE_HEADERS_MULTIPLE_LOCATION; |
1001 | 1001 |
1002 response_->headers = headers; | 1002 response_->headers = headers; |
1003 response_->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP1; | 1003 if (headers->GetHttpVersion() == HttpVersion(0, 9)) { |
| 1004 response_->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP0_9; |
| 1005 } else if (headers->GetHttpVersion() == HttpVersion(1, 0)) { |
| 1006 response_->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP1_0; |
| 1007 } else if (headers->GetHttpVersion() == HttpVersion(1, 1)) { |
| 1008 response_->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP1_1; |
| 1009 } |
1004 response_->vary_data.Init(*request_, *response_->headers); | 1010 response_->vary_data.Init(*request_, *response_->headers); |
1005 DVLOG(1) << __FUNCTION__ << "()" | 1011 DVLOG(1) << __FUNCTION__ << "()" |
1006 << " content_length = \"" << response_->headers->GetContentLength() | 1012 << " content_length = \"" << response_->headers->GetContentLength() |
1007 << "\n\"" | 1013 << "\n\"" |
1008 << " headers = \"" << GetResponseHeaderLines(*response_->headers) | 1014 << " headers = \"" << GetResponseHeaderLines(*response_->headers) |
1009 << "\""; | 1015 << "\""; |
1010 return OK; | 1016 return OK; |
1011 } | 1017 } |
1012 | 1018 |
1013 void HttpStreamParser::CalculateResponseBodySize() { | 1019 void HttpStreamParser::CalculateResponseBodySize() { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 } | 1188 } |
1183 | 1189 |
1184 void HttpStreamParser::ValidateStatusLine(const std::string& status_line) { | 1190 void HttpStreamParser::ValidateStatusLine(const std::string& status_line) { |
1185 HttpStatusLineValidator::StatusLineStatus status = | 1191 HttpStatusLineValidator::StatusLineStatus status = |
1186 HttpStatusLineValidator::ValidateStatusLine(status_line); | 1192 HttpStatusLineValidator::ValidateStatusLine(status_line); |
1187 UMA_HISTOGRAM_ENUMERATION("Net.HttpStatusLineStatus", status, | 1193 UMA_HISTOGRAM_ENUMERATION("Net.HttpStatusLineStatus", status, |
1188 HttpStatusLineValidator::STATUS_LINE_MAX); | 1194 HttpStatusLineValidator::STATUS_LINE_MAX); |
1189 } | 1195 } |
1190 | 1196 |
1191 } // namespace net | 1197 } // namespace net |
OLD | NEW |