1 // Copyright 2014 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <brillo/http/http_transport.h>
6 
7 #include <brillo/http/http_transport_curl.h>
8 
9 namespace brillo {
10 namespace http {
11 
12 const char kErrorDomain[] = "http_transport";
13 const char kDirectProxy[] = "direct://";
14 
CreateDefault()15 std::shared_ptr<Transport> Transport::CreateDefault() {
16   return std::make_shared<http::curl::Transport>(std::make_shared<CurlApi>());
17 }
18 
CreateDefaultWithProxy(const std::string & proxy)19 std::shared_ptr<Transport> Transport::CreateDefaultWithProxy(
20     const std::string& proxy) {
21   if (proxy.empty() || proxy == kDirectProxy) {
22     return CreateDefault();
23   } else {
24     return std::make_shared<http::curl::Transport>(std::make_shared<CurlApi>(),
25                                                    proxy);
26   }
27 }
28 
29 }  // namespace http
30 }  // namespace brillo
31