Chromium Code Reviews| Index: net/http/http_stream_parser.cc |
| diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc |
| index 59b15e03aabfb3712c91170decd1e62dd1620b53..a265fa20da9e3a6edc45476d524e8d276e0166ec 100644 |
| --- a/net/http/http_stream_parser.cc |
| +++ b/net/http/http_stream_parser.cc |
| @@ -968,13 +968,17 @@ int HttpStreamParser::ParseResponseHeaders(int end_offset) { |
| // If the port is not the default for the scheme, assume it's not a real |
| // HTTP/0.9 response, and fail the request. |
| - // TODO(crbug.com/624462): Further restrict the cases in which we allow |
| - // HTTP/0.9. |
| - std::string scheme(request_->url.scheme()); |
| + base::StringPiece scheme(request_->url.scheme_piece()); |
|
eroman
2017/01/24 00:37:29
[optional] style-nit: use assignment
mmenke
2017/01/24 17:27:02
Done. I find I tend to default to this style beca
|
| if (!http_09_on_non_default_ports_enabled_ && |
| - url::DefaultPortForScheme(scheme.c_str(), scheme.length()) != |
| + url::DefaultPortForScheme(scheme.data(), scheme.length()) != |
| request_->url.EffectiveIntPort()) { |
| - return ERR_INVALID_HTTP_RESPONSE; |
| + // Allow Shoutcast responses over HTTP through, as it's somewhat common |
|
eroman
2017/01/24 00:37:29
nit: delete "through" as it feels redundant with "
mmenke
2017/01/24 17:27:02
Done.
|
| + // and relies on HTTP/0.9 on weird ports to work. |
|
eroman
2017/01/24 00:37:29
Can you add a link to an explanation of what the i
mmenke
2017/01/24 17:27:02
Done, link to the intent to implement (Bug has way
|
| + if (read_buf_->offset() < 3 || scheme != "http" || |
| + !base::LowerCaseEqualsASCII( |
| + base::StringPiece(read_buf_->StartOfBuffer(), 3), "icy")) { |
| + return ERR_INVALID_HTTP_RESPONSE; |
| + } |
| } |
| headers = new HttpResponseHeaders(std::string("HTTP/0.9 200 OK")); |