Skip to content

Commit c1b0f16

Browse files
committed
Closes #313 -- make all client implementations use a non-case-sensitive multimap.
1 parent e3996b2 commit c1b0f16

File tree

2 files changed

+41
-33
lines changed

2 files changed

+41
-33
lines changed

boost/network/protocol/http/traits/impl/headers_container.ipp

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,45 @@
11

2-
// Copyright Dean Michael Berris 2008.
2+
// Copyright 2013 Google, Inc.
3+
// Copyright 2008 Dean Michael Berris <dberris@google.com>
34
// 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)
5+
// (See accompanying file LICENSE_1_0.txt or copy at
6+
// http://www.boost.org/LICENSE_1_0.txt)
67

78
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_HEADERS_CONTAINER_IPP
89
#define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_HEADERS_CONTAINER_IPP
910

11+
#include <boost/utility/enable_if.hpp>
1012
#include <boost/network/traits/headers_container.hpp>
1113
#include <boost/network/protocol/http/tags.hpp>
1214
#include <boost/algorithm/string/case_conv.hpp>
1315
#include <map>
1416
#include <string>
1517

16-
namespace boost { namespace network {
17-
18-
template <>
19-
struct headers_container<http::tags::http_default_8bit_tcp_resolve> {
20-
21-
// Moving implementation from original
22-
// message_traits implementation by
23-
// Atomic Labs, Inc.
24-
// --
25-
// returns true if str1 < str2 (ignoring case)
26-
struct is_less_ignore_case {
27-
inline bool operator() (
28-
string<http::tags::http_default_8bit_tcp_resolve>::type const & str1,
29-
string<http::tags::http_default_8bit_tcp_resolve>::type const & str2) const {
30-
return to_lower_copy(str1) < to_lower_copy(str2);
31-
};
18+
namespace boost { namespace network { namespace impl {
19+
20+
template <class Tag>
21+
struct headers_container_impl<Tag, typename enable_if<typename Tag::is_client>::type> {
22+
// Moving implementation from original
23+
// message_traits implementation by
24+
// Atomic Labs, Inc.
25+
// --
26+
// returns true if str1 < str2 (ignoring case)
27+
struct is_less_ignore_case {
28+
inline bool operator() (
29+
string<http::tags::http_default_8bit_tcp_resolve>::type const & str1,
30+
string<http::tags::http_default_8bit_tcp_resolve>::type const & str2) const {
31+
return to_lower_copy(str1) < to_lower_copy(str2);
3232
};
33-
34-
typedef std::multimap<
35-
string<http::tags::http_default_8bit_tcp_resolve>::type,
36-
string<http::tags::http_default_8bit_tcp_resolve>::type,
37-
is_less_ignore_case> type;
3833
};
3934

40-
} // namespace network
35+
typedef std::multimap<
36+
string<http::tags::http_default_8bit_tcp_resolve>::type,
37+
string<http::tags::http_default_8bit_tcp_resolve>::type,
38+
is_less_ignore_case> type;
39+
};
4140

41+
} // namespace impl
42+
} // namespace network
4243
} // namespace boost
4344

4445
#endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_HEADERS_CONTAINER_IPP

boost/network/traits/headers_container.hpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
1-
// Copyright (c) Glyn Matthews 2009.
1+
// Copyright (c) Glyn Matthews 2009.
2+
// Copyright 2013 Google, Inc.
3+
// Copyright 2013 Dean Michael Berris <dberris@google.com>
24
// Distributed under the Boost Software License, Version 1.0.
3-
// (See accompanying file LICENSE_1_0.txt or copy at
4-
// http://www.boost.org/LICENSE_1_0.txt)
5+
// (See accompanying file LICENSE_1_0.txt or copy at
6+
// http://www.boost.org/LICENSE_1_0.txt)
57

68

7-
#ifndef __BOOST_NETWORK_TRAITS_HEADERS_CONTAINER_INC__
8-
# define __BOOST_NETWORK_TRAITS_HEADERS_CONTAINER_INC__
9+
#ifndef BOOST_NETWORK_TRAITS_HEADERS_CONTAINER_INC
10+
# define BOOST_NETWORK_TRAITS_HEADERS_CONTAINER_INC
911

1012
# include <map>
1113
# include <boost/network/tags.hpp>
1214
# include <boost/network/traits/string.hpp>
1315

14-
namespace boost { namespace network {
16+
namespace boost { namespace network { namespace impl {
1517

16-
template <class Tag>
17-
struct headers_container {
18+
template <class Tag, class Enable = void>
19+
struct headers_container_impl {
1820
typedef std::multimap<
1921
typename string<Tag>::type,
2022
typename string<Tag>::type
2123
> type;
2224
};
2325

26+
} // namespace impl
27+
28+
template <class Tag>
29+
struct headers_container : impl::headers_container_impl<Tag> {};
30+
2431
} // namespace network
2532
} // namespace boost
2633

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy