|
13 | 13 | #include <boost/network/protocol/http/support/is_simple.hpp> |
14 | 14 | #include <boost/network/protocol/http/support/is_keepalive.hpp> |
15 | 15 | #include <boost/network/support/is_async.hpp> |
| 16 | +#include <boost/mpl/and.hpp> |
| 17 | +#include <boost/mpl/not.hpp> |
16 | 18 |
|
17 | 19 | namespace boost { namespace network { namespace http { |
18 | 20 |
|
19 | 21 | template <class Tag> |
20 | 22 | struct unsupported_tag; |
21 | 23 |
|
| 24 | + template <class Tag, unsigned version_major, unsigned version_minor, class Enable = void> |
| 25 | + struct connection_policy |
| 26 | + { |
| 27 | + typedef unsupported_tag<Tag> type; |
| 28 | + }; |
| 29 | + |
22 | 30 | template <class Tag, unsigned version_major, unsigned version_minor> |
23 | | - struct connection_policy : |
24 | | - mpl::if_< |
25 | | - is_async<Tag>, |
26 | | - async_connection_policy<Tag,version_major,version_minor>, |
27 | | - typename mpl::if_< |
28 | | - is_simple<Tag>, |
29 | | - simple_connection_policy<Tag,version_major,version_minor>, |
30 | | - typename mpl::if_< |
31 | | - is_keepalive<Tag>, |
32 | | - pooled_connection_policy<Tag,version_major,version_minor>, |
33 | | - unsupported_tag<Tag> |
34 | | - >::type |
35 | | - >::type |
36 | | - > |
37 | | - {}; |
| 31 | + struct connection_policy<Tag, version_major, version_minor, typename enable_if<is_async<Tag> >::type> |
| 32 | + { |
| 33 | + typedef async_connection_policy<Tag, version_major, version_minor> type; |
| 34 | + }; |
| 35 | + |
| 36 | + template <class Tag, unsigned version_major, unsigned version_minor> |
| 37 | + struct connection_policy<Tag, version_major, version_minor, typename enable_if<mpl::and_<is_simple<Tag>, mpl::not_<is_async<Tag> > > >::type> |
| 38 | + { |
| 39 | + typedef simple_connection_policy<Tag, version_major, version_minor> type; |
| 40 | + }; |
| 41 | + |
| 42 | + template <class Tag, unsigned version_major, unsigned version_minor> |
| 43 | + struct connection_policy<Tag, version_major, version_minor, typename enable_if<mpl::and_<is_keepalive<Tag>, mpl::not_<is_async<Tag> > > >::type> |
| 44 | + { |
| 45 | + typedef pooled_connection_policy<Tag, version_major, version_minor> type; |
| 46 | + }; |
38 | 47 |
|
39 | 48 | } // namespace http |
40 | 49 |
|
|
0 commit comments