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

Unified Diff: net/http/http_stream_factory.cc

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 | « net/http/http_stream_factory.h ('k') | net/http/http_stream_factory_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_factory.cc
diff --git a/net/http/http_stream_factory.cc b/net/http/http_stream_factory.cc
deleted file mode 100644
index 754372bb88aec3549c08266e07992ed455b8bce3..0000000000000000000000000000000000000000
--- a/net/http/http_stream_factory.cc
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/http/http_stream_factory.h"
-
-#include "base/logging.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_split.h"
-#include "base/strings/string_util.h"
-#include "net/base/host_mapping_rules.h"
-#include "net/base/host_port_pair.h"
-#include "net/http/http_network_session.h"
-#include "url/gurl.h"
-
-namespace net {
-
-// WARNING: If you modify or add any static flags, you must keep them in sync
-// with |ResetStaticSettingsToInit|. This is critical for unit test isolation.
-
-// static
-bool HttpStreamFactory::spdy_enabled_ = true;
-
-HttpStreamFactory::~HttpStreamFactory() {}
-
-// static
-void HttpStreamFactory::ResetStaticSettingsToInit() {
- spdy_enabled_ = true;
-}
-
-void HttpStreamFactory::ProcessAlternateProtocol(
- const base::WeakPtr<HttpServerProperties>& http_server_properties,
- const std::vector<std::string>& alternate_protocol_values,
- const HostPortPair& http_host_port_pair,
- const HttpNetworkSession& session) {
- AlternateProtocol protocol = UNINITIALIZED_ALTERNATE_PROTOCOL;
- int port = 0;
- double probability = 1;
- for (size_t i = 0; i < alternate_protocol_values.size(); ++i) {
- const std::string& alternate_protocol_str = alternate_protocol_values[i];
- if (StartsWithASCII(alternate_protocol_str, "p=", true)) {
- if (!base::StringToDouble(alternate_protocol_str.substr(2),
- &probability) ||
- probability < 0 || probability > 1) {
- DVLOG(1) << kAlternateProtocolHeader
- << " header has unrecognizable probability: "
- << alternate_protocol_values[i];
- return;
- }
- continue;
- }
-
- std::vector<std::string> port_protocol_vector;
- base::SplitString(alternate_protocol_str, ':', &port_protocol_vector);
- if (port_protocol_vector.size() != 2) {
- DVLOG(1) << kAlternateProtocolHeader
- << " header has too many tokens: "
- << alternate_protocol_str;
- return;
- }
-
- if (!base::StringToInt(port_protocol_vector[0], &port) ||
- port == 0 || !IsPortValid(port)) {
- DVLOG(1) << kAlternateProtocolHeader
- << " header has unrecognizable port: "
- << port_protocol_vector[0];
- return;
- }
-
- protocol = AlternateProtocolFromString(port_protocol_vector[1]);
-
- if (IsAlternateProtocolValid(protocol) &&
- !session.IsProtocolEnabled(protocol)) {
- DVLOG(1) << kAlternateProtocolHeader
- << " header has unrecognized protocol: "
- << port_protocol_vector[1];
- return;
- }
- }
-
- if (protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
- return;
-
- HostPortPair host_port(http_host_port_pair);
- const HostMappingRules* mapping_rules = GetHostMappingRules();
- if (mapping_rules)
- mapping_rules->RewriteHost(&host_port);
-
- http_server_properties->SetAlternateProtocol(
- host_port, static_cast<uint16>(port), protocol, probability);
-}
-
-GURL HttpStreamFactory::ApplyHostMappingRules(const GURL& url,
- HostPortPair* endpoint) {
- const HostMappingRules* mapping_rules = GetHostMappingRules();
- if (mapping_rules && mapping_rules->RewriteHost(endpoint)) {
- url::Replacements<char> replacements;
- const std::string port_str = base::IntToString(endpoint->port());
- replacements.SetPort(port_str.c_str(), url::Component(0, port_str.size()));
- replacements.SetHost(endpoint->host().c_str(),
- url::Component(0, endpoint->host().size()));
- return url.ReplaceComponents(replacements);
- }
- return url;
-}
-
-HttpStreamFactory::HttpStreamFactory() {}
-
-} // namespace net
« no previous file with comments | « net/http/http_stream_factory.h ('k') | net/http/http_stream_factory_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698