Skip to content

Commit 21f56c2

Browse files
committed
merged a bunch of changes from 0.8
2 parents fc8c153 + 96367d1 commit 21f56c2

File tree

116 files changed

+8252
-238
lines changed

Some content is hidden

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

116 files changed

+8252
-238
lines changed

boost/network/detail/wrapper_base.hpp

+23-19
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,38 @@
77
#ifndef __NETWORK_DETAIL_WRAPPER_BASE_HPP__
88
#define __NETWORK_DETAIL_WRAPPER_BASE_HPP__
99

10-
namespace boost { namespace network { namespace detail {
10+
namespace boost { namespace network {
1111

1212
template <class Tag>
13-
struct wrapper_base {
14-
explicit wrapper_base(basic_message<Tag> & message_)
15-
: _message(message_)
16-
{};
13+
struct basic_message;
14+
15+
namespace detail {
1716

18-
protected:
19-
~wrapper_base() {}; // for extending only
17+
template <class Tag>
18+
struct wrapper_base {
19+
explicit wrapper_base(basic_message<Tag> & message_)
20+
: _message(message_)
21+
{};
2022

21-
basic_message<Tag> & _message;
22-
};
23+
protected:
24+
~wrapper_base() {}; // for extending only
2325

24-
template <class Tag>
25-
struct wrapper_base_const {
26-
explicit wrapper_base_const(basic_message<Tag> const & message_)
27-
: _message(message_)
28-
{}
26+
basic_message<Tag> & _message;
27+
};
2928

30-
protected:
31-
~wrapper_base_const() {}; // for extending only
29+
template <class Tag>
30+
struct wrapper_base_const {
31+
explicit wrapper_base_const(basic_message<Tag> const & message_)
32+
: _message(message_)
33+
{}
3234

33-
basic_message<Tag> const & _message;
34-
};
35+
protected:
36+
~wrapper_base_const() {}; // for extending only
3537

38+
basic_message<Tag> const & _message;
39+
};
3640

37-
} // namespace detail
41+
} // namespace detail
3842

3943
} // namespace network
4044

boost/network/message/directives/remove_header.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
namespace boost { namespace network {
1515

16+
template <class Tag>
17+
struct basic_message;
18+
1619
namespace impl {
1720
template <
1821
class T

boost/network/message/modifiers/add_header.hpp

-7
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ namespace boost { namespace network {
2727
message.add_header(std::make_pair(key, value));
2828
}
2929

30-
template <class Message, class KeyType, class ValueType, class Async>
31-
inline void add_header(Message const & message, KeyType const & key, ValueType const & value, tags::http_server const &, Async const &) {
32-
typedef typename Message::headers_container_type::value_type value_type;
33-
value_type header_ = { key, value };
34-
message.headers.insert(message.headers.end(), header_);
35-
}
36-
3730
}
3831

3932
template <class Tag, template <class> class Message, class KeyType, class ValueType>

boost/network/message/modifiers/body.hpp

-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ namespace boost { namespace network {
2323
message.body(body_);
2424
}
2525

26-
template <class Message, class ValueType, class Async>
27-
inline void body(Message const & message, ValueType const & body_, tags::http_server, Async) {
28-
message.body = body_;
29-
}
30-
3126
} // namespace impl
3227

3328
template <class Tag, template <class> class Message, class ValueType>

boost/network/message/modifiers/clear_headers.hpp

-5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ namespace boost { namespace network {
2525
header_promise.set_value(typename Message::headers_container_type());
2626
}
2727

28-
template <class Message, class Async>
29-
inline void clear_headers(Message const & message, tags::http_server const &, Async const &) {
30-
(typename Message::headers_container_type()).swap(message.headers);
31-
}
32-
3328
} // namespace impl
3429

3530
template <class Tag, template <class> class Message>

boost/network/message/modifiers/destination.hpp

-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ namespace boost { namespace network {
2424
message.destination(destination_);
2525
}
2626

27-
template <class Message, class ValueType, class Async>
28-
inline void destination(Message const & message, ValueType const & destination_, tags::http_server, Async) {
29-
message.destination = destination_;
30-
}
3127
}
3228

3329
template <class Tag, template<class> class Message, class ValueType>

boost/network/message/modifiers/remove_header.hpp

-24
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// http://www.boost.org/LICENSE_1_0.txt)
99

1010
#include <boost/network/support/is_async.hpp>
11-
#include <algorithm>
1211

1312
namespace boost { namespace network {
1413

@@ -29,29 +28,6 @@ namespace boost { namespace network {
2928
message.remove_header(key);
3029
}
3130

32-
template <class KeyType>
33-
struct equals {
34-
explicit equals(KeyType const & key_)
35-
: key(key_) {}
36-
equals(equals const & other)
37-
: key(other.key) {}
38-
template <class RequestHeader>
39-
bool operator()(RequestHeader const & header) {
40-
return boost::iequals(header.name, key);
41-
}
42-
KeyType const & key;
43-
};
44-
45-
template <class Message, class KeyType, class Async>
46-
inline void remove_header(Message const & message, KeyType const & key, tags::http_server const &, Async const &) {
47-
typedef typename Message::headers_container_type::iterator iterator;
48-
iterator end = message.headers.end();
49-
iterator new_end = std::remove_if(
50-
message.headers.begin(),
51-
message.headers.end(),
52-
equals<KeyType>(key));
53-
message.headers.erase(new_end, end);
54-
}
5531

5632
} // namespace impl
5733

boost/network/message/modifiers/source.hpp

-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ namespace boost { namespace network {
2323
message.source(source_);
2424
}
2525

26-
template <class Message, class ValueType, class Async>
27-
inline void source(Message const & message, ValueType const & source_, tags::http_server const &, Async const &) {
28-
message.source = source_;
29-
}
30-
3126
} // namespace impl
3227

3328
template <class Tag, template <class> class Message, class ValueType>

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <boost/network/protocol/http/request.hpp>
1010
#include <boost/network/protocol/http/response.hpp>
11-
#include <boost/network/support/sync_only.hpp>
11+
#include <boost/network/protocol/http/support/sync_only.hpp>
1212

1313
namespace boost { namespace network { namespace http {
1414

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ namespace boost { namespace network { namespace http {
159159

160160
/** Specialize the traits for the http_server tag. */
161161
template <>
162-
struct headers_container<tags::http_server> :
163-
vector<tags::http_server>::apply<http::request_header>
162+
struct headers_container<http::tags::http_server> :
163+
vector<http::tags::http_server>::apply<http::request_header>
164164
{};
165165

166166
namespace http { namespace impl {

boost/network/protocol/http/impl/response.ipp

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
//
2-
// reply.hpp
3-
// ~~~~~~~~~
4-
//
52
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
63
// Copyright (c) 2009 Dean Michael Berris ([email protected])
74
// Copyright (c) 2009 Tarroo, Inc.
@@ -19,8 +16,9 @@
1916

2017
#include <boost/asio/buffer.hpp>
2118
#include <boost/lexical_cast.hpp>
19+
#include <boost/network/protocol/http/tags.hpp>
2220
#include <boost/network/traits/string.hpp>
23-
#include <boost/network/traits/vector.hpp>
21+
#include <boost/network/protocol/http/traits/vector.hpp>
2422
#include <boost/network/protocol/http/header.hpp>
2523

2624
namespace boost { namespace network { namespace http {

boost/network/protocol/http/message.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
#define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HPP
1414

1515
#include <boost/network/protocol/http/traits.hpp>
16+
#include <boost/network/protocol/http/message/modifiers/add_header.hpp>
17+
#include <boost/network/protocol/http/message/modifiers/remove_header.hpp>
18+
#include <boost/network/protocol/http/message/modifiers/clear_headers.hpp>
1619
#include <boost/network/message.hpp>
1720
#include <boost/network/tags.hpp>
1821
#include <string>

boost/network/protocol/http/message/message_base.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ namespace boost { namespace network { namespace http {
1414

1515
template <class Tag>
1616
struct async_message;
17+
18+
template <class Tag>
19+
struct message_impl;
1720

1821
template <class Tag>
1922
struct message_base
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_ADD_HEADER_HPP_20101019
3+
#define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_ADD_HEADER_HPP_20101019
4+
5+
// Copyright 2010 (c) Dean Michael Berris
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/protocol/http/tags.hpp>
11+
12+
namespace boost { namespace network {
13+
14+
namespace impl {
15+
16+
template <class Message, class KeyType, class ValueType, class Async>
17+
inline void add_header(Message const & message, KeyType const & key, ValueType const & value, http::tags::http_server const &, Async const &) {
18+
typedef typename Message::headers_container_type::value_type value_type;
19+
value_type header_ = { key, value };
20+
message.headers.insert(message.headers.end(), header_);
21+
}
22+
23+
}
24+
25+
} /* network */
26+
27+
} /* boost */
28+
29+
#include <boost/network/message/modifiers/add_header.hpp>
30+
#endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_ADD_HEADER_HPP_20101019 */

boost/network/protocol/http/message/modifiers/body.hpp

+10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
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/protocol/http/tags.hpp>
910
#include <boost/network/support/is_async.hpp>
1011
#include <boost/thread/future.hpp>
1112
#include <boost/concept/requires.hpp>
@@ -40,6 +41,15 @@ namespace boost { namespace network { namespace http {
4041

4142
} // namespace http
4243

44+
namespace impl {
45+
46+
template <class Message, class ValueType, class Async>
47+
inline void body(Message const & message, ValueType const & body_, http::tags::http_server, Async) {
48+
message.body = body_;
49+
}
50+
51+
} /* impl */
52+
4353
} // namespace network
4454

4555
} // namespace boost
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_CLEAR_HEADERS_HPP_20101019
2+
#define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_CLEAR_HEADERS_HPP_20101019
3+
4+
// Copyright 2010 (c) Dean Michael Berris
5+
// Distributed under the Boost Software License, Version 1.0.
6+
// (See accompanying file LICENSE_1_0.txt or copy at
7+
// http://www.boost.org/LICENSE_1_0.txt)
8+
9+
#include <boost/network/protocol/http/tags.hpp>
10+
11+
namespace boost { namespace network {
12+
13+
namespace impl {
14+
15+
template <class Message, class Async>
16+
inline void clear_headers(Message const & message, http::tags::http_server const &, Async const &) {
17+
(typename Message::headers_container_type()).swap(message.headers);
18+
}
19+
20+
} /* impl */
21+
22+
} /* network */
23+
24+
} /* boost */
25+
26+
#include <boost/network/message/modifiers/clear_headers.hpp>
27+
28+
#endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_CLEAR_HEADERS_HPP_20101019 */

boost/network/protocol/http/message/modifiers/destination.hpp

+14
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ namespace boost { namespace network { namespace http {
2929

3030
}
3131

32+
template <class R>
33+
struct Response;
34+
3235
template <class Tag, class T>
3336
inline
3437
BOOST_CONCEPT_REQUIRES(((Response<basic_response<Tag> >)),
@@ -39,8 +42,19 @@ namespace boost { namespace network { namespace http {
3942

4043
} // namespace http
4144

45+
namespace impl {
46+
47+
template <class Message, class ValueType, class Async>
48+
inline void destination(Message const & message, ValueType const & destination_, http::tags::http_server, Async) {
49+
message.destination = destination_;
50+
}
51+
52+
} /* impl */
53+
4254
} // namespace network
4355

4456
} // namespace boost
4557

58+
#include <boost/network/message/modifiers/destination.hpp>
59+
4660
#endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIER_DESTINATION_HPP_20100624
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_REMOVE_HEADER_HPP_20101019
2+
#define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_REMOVE_HEADER_HPP_20101019
3+
4+
// Copyright 2010 (c) Dean Michael Berris
5+
// Distributed under the Boost Software License, Version 1.0.
6+
// (See accompanying file LICENSE_1_0.txt or copy at
7+
// http://www.boost.org/LICENSE_1_0.txt)
8+
9+
#include <boost/network/protocol/http/tags.hpp>
10+
#include <boost/algorithm/string/predicate.hpp>
11+
#include <algorithm>
12+
13+
namespace boost { namespace network {
14+
15+
namespace impl {
16+
17+
template <class KeyType>
18+
struct equals {
19+
explicit equals(KeyType const & key_)
20+
: key(key_) {}
21+
equals(equals const & other)
22+
: key(other.key) {}
23+
template <class RequestHeader>
24+
bool operator()(RequestHeader const & header) {
25+
return boost::iequals(header.name, key);
26+
}
27+
KeyType const & key;
28+
};
29+
30+
template <class Message, class KeyType, class Async>
31+
inline void remove_header(Message const & message, KeyType const & key, http::tags::http_server const &, Async const &) {
32+
typedef typename Message::headers_container_type::iterator iterator;
33+
iterator end = message.headers.end();
34+
iterator new_end = std::remove_if(
35+
message.headers.begin(),
36+
message.headers.end(),
37+
equals<KeyType>(key));
38+
message.headers.erase(new_end, end);
39+
}
40+
41+
} /* impl */
42+
43+
} /* network */
44+
45+
} /* boost */
46+
47+
#include <boost/network/message/modifiers/remove_header.hpp>
48+
49+
#endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_REMOVE_HEADER_HPP_20101019 */

0 commit comments

Comments
 (0)