Skip to content

Commit 71757f1

Browse files
committed
Updated client sources, adding some more tests.
1 parent 4eac522 commit 71757f1

14 files changed

+110
-6
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright (C) 2013 by Glyn Matthews
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE_1_0.txt or copy at
4+
// http://www.boost.org/LICENSE_1_0.txt)
5+
6+
7+
#ifndef __NETWORK_HTTP_V2_CLIENT_CONNECTION_INC__
8+
#define __NETWORK_HTTP_V2_CLIENT_CONNECTION_INC__
9+
10+
#include <memory>
11+
#include <functional>
12+
#include <boost/utility/string_ref.hpp>
13+
14+
namespace network {
15+
namespace http {
16+
namespace v2 {
17+
18+
class response;
19+
class request;
20+
class request_options;
21+
22+
class connection {
23+
24+
public:
25+
26+
typedef std::function<void (boost::string_ref, boost::system::error_code)> callback_type;
27+
28+
connection() = default;
29+
30+
connection(const connection &) = delete;
31+
32+
connection &operator = (const connection &) = delete;
33+
34+
virtual connection() = default;
35+
36+
virtual response send_request(std::string method,
37+
request req,
38+
bool get_body,
39+
callback_type callback,
40+
request_options) = 0;
41+
42+
virtual void reset() = 0;
43+
44+
};
45+
} // namespace v2
46+
} // namespace http
47+
} // namespace network
48+
49+
50+
#endif // __NETWORK_HTTP_V2_CLIENT_CONNECTION_INC__
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright (C) 2013 by Glyn Matthews
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE_1_0.txt or copy at
4+
// http://www.boost.org/LICENSE_1_0.txt)
5+
6+
7+
#ifndef __NETWORK_HTTP_V2_CLIENT_CONNECTION_MANAGER_INC__
8+
#define __NETWORK_HTTP_V2_CLIENT_CONNECTION_MANAGER_INC__
9+
10+
#include <memory>
11+
#include <boost/asio/io_service.hpp>
12+
13+
namespace network {
14+
namespace http {
15+
namespace v2 {
16+
17+
class request;
18+
class client_connection;
19+
class client_options;
20+
21+
class connection_manager {
22+
23+
public:
24+
25+
connection_manager() = default;
26+
27+
connection_manager(const connection_manager &) = delete;
28+
29+
connection_manager &operator = (const connection_manager &) = delete;
30+
31+
virtual connection_manager() = default;
32+
33+
virtual std::shared_ptr<client_connection> get_connection(boost::asio::io_service &io_service,
34+
const request &req,
35+
const client_options &options) = 0;
36+
37+
virtual void clear_resolved_cache() = 0;
38+
39+
virtual void reset() = 0;
40+
41+
};
42+
} // namespace v2
43+
} // namespace http
44+
} // namespace network
45+
46+
47+
#endif // __NETWORK_HTTP_V2_CLIENT_CONNECTION_MANAGER_INC__

http/src/network/http/v2/request.hpp renamed to http/src/network/http/v2/client/request.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <cstdint>
1010
#include <memory>
1111
#include <network/uri.hpp>
12-
#include <network/http/v2/byte_source.hpp>
12+
#include <network/http/v2/client/byte_source.hpp>
1313

1414
namespace network {
1515
namespace http {

http/test/v2/client/byte_source_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
// http://www.boost.org/LICENSE_1_0.txt)
55

66
#include <gtest/gtest.h>
7-
#include <network/http/v2/byte_source.hpp>
7+
#include <network/http/v2/client/byte_source.hpp>
88

99

http/test/v2/client/client_options_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// http://www.boost.org/LICENSE_1_0.txt)
55

66
#include <gtest/gtest.h>
7-
#include <network/http/v2/client_options.hpp>
7+
#include <network/http/v2/client/client_options.hpp>
88

99
TEST(client_options_test, default_options_follow_redirects) {
1010
network::http::v2::client_options opts;

0 commit comments

Comments
 (0)