summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-18 00:44:16 +0000
committerrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-18 00:44:16 +0000
commitf5716e311d3c562657bf074718490775d6607a2e (patch)
tree9096e6122f96f0903be6b7c1e72749ce64c3f1ce
parent367c6ff86346828b2c974210f8408b48bd3f0a10 (diff)
downloadchromium_src-f5716e311d3c562657bf074718490775d6607a2e.zip
chromium_src-f5716e311d3c562657bf074718490775d6607a2e.tar.gz
chromium_src-f5716e311d3c562657bf074718490775d6607a2e.tar.bz2
Ensure that QUIC handshakes are required when attempting QUIC
after it has been marked broken. Review URL: https://codereview.chromium.org/240473010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264694 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/net/http_server_properties_manager.cc14
-rw-r--r--chrome/browser/net/http_server_properties_manager.h8
-rw-r--r--net/http/http_server_properties.h7
-rw-r--r--net/http/http_server_properties_impl.cc10
-rw-r--r--net/http/http_server_properties_impl.h7
-rw-r--r--net/quic/quic_stream_factory.cc15
6 files changed, 60 insertions, 1 deletions
diff --git a/chrome/browser/net/http_server_properties_manager.cc b/chrome/browser/net/http_server_properties_manager.cc
index 09e1c5a..f3d8d73 100644
--- a/chrome/browser/net/http_server_properties_manager.cc
+++ b/chrome/browser/net/http_server_properties_manager.cc
@@ -183,6 +183,20 @@ void HttpServerPropertiesManager::SetBrokenAlternateProtocol(
ScheduleUpdatePrefsOnIO();
}
+bool HttpServerPropertiesManager::WasAlternateProtocolRecentlyBroken(
+ const net::HostPortPair& server) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ return http_server_properties_impl_->WasAlternateProtocolRecentlyBroken(
+ server);
+}
+
+void HttpServerPropertiesManager::ConfirmAlternateProtocol(
+ const net::HostPortPair& server) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ http_server_properties_impl_->ConfirmAlternateProtocol(server);
+ ScheduleUpdatePrefsOnIO();
+}
+
void HttpServerPropertiesManager::ClearAlternateProtocol(
const net::HostPortPair& server) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
diff --git a/chrome/browser/net/http_server_properties_manager.h b/chrome/browser/net/http_server_properties_manager.h
index b886799..5a0b2a5 100644
--- a/chrome/browser/net/http_server_properties_manager.h
+++ b/chrome/browser/net/http_server_properties_manager.h
@@ -114,6 +114,14 @@ class HttpServerPropertiesManager
virtual void SetBrokenAlternateProtocol(
const net::HostPortPair& server) OVERRIDE;
+ // Returns true if Alternate-Protocol for |server| was recently BROKEN.
+ virtual bool WasAlternateProtocolRecentlyBroken(
+ const net::HostPortPair& server) OVERRIDE;
+
+ // Confirms that Alternate-Protocol for |server| is working.
+ virtual void ConfirmAlternateProtocol(
+ const net::HostPortPair& server) OVERRIDE;
+
// Clears the Alternate-Protocol for |server|.
virtual void ClearAlternateProtocol(const net::HostPortPair& server) OVERRIDE;
diff --git a/net/http/http_server_properties.h b/net/http/http_server_properties.h
index 33ad01c..dc36b64 100644
--- a/net/http/http_server_properties.h
+++ b/net/http/http_server_properties.h
@@ -144,6 +144,13 @@ class NET_EXPORT HttpServerProperties {
// Sets the Alternate-Protocol for |server| to be BROKEN.
virtual void SetBrokenAlternateProtocol(const HostPortPair& server) = 0;
+ // Returns true if Alternate-Protocol for |server| was recently BROKEN.
+ virtual bool WasAlternateProtocolRecentlyBroken(
+ const HostPortPair& server) = 0;
+
+ // Confirms that Alternate-Protocol for |server| is working.
+ virtual void ConfirmAlternateProtocol(const HostPortPair& server) = 0;
+
// Clears the Alternate-Protocol for |server|.
virtual void ClearAlternateProtocol(const HostPortPair& server) = 0;
diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc
index c869a23..3968b1a 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -313,6 +313,16 @@ void HttpServerPropertiesImpl::SetBrokenAlternateProtocol(
}
}
+bool HttpServerPropertiesImpl::WasAlternateProtocolRecentlyBroken(
+ const HostPortPair& server) {
+ return ContainsKey(broken_alternate_protocol_map_, server);
+}
+
+void HttpServerPropertiesImpl::ConfirmAlternateProtocol(
+ const HostPortPair& server) {
+ broken_alternate_protocol_map_.erase(server);
+}
+
void HttpServerPropertiesImpl::ClearAlternateProtocol(
const HostPortPair& server) {
AlternateProtocolMap::iterator it = alternate_protocol_map_.Peek(server);
diff --git a/net/http/http_server_properties_impl.h b/net/http/http_server_properties_impl.h
index 2b8b950..b03f357 100644
--- a/net/http/http_server_properties_impl.h
+++ b/net/http/http_server_properties_impl.h
@@ -103,6 +103,13 @@ class NET_EXPORT HttpServerPropertiesImpl
// Sets the Alternate-Protocol for |server| to be BROKEN.
virtual void SetBrokenAlternateProtocol(const HostPortPair& server) OVERRIDE;
+ // Returns true if Alternate-Protocol for |server| was recently BROKEN.
+ virtual bool WasAlternateProtocolRecentlyBroken(
+ const HostPortPair& server) OVERRIDE;
+
+ // Confirms that Alternate-Protocol for |server| is working.
+ virtual void ConfirmAlternateProtocol(const HostPortPair& server) OVERRIDE;
+
// Clears the Alternate-Protocol for |server|.
virtual void ClearAlternateProtocol(const HostPortPair& server) OVERRIDE;
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc
index 4a71f31..d2074cd 100644
--- a/net/quic/quic_stream_factory.cc
+++ b/net/quic/quic_stream_factory.cc
@@ -103,6 +103,7 @@ class QuicStreamFactory::Job {
HostResolver* host_resolver,
const HostPortPair& host_port_pair,
bool is_https,
+ bool was_alternate_protocol_recently_broken,
PrivacyMode privacy_mode,
base::StringPiece method,
QuicServerInfo* server_info,
@@ -146,6 +147,7 @@ class QuicStreamFactory::Job {
SingleRequestHostResolver host_resolver_;
QuicServerId server_id_;
bool is_post_;
+ bool was_alternate_protocol_recently_broken_;
scoped_ptr<QuicServerInfo> server_info_;
const BoundNetLog net_log_;
QuicClientSession* session_;
@@ -160,6 +162,7 @@ QuicStreamFactory::Job::Job(QuicStreamFactory* factory,
HostResolver* host_resolver,
const HostPortPair& host_port_pair,
bool is_https,
+ bool was_alternate_protocol_recently_broken,
PrivacyMode privacy_mode,
base::StringPiece method,
QuicServerInfo* server_info,
@@ -168,6 +171,8 @@ QuicStreamFactory::Job::Job(QuicStreamFactory* factory,
host_resolver_(host_resolver),
server_id_(host_port_pair, is_https, privacy_mode),
is_post_(method == "POST"),
+ was_alternate_protocol_recently_broken_(
+ was_alternate_protocol_recently_broken),
server_info_(server_info),
net_log_(net_log),
session_(NULL),
@@ -300,8 +305,11 @@ int QuicStreamFactory::Job::DoConnect() {
if (!session_->connection()->connected()) {
return ERR_QUIC_PROTOCOL_ERROR;
}
+ bool require_confirmation =
+ factory_->require_confirmation() || server_id_.is_https() || is_post_ ||
+ was_alternate_protocol_recently_broken_;
rv = session_->CryptoConnect(
- factory_->require_confirmation() || server_id_.is_https() || is_post_,
+ require_confirmation,
base::Bind(&QuicStreamFactory::Job::OnIOComplete,
base::Unretained(this)));
return rv;
@@ -451,7 +459,12 @@ int QuicStreamFactory::Create(const HostPortPair& host_port_pair,
quic_server_info = quic_server_info_factory_->GetForServer(server_id);
}
}
+ bool was_alternate_protocol_recently_broken =
+ http_server_properties_ &&
+ http_server_properties_->WasAlternateProtocolRecentlyBroken(
+ server_id.host_port_pair());
scoped_ptr<Job> job(new Job(this, host_resolver_, host_port_pair, is_https,
+ was_alternate_protocol_recently_broken,
privacy_mode, method, quic_server_info, net_log));
int rv = job->Run(base::Bind(&QuicStreamFactory::OnJobComplete,
base::Unretained(this), job.get()));