Skip to content

Commit c810667

Browse files
author
glynos
committed
Merged latest documentation from docs branch; minor changes to allow tests to compile with the gcc -pedantic flag. Works on gcc 4.3, needs double checking on other platforms.
1 parent 603c71a commit c810667

18 files changed

+1001
-38
lines changed

boost/network/message.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ namespace boost { namespace network {
9595
void swap(basic_message<Tag> & left, basic_message<Tag> & right) {
9696
// swap for ADL
9797
left.swap(right);
98-
};
98+
}
9999

100100
} // namespace network
101101

boost/network/protocol/http/client.hpp

+21-21
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
namespace boost { namespace network { namespace http {
2828

29-
template <class tag, unsigned int version_major = 1, unsigned version_minor = 0>
29+
template <class Tag, unsigned int version_major = 1, unsigned version_minor = 0>
3030
class basic_client {
3131

3232
private:
@@ -38,7 +38,7 @@ namespace boost { namespace network { namespace http {
3838
boost::asio::ip::tcp::resolver::iterator
3939
> resolver_iterator_pair;
4040

41-
typedef typename string_traits<tag>::type string_type;
41+
typedef typename string_traits<Tag>::type string_type;
4242

4343
resolver_iterator_pair resolve(string_type const & hostname, string_type const & port) {
4444
return std::make_pair(
@@ -67,7 +67,7 @@ namespace boost { namespace network { namespace http {
6767
throw boost::system::system_error(error);
6868
};
6969

70-
void create_request(boost::asio::streambuf & request_buffer, string_type const & method, basic_request<tag> request_) const {
70+
void create_request(boost::asio::streambuf & request_buffer, string_type const & method, basic_request<Tag> request_) const {
7171
std::ostream request_stream(&request_buffer);
7272

7373
request_stream
@@ -110,13 +110,13 @@ namespace boost { namespace network { namespace http {
110110
request_stream << body_;
111111
};
112112

113-
void send_request(boost::asio::ip::tcp::socket & socket, string_type const & method, basic_request<tag> const & request_) const {
113+
void send_request(boost::asio::ip::tcp::socket & socket, string_type const & method, basic_request<Tag> const & request_) const {
114114
boost::asio::streambuf request_buffer;
115115
create_request(request_buffer, method, request_);
116116
write(socket, request_buffer);
117117
};
118118

119-
void read_status(basic_response<tag> & response_, boost::asio::ip::tcp::socket & socket, boost::asio::streambuf & response_buffer) const {
119+
void read_status(basic_response<Tag> & response_, boost::asio::ip::tcp::socket & socket, boost::asio::streambuf & response_buffer) const {
120120
boost::asio::read_until(socket, response_buffer, "\r\n");
121121
std::istream response_stream(&response_buffer);
122122
string_type http_version;
@@ -136,7 +136,7 @@ namespace boost { namespace network { namespace http {
136136
response_.status_message() = status_message;
137137
};
138138

139-
void read_headers(basic_response<tag> & response_, boost::asio::ip::tcp::socket & socket, boost::asio::streambuf & response_buffer) const {
139+
void read_headers(basic_response<Tag> & response_, boost::asio::ip::tcp::socket & socket, boost::asio::streambuf & response_buffer) const {
140140
boost::asio::read_until(socket, response_buffer, "\r\n\r\n");
141141
std::istream response_stream(&response_buffer);
142142
string_type header_line, name;
@@ -160,8 +160,8 @@ namespace boost { namespace network { namespace http {
160160
};
161161
};
162162

163-
void read_body(basic_response<tag> & response_, boost::asio::ip::tcp::socket & socket, boost::asio::streambuf & response_buffer) const {
164-
typename ostringstream_traits<tag>::type body_stream;
163+
void read_body(basic_response<Tag> & response_, boost::asio::ip::tcp::socket & socket, boost::asio::streambuf & response_buffer) const {
164+
typename ostringstream_traits<Tag>::type body_stream;
165165

166166
if (response_buffer.size() > 0)
167167
body_stream << &response_buffer;
@@ -176,14 +176,14 @@ namespace boost { namespace network { namespace http {
176176
response_ << body(body_stream.str());
177177
};
178178

179-
response const sync_request_skeleton(basic_request<tag> const & request_, string_type method, bool get_body) {
179+
response const sync_request_skeleton(basic_request<Tag> const & request_, string_type method, bool get_body) {
180180
using boost::asio::ip::tcp;
181181

182182
tcp::socket socket(_service);
183183
init_socket(socket, request_.host(), boost::lexical_cast<string_type>(request_.port()));
184184
send_request(socket, method, request_);
185185

186-
basic_response<tag> response_;
186+
basic_response<Tag> response_;
187187
response_ << source(request_.host());
188188

189189
boost::asio::streambuf response_buffer;
@@ -199,47 +199,47 @@ namespace boost { namespace network { namespace http {
199199
basic_client()
200200
: _service(), _resolver(_service) { };
201201

202-
response const head (basic_request<tag> const & request_) {
202+
response const head (basic_request<Tag> const & request_) {
203203
return sync_request_skeleton(request_, "HEAD", false);
204204
};
205205

206-
response const get (basic_request<tag> const & request_) {
206+
response const get (basic_request<Tag> const & request_) {
207207
return sync_request_skeleton(request_, "GET", true);
208208
};
209209

210-
response const post (basic_request<tag> const & request_) {
210+
response const post (basic_request<Tag> const & request_) {
211211
return sync_request_skeleton(request_, "POST", true);
212212
};
213213

214-
response const post (basic_request<tag> const & request_, string_type const & content_type, string_type const & body_) {
215-
basic_request<tag> request_copy(request_);
214+
response const post (basic_request<Tag> const & request_, string_type const & content_type, string_type const & body_) {
215+
basic_request<Tag> request_copy(request_);
216216
request_copy << body(body_)
217217
<< header("Content-type", content_type)
218218
<< header("Content-Length", boost::lexical_cast<string_type>(body_.size()));
219219
return post(request_copy);
220220
};
221221

222-
response const post (basic_request<tag> const & request_, string_type const & body_) {
222+
response const post (basic_request<Tag> const & request_, string_type const & body_) {
223223
return post(request_, "x-application/octet-stream", body_);
224224
};
225225

226-
response const put (basic_request<tag> const & request_) {
226+
response const put (basic_request<Tag> const & request_) {
227227
return sync_request_skeleton(request_, "PUT", true);
228228
};
229229

230-
response const put (basic_request<tag> const & request_, string_type const & body_) {
230+
response const put (basic_request<Tag> const & request_, string_type const & body_) {
231231
return put(request_, "x-application/octet-stream", body_);
232232
};
233233

234-
response const put (basic_request<tag> const & request_, string_type const & content_type, string_type const & body_) {
235-
basic_request<tag> request_copy(request_);
234+
response const put (basic_request<Tag> const & request_, string_type const & content_type, string_type const & body_) {
235+
basic_request<Tag> request_copy(request_);
236236
request_copy << body(body_)
237237
<< header("Content-type", content_type)
238238
<< header("Content-Length", boost::lexical_cast<string_type>(body_.size()));
239239
return put(request_copy);
240240
};
241241

242-
response const delete_ (basic_request<tag> const & request_) {
242+
response const delete_ (basic_request<Tag> const & request_) {
243243
return sync_request_skeleton(request_, "DELETE", true);
244244
};
245245

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,20 @@ namespace boost { namespace network { namespace http {
105105
if (fusion::at_key<typename tags::path>(uri_parts).empty()) {
106106
fusion::at_key<typename tags::path>(uri_parts) = "/";
107107
}
108-
};
108+
}
109109

110110
basic_request() :
111111
basic_message<tag>(), uri_parts()
112-
{ };
112+
{ }
113113

114114
basic_request(basic_request const & other) :
115115
basic_message<tag>(other), uri_parts(other.uri_parts)
116-
{ };
116+
{ }
117117

118118
basic_request & operator=(basic_request rhs) {
119119
rhs.swap(*this);
120120
return *this;
121-
};
121+
}
122122

123123
void swap(basic_request & other) {
124124
basic_message<tag> & base_ref(other);
@@ -127,33 +127,33 @@ namespace boost { namespace network { namespace http {
127127
uri_parts_type & other_uri_parts(other.uri_parts);
128128
uri_parts_type & this_uri_parts(this->uri_parts);
129129
std::swap(other_uri_parts, this_uri_parts);
130-
};
130+
}
131131

132132
typename string_traits<tag>::type const host() const {
133133
return fusion::at_key<typename tags::host>(uri_parts);
134-
};
134+
}
135135

136136
unsigned int port() const {
137137
return fusion::at_key<typename tags::port>(uri_parts);
138-
};
138+
}
139139

140140
typename string_traits<tag>::type const path() const {
141141
return fusion::at_key<typename tags::path>(uri_parts);
142-
};
142+
}
143143

144144
typename string_traits<tag>::type const query() const {
145145
return fusion::at_key<typename tags::query>(uri_parts);
146-
};
146+
}
147147

148148
typename string_traits<tag>::type const anchor() const {
149149
return fusion::at_key<typename tags::anchor>(uri_parts);
150-
};
150+
}
151151
};
152152

153153
template <class Tag>
154154
inline void swap(basic_request<Tag> & lhs, basic_request<Tag> & rhs) {
155155
lhs.swap(rhs);
156-
};
156+
}
157157

158158
} // namespace http
159159

boost/network/protocol/http/response.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ namespace boost { namespace network { namespace http {
5858
template <class Tag>
5959
inline void swap(basic_response<Tag> & lhs, basic_response<Tag> & rhs) {
6060
lhs.swap(rhs);
61-
};
61+
}
6262

6363
typedef basic_response<http::message_tag> response;
6464

libs/network/doc/Jamfile.v2

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# (C) Copyright 2008 Glyn Matthews
2+
#
3+
# Distributed under the Boost Software License, Version 1.0. (See accompanying
4+
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5+
6+
path-constant boost-images : doc/src/images ;
7+
8+
xml network : network.qbk ;
9+
10+
boostbook standalone
11+
:
12+
network
13+
:
14+
# HTML options first:
15+
# Use graphics not text for navigation:
16+
<xsl:param>navig.graphics=1
17+
# How far down we chunk nested sections, basically all of them:
18+
<xsl:param>chunk.section.depth=3
19+
# Don't put the first section on the same page as the TOC:
20+
<xsl:param>chunk.first.sections=1
21+
# How far down sections get TOC's
22+
<xsl:param>toc.section.depth=10
23+
# Max depth in each TOC:
24+
<xsl:param>toc.max.depth=3
25+
# How far down we go with TOC's
26+
<xsl:param>generate.section.toc.level=10
27+
# Path for links to Boost:
28+
<xsl:param>boost.root=http://www.boost.org
29+
# Path for libraries index:
30+
<xsl:param>boost.libraries=http://www.boost.org/libs/libraries.htm
31+
# Use the main Boost stylesheet:
32+
<xsl:param>html.stylesheet=../boostbook.css
33+
34+
# PDF Options:
35+
# TOC Generation: this is needed for FOP-0.9 and later:
36+
#<xsl:param>fop1.extensions=1
37+
# Or enable this if you're using XEP:
38+
<xsl:param>xep.extensions=1
39+
# TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
40+
<xsl:param>fop.extensions=0
41+
# No indent on body text:
42+
<xsl:param>body.start.indent=0pt
43+
# Margin size:
44+
<xsl:param>page.margin.inner=0.5in
45+
# Margin size:
46+
<xsl:param>page.margin.outer=0.5in
47+
# Yes, we want graphics for admonishments:
48+
<xsl:param>admon.graphics=1
49+
# Set this one for PDF generation *only*:
50+
# default pnd graphics are awful in PDF form,
51+
# better use SVG's instead:
52+
<format>pdf:<xsl:param>admon.graphics.extension=".svg"
53+
<format>pdf:<xsl:param>admon.graphics.path=$(boost-images)/
54+
;
55+

libs/network/doc/acknowledgements.qbk

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[/
2+
(C) Copyright 2008 Glyn Matthews.
3+
Distributed under the Boost Software License, Version 1.0.
4+
(See accompanying file LICENSE_1_0.txt or copy at
5+
http://www.boost.org/LICENSE_1_0.txt).
6+
]
7+
8+
9+
[section:acknowledgements Acknowledgements]
10+
11+
Much of the implementation of the HTTP package was ported from __pion__.
12+
13+
[endsect]

libs/network/doc/architecture.qbk

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[/
2+
(C) Copyright 2008 Glyn Matthews.
3+
Distributed under the Boost Software License, Version 1.0.
4+
(See accompanying file LICENSE_1_0.txt or copy at
5+
http://www.boost.org/LICENSE_1_0.txt).
6+
]
7+
8+
9+
[section:architecture Architecture]
10+
__cnl__ is built upon the __boost_asio__, for reasons of portability.
11+
12+
The architecture is driven by the requirement to separate requests from the transport mechanism. Additionally, its possible to utilise templates and static mechanisms to make decisions at compile-time, resulting in more efficient and stable client code.
13+
14+
[include message.qbk]
15+
16+
17+
[endsect]
18+

0 commit comments

Comments
 (0)