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

Unified Diff: components/cronet/android/url_request_context_adapter.cc

Issue 642913004: Throw IllegalArgumentException from addQuicHint if host is URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add IsCanonicalizedHostCompliant check to Quic Hint parsing. Created 6 years, 2 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 | « components/cronet/android/test/javatests/src/org/chromium/cronet_test_apk/HttpUrlRequestFactoryTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/android/url_request_context_adapter.cc
diff --git a/components/cronet/android/url_request_context_adapter.cc b/components/cronet/android/url_request_context_adapter.cc
index bed6f140c5e423be5c1a9447cb82a7d4e3e74a6b..032a6dfd455aeffbdaf75aacd30c2f8dd1590ed0 100644
--- a/components/cronet/android/url_request_context_adapter.cc
+++ b/components/cronet/android/url_request_context_adapter.cc
@@ -13,6 +13,7 @@
#include "components/cronet/url_request_context_config.h"
#include "net/base/net_errors.h"
#include "net/base/net_log_logger.h"
+#include "net/base/net_util.h"
#include "net/cert/cert_verifier.h"
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_network_layer.h"
@@ -173,6 +174,14 @@ void URLRequestContextAdapter::InitRequestContextOnNetworkThread() {
continue;
}
+ url::CanonHostInfo host_info;
+ std::string canon_host(net::CanonicalizeHost(quic_hint.host, &host_info));
+ if (!host_info.IsIPAddress() &&
+ !net::IsCanonicalizedHostCompliant(canon_host)) {
+ LOG(ERROR) << "Invalid QUIC hint host: " << quic_hint.host;
+ continue;
+ }
+
if (quic_hint.port <= std::numeric_limits<uint16>::min() ||
quic_hint.port > std::numeric_limits<uint16>::max()) {
LOG(ERROR) << "Invalid QUIC hint port: "
@@ -187,7 +196,7 @@ void URLRequestContextAdapter::InitRequestContextOnNetworkThread() {
continue;
}
- net::HostPortPair quic_hint_host_port_pair(quic_hint.host,
+ net::HostPortPair quic_hint_host_port_pair(canon_host,
quic_hint.port);
context_->http_server_properties()->SetAlternateProtocol(
quic_hint_host_port_pair,
« no previous file with comments | « components/cronet/android/test/javatests/src/org/chromium/cronet_test_apk/HttpUrlRequestFactoryTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698