Skip to content

Commit dc2d4cb

Browse files
committed
Updated some stuff that's not important.
1 parent 85830b0 commit dc2d4cb

File tree

6 files changed

+77
-100
lines changed

6 files changed

+77
-100
lines changed

http/src/network/http/v2/client/client_options.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <vector>
1313
#include <chrono>
1414
#include <boost/asio/io_service.hpp>
15+
#include <boost/optional.hpp>
1516

1617
namespace network {
1718
namespace http {
@@ -22,7 +23,8 @@ namespace network {
2223

2324
// default timeout is 30 seconds
2425
client_options()
25-
: follow_redirects_(false)
26+
: io_service_(boost::none)
27+
, follow_redirects_(false)
2628
, cache_resolved_(false)
2729
, use_proxy_(false)
2830
, timeout_(30000) { }
@@ -36,6 +38,7 @@ namespace network {
3638
}
3739

3840
void swap(client_options &other) noexcept {
41+
std::swap(io_service_, other.io_service_);
3942
std::swap(follow_redirects_, other.follow_redirects_);
4043
std::swap(cache_resolved_, other.cache_resolved_);
4144
std::swap(use_proxy_, other.use_proxy_);
@@ -44,6 +47,14 @@ namespace network {
4447
std::swap(openssl_verify_paths_, other.openssl_verify_paths_);
4548
}
4649

50+
client_options &io_service(boost::asio::io_service &io_service) {
51+
io_service_ = io_service;
52+
}
53+
54+
boost::optional<boost::asio::io_service &> io_service() const {
55+
return io_service_;
56+
}
57+
4758
client_options &follow_redirects(bool follow_redirects) noexcept {
4859
follow_redirects_ = follow_redirects;
4960
return *this;
@@ -100,6 +111,7 @@ namespace network {
100111

101112
private:
102113

114+
boost::optional<boost::asio::io_service &> io_service_;
103115
bool follow_redirects_;
104116
bool cache_resolved_;
105117
bool use_proxy_;

http/src/network/http/v2/client/connection_manager.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ namespace network {
2222

2323
public:
2424

25+
typedef std::shared_ptr<connection> connection_ptr;
26+
2527
connection_manager() = default;
2628

2729
connection_manager(const connection_manager &) = delete;
@@ -30,9 +32,9 @@ namespace network {
3032

3133
virtual connection_manager() noexcept = 0;
3234

33-
virtual std::shared_ptr<connection> get_connection(boost::asio::io_service &io_service,
34-
const request &req,
35-
const client_options &options) = 0;
35+
virtual connection_ptr get_connection(boost::asio::io_service &io_service,
36+
const request &req,
37+
const client_options &options) = 0;
3638

3739
virtual void clear_resolved_cache() = 0;
3840

http/src/network/http/v2/client/simple_connection_manager.hpp renamed to http/src/network/http/v2/client/default_connection_manager.hpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
// http://www.boost.org/LICENSE_1_0.txt)
55

66

7-
#ifndef __NETWORK_HTTP_V2_CLIENT_SIMPLE_CONNECTION_MANAGER_INC__
8-
#define __NETWORK_HTTP_V2_CLIENT_SIMPLE_CONNECTION_MANAGER_INC__
7+
#ifndef __NETWORK_HTTP_V2_CLIENT_DEFAULT_CONNECTION_MANAGER_INC__
8+
#define __NETWORK_HTTP_V2_CLIENT_DEFAULT_CONNECTION_MANAGER_INC__
99

10-
#include "network/http/v2/client/connection/simple_connection_manager.hpp"
10+
#include "network/http/v2/client/connection/default_connection_manager.hpp"
1111
#include <network/http/v2/client/connection/async_resolver_delegate.hpp>
1212

1313
namespace network {
@@ -18,15 +18,13 @@ namespace network {
1818
class client_connection;
1919
class client_options;
2020

21-
class simple_connection_manager {
21+
class default_connection_manager {
2222

2323
public:
2424

25-
typedef std::shared_ptr<connection> connection_ptr;
25+
default_connection_manager() = default;
2626

27-
simple_connection_manager() = simple;
28-
29-
virtual simple_connection_manager() noexcept;
27+
virtual default_connection_manager() noexcept;
3028

3129
virtual connection_ptr get_connection(boost::asio::io_service &io_service,
3230
const request &req,
@@ -46,4 +44,4 @@ namespace network {
4644
} // namespace network
4745

4846

49-
#endif // __NETWORK_HTTP_V2_CLIENT_SIMPLE_CONNECTION_MANAGER_INC__
47+
#endif // __NETWORK_HTTP_V2_CLIENT_DEFAULT_CONNECTION_MANAGER_INC__
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_NORMAL_CONNECTION_INC__
8+
#define __NETWORK_HTTP_V2_CLIENT_NORMAL_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 normal_connection {
23+
24+
public:
25+
26+
typedef std::function<void (boost::string_ref, boost::system::error_code)> callback_type;
27+
28+
normal_connection() = default;
29+
30+
normal_connection(const normal_connection &) = delete;
31+
32+
normal_connection &operator = (const normal_connection &) = delete;
33+
34+
virtual ~normal_connection() noexcept;
35+
36+
virtual response send_request(std::string method,
37+
request req,
38+
bool get_body,
39+
callback_type callback,
40+
request_options);
41+
42+
virtual void reset();
43+
44+
};
45+
} // namespace v2
46+
} // namespace http
47+
} // namespace network
48+
49+
50+
#endif // __NETWORK_HTTP_V2_CLIENT_NORMAL_CONNECTION_INC__

http/src/network/http/v2/headers.hpp

Lines changed: 0 additions & 86 deletions
This file was deleted.

http/test/v2/features/client/client_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ namespace http = network::http::v2;
1212
Describe(http_client) {
1313

1414
It(gets_a_response) {
15-
auto response = client_.get(http::request(network::uri("http://127.0.0.1/")));
15+
http::request request(network::uri("http://127.0.0.1/"));
16+
auto response = client_.get(request);
1617
}
1718

1819
http::client client_;

0 commit comments

Comments
 (0)