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

Unified Diff: net/http/http_stream_parser.cc

Issue 1276943003: Re-disable support for HTTP/0.9 responses < 8 bytes over SSL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 62516db5fb665e8c967327acda4268dfbd14c233..bcc23db5278d03388ece24ee3eb7c7c15c3ba423 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -783,18 +783,24 @@ int HttpStreamParser::HandleReadHeaderResult(int result) {
return result;
}
+ // Accepting truncated headers over HTTPS is a potential security
+ // vulnerability, so just return an error in that case. Accepting a < 8
davidben 2015/08/06 19:01:46 Maybe new paragraph after "in that case." and "Ac
mmenke 2015/08/06 19:12:44 Done.
+ // byte response over HTTPS would allow a MITM to truncate an HTTP response
davidben 2015/08/06 19:01:46 (Strictly speaking, this is only possible if the p
davidben 2015/08/06 19:01:46 Maybe HTTP response -> HTTP/1.x status line
mmenke 2015/08/06 19:12:44 Done.
mmenke 2015/08/06 19:12:44 Done.
+ // to look like a short HTTP/0.9 responses. Out of paranoia, defend against
davidben 2015/08/06 19:01:46 Maybe "Out of paranoia" -> "To ensure that all res
davidben 2015/08/06 19:01:46 responses -> response
mmenke 2015/08/06 19:12:44 Done. Though I still say concern about the bogus
mmenke 2015/08/06 19:12:44 Done.
+ // that case here as well.
+ // TODO(mmenke): Returning ERR_RESPONSE_HEADERS_TRUNCATED when a response
+ // looks like an HTTP/0.9 response is weird. Should either come up with
+ // another error code, or, better, disable HTTP/0.9 over HTTPS (and give
+ // that a new error code).
+ if (request_->url.SchemeIsCryptographic()) {
+ io_state_ = STATE_DONE;
+ return ERR_RESPONSE_HEADERS_TRUNCATED;
+ }
+
// Parse things as well as we can and let the caller decide what to do.
int end_offset;
if (response_header_start_offset_ >= 0) {
// The response looks to be a truncated set of HTTP headers.
-
- // Accepting truncated headers over HTTPS is a potential security
- // vulnerability, so just return an error in that case.
- if (request_->url.SchemeIsCryptographic()) {
- io_state_ = STATE_DONE;
- return ERR_RESPONSE_HEADERS_TRUNCATED;
- }
-
io_state_ = STATE_READ_BODY_COMPLETE;
end_offset = read_buf_->offset();
RecordHeaderParserEvent(HEADER_ALLOWED_TRUNCATED_HEADERS);
« 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