Skip to content

Commit b5a0f30

Browse files
committed
Merge pull request #631 from glynos/message_refactor
Message refactor
2 parents 89f9768 + 1e14f3c commit b5a0f30

38 files changed

+221
-407
lines changed

README.rst

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ Modern C++ network programming libraries.
99
.. image:: https://scan.coverity.com/projects/6714/badge.svg
1010
:target: https://scan.coverity.com/projects/cpp-netlib
1111

12+
.. image:: https://img.shields.io/badge/license-boost-blue.svg
13+
:target: https://github.com/cpp-netlib/cpp-netlib/blob/master/LICENSE_1_0.txt
14+
1215
Join us on Slack: http://slack.cpp-netlib.org/
1316

1417
Subscribe to the mailing list: https://groups.google.com/forum/#!forum/cpp-netlib

boost/network.hpp

-17
This file was deleted.

boost/network/constants.hpp

+15-21
Original file line numberDiff line numberDiff line change
@@ -18,80 +18,75 @@ template <class Tag>
1818
struct constants_narrow {
1919

2020
static char const* crlf() {
21-
static char crlf_[] = {'\r', '\n', 0};
21+
static char crlf_[] = "\r\n";
2222
return crlf_;
2323
}
2424

2525
static char const* dot() {
26-
static char dot_[] = {'.', 0};
26+
static char dot_[] = ".";
2727
return dot_;
2828
}
2929

3030
static char dot_char() { return '.'; }
3131

3232
static char const* http_slash() {
33-
static char http_slash_[] = {'H', 'T', 'T', 'P', '/', 0};
33+
static char http_slash_[] = "HTTP/";
3434
return http_slash_;
3535
}
3636

3737
static char const* space() {
38-
static char space_[] = {' ', 0};
38+
static char space_[] = " ";
3939
return space_;
4040
}
4141

4242
static char space_char() { return ' '; }
4343

4444
static char const* slash() {
45-
static char slash_[] = {'/', 0};
45+
static char slash_[] = "/";
4646
return slash_;
4747
}
4848

4949
static char slash_char() { return '/'; }
5050

5151
static char const* host() {
52-
static char host_[] = {'H', 'o', 's', 't', 0};
52+
static char host_[] = "Host";
5353
return host_;
5454
}
5555

5656
static char const* colon() {
57-
static char colon_[] = {':', 0};
57+
static char colon_[] = ":";
5858
return colon_;
5959
}
6060

6161
static char colon_char() { return ':'; }
6262

6363
static char const* accept() {
64-
static char accept_[] = {'A', 'c', 'c', 'e', 'p', 't', 0};
64+
static char accept_[] = "Accept";
6565
return accept_;
6666
}
6767

6868
static char const* default_accept_mime() {
69-
static char mime_[] = {'*', '/', '*', 0};
69+
static char mime_[] = "*/*";
7070
return mime_;
7171
}
7272

7373
static char const* accept_encoding() {
74-
static char accept_encoding_[] = {'A', 'c', 'c', 'e', 'p', 't', '-', 'E',
75-
'n', 'c', 'o', 'd', 'i', 'n', 'g', 0};
74+
static char accept_encoding_[] = "Accept-Encoding";
7675
return accept_encoding_;
7776
}
7877

7978
static char const* default_accept_encoding() {
80-
static char default_accept_encoding_[] = {
81-
'i', 'd', 'e', 'n', 't', 'i', 't', 'y', ';', 'q', '=',
82-
'1', '.', '0', ',', ' ', '*', ';', 'q', '=', '0', 0};
79+
static char default_accept_encoding_[] = "identity;q=1.0, *;q=0";
8380
return default_accept_encoding_;
8481
}
8582

8683
static char const* user_agent() {
87-
static char user_agent_[] = {'U', 's', 'e', 'r', '-', 'A',
88-
'g', 'e', 'n', 't', 0};
84+
static char user_agent_[] = "User-Agent";
8985
return user_agent_;
9086
}
9187

9288
static char const* cpp_netlib_slash() {
93-
static char cpp_netlib_slash_[] = {'c', 'p', 'p', '-', 'n', 'e',
94-
't', 'l', 'i', 'b', '/', 0};
89+
static char cpp_netlib_slash_[] = "cpp-netlib/";
9590
return cpp_netlib_slash_;
9691
}
9792

@@ -100,13 +95,12 @@ struct constants_narrow {
10095
static char hash_char() { return '#'; }
10196

10297
static char const* connection() {
103-
static char connection_[] = {'C', 'o', 'n', 'n', 'e', 'c',
104-
't', 'i', 'o', 'n', 0};
98+
static char connection_[] = "Connection";
10599
return connection_;
106100
}
107101

108102
static char const* close() {
109-
static char close_[] = {'C', 'l', 'o', 's', 'e', 0};
103+
static char close_[] = "Close";
110104
return close_;
111105
}
112106

boost/network/include/http/client.hpp

-13
This file was deleted.

boost/network/include/http/server.hpp

-13
This file was deleted.

boost/network/include/message.hpp

-17
This file was deleted.

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;
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_REQUEST_INC)
7+
#define BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_REQUEST_INC
8+
9+
#include <boost/network/protocol/http/impl/request.hpp>
10+
11+
namespace boost {
12+
namespace network {
13+
namespace http {
14+
using client_request = basic_request<tags::http_async_8bit_tcp_resolve>;
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

boost/network/protocol/http/impl/request.hpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace http {
5050
*/
5151
template <class Tag>
5252
struct basic_request : public basic_message<Tag> {
53-
mutable boost::network::uri::uri uri_;
53+
boost::network::uri::uri uri_;
5454
std::uint16_t source_port_;
5555
typedef basic_message<Tag> base_type;
5656

@@ -65,10 +65,6 @@ struct basic_request : public basic_message<Tag> {
6565
explicit basic_request(boost::network::uri::uri const& uri_)
6666
: uri_(uri_), source_port_(0) {}
6767

68-
void uri(string_type const& new_uri) { uri_ = new_uri; }
69-
70-
void uri(boost::network::uri::uri const& new_uri) { uri_ = new_uri; }
71-
7268
basic_request() : base_type(), source_port_(0) {}
7369

7470
basic_request(basic_request const& other)

boost/network/protocol/http/server/impl/parsers.ipp

-75
This file was deleted.

0 commit comments

Comments
 (0)