Skip to content

Commit 10244c6

Browse files
committed
Merge branch 'http-client-refactoring'
2 parents 64dd8cc + a0f68a7 commit 10244c6

File tree

281 files changed

+10041
-8611
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+10041
-8611
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ Testing
88
*.gch
99
libs/mime/test/mime-roundtrip
1010
*.a
11+
bin/
12+
tests/
1113
_build

boost/network/constants.hpp

+25-143
Original file line numberDiff line numberDiff line change
@@ -6,151 +6,33 @@
66
// (See accompanying file LICENSE_1_0.txt or copy at
77
// http://www.boost.org/LICENSE_1_0.txt)
88

9-
#include <boost/network/support/is_default_string.hpp>
10-
#include <boost/network/support/is_default_wstring.hpp>
11-
#include <boost/mpl/if.hpp>
12-
139
namespace boost { namespace network {
1410

15-
namespace impl {
16-
template <class Tag>
17-
struct constants_narrow {
18-
19-
static char const * crlf() {
20-
static char crlf_[] = { '\r', '\n', 0 };
21-
return crlf_;
22-
}
23-
24-
static char const * dot() {
25-
static char dot_[] = { '.', 0 };
26-
return dot_;
27-
}
28-
29-
static char dot_char() { return '.'; }
30-
31-
static char const * http_slash() {
32-
static char http_slash_[] = { 'H', 'T', 'T', 'P', '/', 0 };
33-
return http_slash_;
34-
}
35-
36-
static char const * space() {
37-
static char space_[] = {' ', 0};
38-
return space_;
39-
}
40-
41-
static char space_char() { return ' '; }
42-
43-
static char const * slash() {
44-
static char slash_[] = {'/', 0};
45-
return slash_;
46-
}
47-
48-
static char slash_char() { return '/'; }
49-
50-
static char const * host() {
51-
static char host_[] = {'H', 'o', 's', 't', 0};
52-
return host_;
53-
}
54-
55-
static char const * colon() {
56-
static char colon_[] = {':', 0};
57-
return colon_;
58-
}
59-
60-
static char colon_char() { return ':'; }
61-
62-
static char const * accept() {
63-
static char accept_[] = {'A', 'c', 'c', 'e', 'p', 't', 0};
64-
return accept_;
65-
}
66-
67-
static char const * default_accept_mime() {
68-
static char mime_[] = {
69-
'*', '/', '*', 0
70-
};
71-
return mime_;
72-
}
73-
74-
static char const * accept_encoding() {
75-
static char accept_encoding_[] = {
76-
'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',0
77-
};
78-
return accept_encoding_;
79-
}
80-
81-
static char const * default_accept_encoding() {
82-
static char default_accept_encoding_[] = {
83-
'i','d','e','n','t','i','t','y',';','q','=','1','.','0',',',' ','*',';','q','=','0',0
84-
};
85-
return default_accept_encoding_;
86-
}
87-
88-
static char const * user_agent() {
89-
static char user_agent_[] = {
90-
'U','s','e','r','-','A','g','e','n','t',0
91-
};
92-
return user_agent_;
93-
}
94-
95-
static char const * cpp_netlib_slash() {
96-
static char cpp_netlib_slash_[] = {
97-
'c','p','p','-','n','e','t','l','i','b','/',0
98-
};
99-
return cpp_netlib_slash_;
100-
}
101-
102-
static char question_mark_char() {
103-
return '?';
104-
}
105-
106-
static char hash_char() {
107-
return '#';
108-
}
109-
110-
static char const * connection() {
111-
static char connection_[] = {
112-
'C','o','n','n','e','c','t','i','o','n',0
113-
};
114-
return connection_;
115-
}
116-
117-
static char const * close() {
118-
static char close_[] = {
119-
'C','l','o','s','e', 0
120-
};
121-
return close_;
122-
}
123-
124-
static char const * https() {
125-
static char https_[] = "https";
126-
return https_;
127-
}
128-
129-
};
130-
131-
template <class Tag>
132-
struct constants_wide {
133-
134-
static wchar_t const * https() {
135-
static wchar_t https_[] = L"https";
136-
return https_;
137-
}
138-
139-
};
140-
}
141-
142-
template <class Tag>
143-
struct constants :
144-
mpl::if_<
145-
is_default_string<Tag>,
146-
impl::constants_narrow<Tag>,
147-
typename mpl::if_<
148-
is_default_wstring<Tag>,
149-
impl::constants_wide<Tag>,
150-
unsupported_tag<Tag>
151-
>::type
152-
>::type
153-
{};
11+
struct constants {
12+
static char const * crlf();
13+
static char const * dot();
14+
static char dot_char();
15+
static char const * http_slash();
16+
static char const * space();
17+
static char space_char();
18+
static char const * slash();
19+
static char slash_char();
20+
static char const * host();
21+
static char const * colon();
22+
static char colon_char();
23+
static char const * accept();
24+
static char const * default_accept_mime();
25+
static char const * accept_encoding();
26+
static char const * default_accept_encoding();
27+
static char const * user_agent();
28+
static char const * default_user_agent();
29+
static char const * cpp_netlib_slash();
30+
static char question_mark_char();
31+
static char hash_char();
32+
static char const * connection();
33+
static char const * close();
34+
static char const * https();
35+
};
15436

15537
} // namespace network
15638

boost/network/constants.ipp

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
#ifndef BOOST_NETWORK_CONSTANTS_HPP_20111008
2+
#define BOOST_NETWORK_CONSTANTS_HPP_20111008
3+
4+
// Copyright 2011 Dean Michael Berris <[email protected]>.
5+
// Copyright 2011 Google, Inc.
6+
// Distributed under the Boost Software License, Version 1.0.
7+
// (See accompanying file LICENSE_1_0.txt or copy at
8+
// http://www.boost.org/LICENSE_1_0.txt)
9+
10+
#include <boost/network/constants.hpp>
11+
#include <boost/network/version.hpp>
12+
13+
namespace boost { namespace network {
14+
15+
char const * constants::crlf() {
16+
static char crlf_[] = "\r\n";
17+
return crlf_;
18+
}
19+
20+
char const * constants::dot() {
21+
static char dot_[] = ".";
22+
return dot_;
23+
}
24+
25+
char constants::dot_char() { return '.'; }
26+
27+
char const * constants::http_slash() {
28+
static char http_slash_[] = "HTTP/";
29+
return http_slash_;
30+
}
31+
32+
char const * constants::space() {
33+
static char space_[] = {' ', 0};
34+
return space_;
35+
}
36+
37+
char constants::space_char() { return ' '; }
38+
39+
char const * constants::slash() {
40+
static char slash_[] = {'/', 0};
41+
return slash_;
42+
}
43+
44+
char constants::slash_char() { return '/'; }
45+
46+
char const * constants::host() {
47+
static char host_[] = {'H', 'o', 's', 't', 0};
48+
return host_;
49+
}
50+
51+
char const * constants::colon() {
52+
static char colon_[] = {':', 0};
53+
return colon_;
54+
}
55+
56+
char constants::colon_char() { return ':'; }
57+
58+
char const * constants::accept() {
59+
static char accept_[] = {'A', 'c', 'c', 'e', 'p', 't', 0};
60+
return accept_;
61+
}
62+
63+
char const * constants::default_accept_mime() {
64+
static char mime_[] = {
65+
'*', '/', '*', 0
66+
};
67+
return mime_;
68+
}
69+
70+
char const * constants::accept_encoding() {
71+
static char accept_encoding_[] = {
72+
'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',0
73+
};
74+
return accept_encoding_;
75+
}
76+
77+
char const * constants::default_accept_encoding() {
78+
static char default_accept_encoding_[] = {
79+
'i','d','e','n','t','i','t','y',';','q','=','1','.','0',',',' ','*',';','q','=','0',0
80+
};
81+
return default_accept_encoding_;
82+
}
83+
84+
char const * constants::user_agent() {
85+
static char user_agent_[] = {
86+
'U','s','e','r','-','A','g','e','n','t',0
87+
};
88+
return user_agent_;
89+
}
90+
91+
char const * constants::cpp_netlib_slash() {
92+
static char cpp_netlib_slash_[] = {
93+
'c','p','p','-','n','e','t','l','i','b','/',0
94+
};
95+
return cpp_netlib_slash_;
96+
}
97+
98+
char constants::question_mark_char() {
99+
return '?';
100+
}
101+
102+
char constants::hash_char() {
103+
return '#';
104+
}
105+
106+
char const * constants::connection() {
107+
static char connection_[] = "Connection";
108+
return connection_;
109+
}
110+
111+
char const * constants::close() {
112+
static char close_[] = "close";
113+
return close_;
114+
}
115+
116+
char const * constants::https() {
117+
static char https_[] = "https";
118+
return https_;
119+
}
120+
121+
char const * constants::default_user_agent() {
122+
static char user_agent_[] = "cpp-netlib/" BOOST_NETLIB_VERSION;
123+
return user_agent_;
124+
}
125+
126+
} /* network */
127+
128+
} /* boost */
129+
130+
#endif /* BOOST_NETWORK_CONSTANTS_HPP_20111008 */

boost/network/include/http/client.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
// This is the modular include file for using the HTTP Client
1010

1111
#include <boost/network/protocol/http/client.hpp>
12+
#include <boost/network/message/wrappers.hpp>
13+
#include <boost/network/protocol/http/message/directives.hpp>
14+
#include <boost/network/protocol/http/message/modifiers.hpp>
15+
#include <boost/network/protocol/http/message/wrappers.hpp>
16+
#include <boost/network/message/directives.hpp>
17+
#include <boost/network/message/transformers.hpp>
1218

1319
#endif // BOOST_NETWORK_INCLUDE_HTTP_CLIENT_HPP_
1420

boost/network/include/http/server.hpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
#ifndef BOOST_NETWORK_INCLUDE_HTTP_SERVER_HPP_
22
#define BOOST_NETWORK_INCLUDE_HTTP_SERVER_HPP_
33

4-
// Copyright 2010 Dean Michael Berris
4+
// Copyright 2010-2012 Dean Michael Berris <[email protected]>.
5+
// Copyright 2012 Google, Inc.
56
// Distributed under the Boost Software License, Version 1.0.
67
// (See accompanying file LICENSE_1_0.txt or copy at
78
// http://www.boost.org/LICENSE_1_0.txt)
89
//
910
// This is the modular include file for using the HTTP Client
1011

12+
#include <boost/asio/io_service.hpp>
1113
#include <boost/network/protocol/http/server.hpp>
14+
#include <boost/network/utils/thread_pool.hpp>
15+
#include <boost/network/detail/debug.hpp>
1216

1317
#endif

boost/network/include/message.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
//
99
// This is the modular include file for using the basic message type
1010

11-
#include <boost/network/tags.hpp>
1211
#include <boost/network/message.hpp>
1312

1413
#endif // BOOST_NETWORK_INCLUDE_MESSAGE_HPP_

0 commit comments

Comments
 (0)