Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitae9371d

Browse files
Jeroen Habrakendeanberris
Jeroen Habraken
authored andcommitted
Improvements as mentioned on the mailing list, cleanup
1 parent7906db1 commitae9371d

File tree

7 files changed

+35
-42
lines changed

7 files changed

+35
-42
lines changed

‎RATIONALErenamed to ‎RATIONALE.txt

File renamed without changes.

‎boost/network/uri/detail/constants.hpp

Whitespace-only changes.

‎boost/network/uri/detail/parse_uri.hpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef BOOST_NETWORK_URL_DETAIL_PARSE_URL_HPP_
22
#defineBOOST_NETWORK_URL_DETAIL_PARSE_URL_HPP_
33

4-
// Copyright 2009 Dean Michael Berris.
4+
// Copyright 2009 Dean Michael Berris, Jeroen Habraken.
55
// Distributed under the Boost Software License, Version 1.0.
66
// (See accompanying file LICENSE_1_0.txt or copy at
77
// http://www.boost.org/LICENSE_1_0.txt)
@@ -20,30 +20,23 @@ namespace boost { namespace network { namespace uri {
2020

2121
template<classRange,classTag>
2222
inlineboolparse_uri(Range & range, uri_parts<Tag> & parts) {
23-
using spirit::qi::parse;
24-
using spirit::qi::lexeme;
25-
using spirit::ascii::char_;
26-
using spirit::ascii::cntrl;
27-
using spirit::ascii::alnum;
28-
using spirit::ascii::space;
29-
usingnamespacespirit::qi::labels;
30-
using fusion::tie;
23+
namespaceqi= boost::spirit::qi;
3124

3225
typedeftypename range_iterator<Range>::type iterator;
3326
typedeftypename string<Tag>::type string_type;
3427

3528
iterator start_ =begin(range);
3629
iterator end_ =end(range);
3730
fusion::tuple<string_type&,string_type&> result =
38-
tie(parts.scheme,parts.scheme_specific_part);
31+
fusion::tie(parts.scheme,parts.scheme_specific_part);
3932

40-
bool ok =parse(
33+
bool ok =qi::parse(
4134
start_, end_,
4235
(
43-
+((alnum|char_("+.-")) -':')
36+
(qi::alpha > *(qi::alnum |qi::char_("+.-")))
4437
>>':'
4538
>>
46-
+(char_ - (cntrl|space))
39+
+(qi::char_ - (qi::cntrl | qi::space))
4740
),
4841
result
4942
);

‎boost/network/uri/http/detail/parse_specific.hpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#ifndef BOOST_NETWORK_URL_HTTP_DETAIL_PARSE_SPECIFIC_HPP_
22
#defineBOOST_NETWORK_URL_HTTP_DETAIL_PARSE_SPECIFIC_HPP_
33

4-
// Copyright 2009 Dean Michael Berris.
4+
// Copyright 2009 Dean Michael Berris, Jeroen Habraken.
55
// Distributed under the Boost Software License, Version 1.0.
66
// (See accompanying file LICENSE_1_0.txt of copy at
77
// http://www.boost.org/LICENSE_1_0.txt)
88

9+
#include<boost/algorithm/string/case_conv.hpp>
10+
911
#include<boost/network/uri/http/detail/uri_parts.hpp>
1012
#include<boost/network/uri/detail/parse_uri.hpp>
11-
#include<boost/network/uri/detail/constants.hpp>
1213
#include<boost/network/traits/string.hpp>
1314

1415
namespaceboost {namespacenetwork {namespaceuri {
@@ -51,6 +52,12 @@ namespace boost { namespace network { namespace uri {
5152
uri_parts<tags::http> & parts
5253
)
5354
{
55+
namespaceqi= spirit::qi;
56+
57+
// For resiliency, programs interpreting URI should treat upper
58+
// case letters as equivalent to lower case in scheme names
59+
boost::to_lower(parts.scheme);
60+
5461
// Require that parts.scheme is either http or https
5562
if (parts.scheme.size() <4)
5663
returnfalse;
@@ -62,17 +69,6 @@ namespace boost { namespace network { namespace uri {
6269
}elseif (parts.scheme.size() >5)
6370
returnfalse;
6471

65-
using spirit::qi::parse;
66-
using spirit::qi::lit;
67-
using spirit::ascii::char_;
68-
using spirit::ascii::space;
69-
using spirit::ascii::alnum;
70-
using spirit::ascii::punct;
71-
using spirit::qi::lexeme;
72-
using spirit::qi::uint_;
73-
using spirit::qi::digit;
74-
using spirit::qi::rule;
75-
7672
typedef string<tags::http>::type string_type;
7773
typedef range_iterator<string_type>::type iterator;
7874

@@ -81,7 +77,7 @@ namespace boost { namespace network { namespace uri {
8177
fusion::tuple<
8278
optional<string_type> &,
8379
string_type &,
84-
optional<uint32_t> &,
80+
optional<uint16_t> &,
8581
optional<string_type> &,
8682
optional<string_type> &,
8783
optional<string_type> &
@@ -95,20 +91,24 @@ namespace boost { namespace network { namespace uri {
9591
parts.fragment
9692
);
9793

94+
qi::rule<iterator,string_type::value_type()> reserved =qi::char_(";/?:@&=+$,");
95+
qi::rule<iterator,string_type::value_type()> unreserved = qi::alnum |qi::char_("-_.!~*'()");
96+
qi::rule<iterator,string_type()> escaped =qi::char_("%") >qi::repeat(2)[qi::xdigit];
97+
9898
hostname<tags::http>::parser<iterator> hostname;
99-
bool ok =parse(
99+
bool ok =qi::parse(
100100
start_, end_,
101101
(
102-
lit("//")
103-
>> -lexeme[
104-
*((alnum|punct) -'@')
102+
qi::lit("//")
103+
>> -qi::lexeme[
104+
*((qi::alnum | qi::punct) -'@')
105105
>>'@'
106106
]
107107
>> hostname
108-
>> -lexeme[':' >>uint_]
109-
>> -lexeme['/' >> *((alnum|punct) -'?')]
110-
>> -lexeme['?' >>*((alnum|punct) -'#')]
111-
>> -lexeme['#' >>*(alnum|punct)]
108+
>> -qi::lexeme[':' >>qi::ushort_]
109+
>> -qi::lexeme['/' >> *((qi::alnum | qi::punct) -'?')]
110+
>> -qi::lexeme['?' >>qi::raw[*(reserved | unreserved | escaped)]]
111+
>> -qi::lexeme['#' >>qi::raw[*(reserved | unreserved | escaped)]]
112112
),
113113
result
114114
);

‎boost/network/uri/http/detail/uri_parts.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef BOOST_NETWORK_URL_HTTP_DETAIL_URL_PARTS_HPP_
22
#defineBOOST_NETWORK_URL_HTTP_DETAIL_URL_PARTS_HPP_
33

4-
// Copyright 2009 Dean Michael Berris.
4+
// Copyright 2009 Dean Michael Berris, Jeroen Habraken.
55
// Distributed under the Boost Software License, Version 1.0.
66
// (See accompanying file LICENSE_1_0.txt of copy at
77
// http://www.boost.org/LICENSE_1_0.txt)
@@ -19,7 +19,7 @@ namespace boost { namespace network { namespace uri {
1919
string_type scheme_specific_part;
2020
optional<string_type> user_info;
2121
string_type host;
22-
optional<uint32_t> port;
22+
optional<uint16_t> port;
2323
optional<string_type> path;
2424
optional<string_type> query;
2525
optional<string_type> fragment;

‎boost/network/uri/http/uri.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef BOOST_NETWORK_URL_HTTP_URL_HPP_
22
#defineBOOST_NETWORK_URL_HTTP_URL_HPP_
33

4-
// Copyright 2009 Dean Michael Berris.
4+
// Copyright 2009 Dean Michael Berris, Jeroen Habraken.
55
// Distributed under the Boost Software License, Version 1.0.
66
// (See accompanying file LICENSE_1_0.txt or copy at
77
// http://www.boost.org/LICENSE_1_0.txt)
@@ -30,7 +30,7 @@ namespace boost { namespace network { namespace uri {
3030
return parts_.host;
3131
}
3232

33-
uint32_tport()const {
33+
uint16_tport()const {
3434
return parts_.port ? *parts_.port :
3535
(parts_.scheme =="https" ?443u :80u);
3636
}
@@ -60,7 +60,7 @@ namespace boost { namespace network { namespace uri {
6060
}
6161

6262
inline
63-
uint32_t
63+
uint16_t
6464
port(basic_uri<tags::http>const & uri) {
6565
return uri.port();
6666
}

‎boost/network/uri/http/uri_concept.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef BOOST_NETWORK_URL_HTTP_URL_CONCEPT_HPP_
22
#defineBOOST_NETWORK_URL_HTTP_URL_CONCEPT_HPP_
33

4-
// Copyright 2009 Dean Michael Berris.
4+
// Copyright 2009 Dean Michael Berris, Jeroen Habraken.
55
// Distributed under the Boost Software License, Version 1.0.
66
// (See accompanying file LICENSE_1_0.txt or copy at
77
// http://www.boost.org/LICENSE_1_0.txt)
@@ -19,7 +19,7 @@ namespace boost { namespace network { namespace uri {
1919
{
2020
string_type user_info_ =user_info(uri);
2121
string_type host_ =host(uri);
22-
uint32_t port_ =port(uri);
22+
uint16_t port_ =port(uri);
2323
port_ =0u;
2424
string_type path_ =path(uri);
2525
string_type query_ =query(uri);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp