Skip to content

Commit 99c777c

Browse files
committed
Removed some headers that looked redundant.
1 parent 5f6ab56 commit 99c777c

File tree

3 files changed

+55
-130
lines changed

3 files changed

+55
-130
lines changed

boost/network/protocol/http/server/impl/parsers.ipp

-75
This file was deleted.

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

-51
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,61 @@
1+
// Copyright 2013 Google, Inc.
12
// Copyright 2010 Dean Michael Berris.
23
// Distributed under the Boost Software License, Version 1.0.
34
// (See accompanying file LICENSE_1_0.txt or copy at
45
// http://www.boost.org/LICENSE_1_0.txt)
56

6-
#ifdef BOOST_NETWORK_NO_LIB
7-
#undef BOOST_NETWORK_NO_LIB
8-
#endif
7+
#include <tuple>
8+
#include <vector>
9+
#define BOOST_SPIRIT_UNICODE
10+
#include <boost/spirit/include/qi.hpp>
11+
#include <boost/fusion/include/std_tuple.hpp>
12+
#include <boost/network/protocol/http/message/header.hpp>
913

10-
#include <boost/network/protocol/http/server/impl/parsers.ipp>
14+
namespace boost {
15+
namespace spirit {
16+
namespace traits {
17+
18+
typedef std::basic_string<uint32_t> u32_string;
19+
20+
template <> // <typename Attrib, typename T, typename Enable>
21+
struct assign_to_container_from_value<std::string, u32_string, void> {
22+
static void call(u32_string const& val, std::string& attr) {
23+
u32_to_u8_iterator<u32_string::const_iterator> begin = val.begin(),
24+
end = val.end();
25+
for (; begin != end; ++begin) attr += *begin;
26+
}
27+
};
28+
29+
} // namespace traits
30+
} // namespace spirit
31+
} // namespace boost
32+
33+
namespace boost {
34+
namespace network {
35+
namespace http {
36+
37+
void parse_version(
38+
std::string const& partial_parsed,
39+
std::tuple<std::uint8_t, std::uint8_t>& version_pair) {
40+
using namespace boost::spirit::qi;
41+
parse(partial_parsed.begin(), partial_parsed.end(),
42+
(lit("HTTP/") >> ushort_ >> '.' >> ushort_), version_pair);
43+
}
44+
45+
void parse_headers(
46+
std::string const& input, std::vector<request_header_narrow>& container) {
47+
using namespace boost::spirit::qi;
48+
u8_to_u32_iterator<std::string::const_iterator> begin = input.begin(),
49+
end = input.end();
50+
typedef as<boost::spirit::traits::u32_string> as_u32_string;
51+
parse(begin, end,
52+
*(+((alnum | punct) - ':') >> lit(": ") >>
53+
as_u32_string()[+((unicode::alnum | space | punct) - '\r' - '\n')] >>
54+
lit("\r\n")) >>
55+
lit("\r\n"),
56+
container);
57+
}
58+
59+
} // namespace http
60+
} // namespace network
61+
} // namespace boost

0 commit comments

Comments
 (0)