blob: 17b6acc03ba61d107345912e34a76cf0db34524c [file] [log] [blame]
Chris Sosa45d9f102014-03-24 11:18:54 -07001// 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#ifndef BUFFET_HTTP_TRANSPORT_CURL_H_
6#define BUFFET_HTTP_TRANSPORT_CURL_H_
7
Alex Vakulenkob3aac252014-05-07 17:35:24 -07008#include <string>
9
Alex Vakulenkoa3062c52014-04-21 17:05:51 -070010#include "buffet/http_transport.h"
Chris Sosa45d9f102014-03-24 11:18:54 -070011
Alex Vakulenkoaf23b322014-05-08 16:25:45 -070012namespace buffet {
Chris Sosa45d9f102014-03-24 11:18:54 -070013namespace http {
14namespace curl {
15
Alex Vakulenkob3aac252014-05-07 17:35:24 -070016extern const char kErrorDomain[];
17
Chris Sosa45d9f102014-03-24 11:18:54 -070018///////////////////////////////////////////////////////////////////////////////
Alex Vakulenkoa3062c52014-04-21 17:05:51 -070019// An implementation of http::Transport that uses libcurl for
20// HTTP communications. This class (as http::Transport base)
Chris Sosa45d9f102014-03-24 11:18:54 -070021// is used by http::Request and http::Response classes to provide HTTP
22// functionality to the clients.
Alex Vakulenkoa3062c52014-04-21 17:05:51 -070023// See http_transport.h for more details.
Chris Sosa45d9f102014-03-24 11:18:54 -070024///////////////////////////////////////////////////////////////////////////////
Alex Vakulenkoa3062c52014-04-21 17:05:51 -070025class Transport : public http::Transport {
Chris Sosa45d9f102014-03-24 11:18:54 -070026 public:
Alex Vakulenkoa3062c52014-04-21 17:05:51 -070027 Transport();
28 virtual ~Transport();
Chris Sosa45d9f102014-03-24 11:18:54 -070029
Alex Vakulenko5a9e7182014-08-11 15:59:58 -070030 std::unique_ptr<http::Connection> CreateConnection(
Alex Vakulenkoa3062c52014-04-21 17:05:51 -070031 std::shared_ptr<http::Transport> transport,
32 const std::string& url,
33 const std::string& method,
34 const HeaderList& headers,
35 const std::string& user_agent,
36 const std::string& referer,
Alex Vakulenko5f472062014-08-14 17:54:04 -070037 chromeos::ErrorPtr* error) override;
Chris Sosa45d9f102014-03-24 11:18:54 -070038
39 private:
Chris Sosa45d9f102014-03-24 11:18:54 -070040 DISALLOW_COPY_AND_ASSIGN(Transport);
41};
42
Alex Vakulenkob3aac252014-05-07 17:35:24 -070043} // namespace curl
44} // namespace http
Alex Vakulenkoaf23b322014-05-08 16:25:45 -070045} // namespace buffet
Chris Sosa45d9f102014-03-24 11:18:54 -070046
Alex Vakulenkob3aac252014-05-07 17:35:24 -070047#endif // BUFFET_HTTP_TRANSPORT_CURL_H_