Skip to content

Commit 5e47bea

Browse files
committed
Implementing an overload to the top-level clear_headers algorithm.
1 parent e182a57 commit 5e47bea

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_CLEAR_HEADER_HPP_20101128
2+
#define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_CLEAR_HEADER_HPP_20101128
3+
4+
#include <boost/network/protocol/http/support/client_or_server.hpp>
5+
#include <boost/network/support/is_async.hpp>
6+
#include <boost/thread/future.hpp>
7+
8+
namespace boost { namespace network { namespace http {
9+
10+
namespace impl {
11+
12+
template <class Tag>
13+
inline typename enable_if<
14+
is_client<Tag>
15+
, void
16+
>::type
17+
clear_headers(basic_request<Tag> & request) {
18+
request.headers(typename basic_request<Tag>::headers_container_type());
19+
}
20+
21+
} /* impl */
22+
23+
template <class Tag>
24+
inline void clear_headers_impl(basic_request<Tag> & request, tags::client) {
25+
impl::clear_headers(request);
26+
}
27+
28+
template <class Tag>
29+
inline void clear_headers_impl(basic_request<Tag> & request, tags::server) {
30+
typedef typename basic_request<Tag>::headers_container_type headers_container;
31+
headers_container().swap(request.headers);
32+
}
33+
34+
template <class Tag>
35+
inline void clear_headers(basic_request<Tag> & request) {
36+
clear_headers_impl(request, typename client_or_server<Tag>::type());
37+
}
38+
39+
} /* http */
40+
41+
} /* network */
42+
43+
} /* boost */
44+
45+
#endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_CLEAR_HEADER_HPP_20101128 */

0 commit comments

Comments
 (0)