Skip to content

Commit 1e14f3c

Browse files
committed
Refactored HTTP client request and response.
1 parent 99c777c commit 1e14f3c

File tree

8 files changed

+34
-39
lines changed

8 files changed

+34
-39
lines changed

boost/network/protocol/http/client.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <boost/config.hpp>
1010
#include <boost/network/protocol/http/message.hpp>
1111
#include <boost/network/protocol/http/request.hpp>
12-
#include <boost/network/protocol/http/response.hpp>
12+
#include <boost/network/protocol/http/client/response.hpp>
1313
#include <boost/network/traits/ostringstream.hpp>
1414

1515
#include <boost/algorithm/string/classification.hpp>

boost/network/protocol/http/client/facade.hpp

+2-8
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,13 @@
1010
#include <memory>
1111
#include <functional>
1212
#include <boost/network/protocol/http/client/pimpl.hpp>
13-
#include <boost/network/protocol/http/request.hpp>
14-
#include <boost/network/protocol/http/response.hpp>
13+
#include <boost/network/protocol/http/client/request.hpp>
14+
#include <boost/network/protocol/http/client/response.hpp>
1515

1616
namespace boost {
1717
namespace network {
1818
namespace http {
1919

20-
template <class Tag>
21-
struct basic_request;
22-
23-
template <class Tag>
24-
struct basic_response;
25-
2620
template <class Tag, unsigned version_major, unsigned version_minor>
2721
class basic_client_facade {
2822
typedef basic_client_impl<Tag, version_major, version_minor> pimpl_type;

boost/network/protocol/http/client/client_request.hpp renamed to boost/network/protocol/http/client/request.hpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@
33
// (See accompanying file LICENSE_1_0.txt or copy at
44
// http://www.boost.org/LICENSE_1_0.txt)
55

6+
#if !defined(BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_REQUEST_INC)
7+
#define BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_REQUEST_INC
8+
69
#include <boost/network/protocol/http/impl/request.hpp>
710

811
namespace boost {
912
namespace network {
1013
namespace http {
1114
using client_request = basic_request<tags::http_async_8bit_tcp_resolve>;
12-
} // namespace http
13-
} // namespace network
14-
} // namespace boost
15+
} // namespace http
16+
} // namespace network
17+
} // namespace boost
18+
19+
#endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_REQUEST_INC
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2016 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+
#if !defined(BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_RESPONSE_INC)
7+
#define BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_RESPONSE_INC
8+
9+
#include <boost/network/protocol/http/response.hpp>
10+
11+
namespace boost {
12+
namespace network {
13+
namespace http {
14+
using client_response = basic_response<tags::http_async_8bit_tcp_resolve>;
15+
} // namespace http
16+
} // namespace network
17+
} // namespace boost
18+
19+
#endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_RESPONSE_INC

libs/network/test/http/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ if (Boost_FOUND)
3535
${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test})
3636
endforeach (test)
3737
set(TESTS
38-
http_client_request_test
3938
client_constructor_test
4039
client_get_test
4140
client_get_different_port_test

libs/network/test/http/client/request_test.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33
// (See accompanying file LICENSE_1_0.txt or copy at
44
// http://www.boost.org/LICENSE_1_0.txt)
55

6-
76
#include <gtest/gtest.h>
8-
// #include <boost/network/protocol/http/client/request.hpp>
9-
#include <boost/network/protocol/http/client.hpp>
10-
11-
12-
using client_request = boost::network::http::client::request;
7+
#include <boost/network/protocol/http/client/request.hpp>
138

9+
using client_request = boost::network::http::client_request;
1410

1511
TEST(http_client_request, construct_from_uri) {
1612
ASSERT_NO_THROW(client_request("http://cpp-netlib.org/"));

libs/network/test/http/client/response_test.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33
// (See accompanying file LICENSE_1_0.txt or copy at
44
// http://www.boost.org/LICENSE_1_0.txt)
55

6-
76
#include <gtest/gtest.h>
8-
// #include <boost/network/protocol/http/client/response.hpp>
9-
#include <boost/network/protocol/http/client.hpp>
10-
11-
12-
using client_response = boost::network::http::client::response;
7+
#include <boost/network/protocol/http/client/response.hpp>
138

9+
using client_response = boost::network::http::client_response;
1410

1511
TEST(http_client_response, construct) {
1612
ASSERT_NO_THROW(client_response());

libs/network/test/http/http_client_request_test.cpp

-14
This file was deleted.

0 commit comments

Comments
 (0)