Index: net/url_request/url_request_context_builder.cc |
diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc |
index a2f47704886543da56a4d47a1d39cd9c346c4723..1470be164149cbb7c276b590b583cac3808f8081 100644 |
--- a/net/url_request/url_request_context_builder.cc |
+++ b/net/url_request/url_request_context_builder.cc |
@@ -35,6 +35,7 @@ |
#include "net/ssl/default_channel_id_store.h" |
#include "net/ssl/ssl_config_service_defaults.h" |
#include "net/url_request/data_protocol_handler.h" |
+#include "net/url_request/http_protocol_handler.h" |
#include "net/url_request/static_http_user_agent_settings.h" |
#include "net/url_request/url_request_backoff_manager.h" |
#include "net/url_request/url_request_context.h" |
@@ -476,15 +477,28 @@ std::unique_ptr<URLRequestContext> URLRequestContextBuilder::Build() { |
} |
storage->set_http_transaction_factory(std::move(http_transaction_factory)); |
- URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl; |
+ std::unique_ptr<URLRequestJobFactoryImpl> job_factory = |
+ base::WrapUnique(new URLRequestJobFactoryImpl); |
// Adds caller-provided protocol handlers first so that these handlers are |
- // used over data/file/ftp handlers below. |
+ // used over http/ws/data/file/ftp handlers below. |
for (auto& scheme_handler : protocol_handlers_) { |
job_factory->SetProtocolHandler(scheme_handler.first, |
std::move(scheme_handler.second)); |
} |
protocol_handlers_.clear(); |
+ job_factory->SetProtocolHandler("http", |
+ base::WrapUnique(new HttpProtocolHandler)); |
+ job_factory->SetProtocolHandler("https", |
+ base::WrapUnique(new HttpProtocolHandler)); |
+ |
+#if !defined(OS_IOS) |
+ job_factory->SetProtocolHandler("ws", |
+ base::WrapUnique(new HttpProtocolHandler)); |
+ job_factory->SetProtocolHandler("wss", |
+ base::WrapUnique(new HttpProtocolHandler)); |
+#endif // !defined(OS_IOS) |
+ |
if (data_enabled_) |
job_factory->SetProtocolHandler("data", |
base::WrapUnique(new DataProtocolHandler)); |
@@ -507,7 +521,9 @@ std::unique_ptr<URLRequestContext> URLRequestContextBuilder::Build() { |
} |
#endif // !defined(DISABLE_FTP_SUPPORT) |
- std::unique_ptr<net::URLRequestJobFactory> top_job_factory(job_factory); |
+ std::unique_ptr<net::URLRequestJobFactory> top_job_factory = |
+ std::move(job_factory); |
+ |
if (!url_request_interceptors_.empty()) { |
// Set up interceptors in the reverse order. |