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

Commit0a4504d

Browse files
Jeroen Habrakendeanberris
Jeroen Habraken
authored andcommitted
Prevent modification of the scheme
1 parentae9371d commit0a4504d

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

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

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
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-
9+
#include<boost/algorithm/string/predicate.hpp>
1110
#include<boost/network/uri/http/detail/uri_parts.hpp>
1211
#include<boost/network/uri/detail/parse_uri.hpp>
1312
#include<boost/network/traits/string.hpp>
@@ -54,20 +53,16 @@ namespace boost { namespace network { namespace uri {
5453
{
5554
namespaceqi= spirit::qi;
5655

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-
61-
// Require that parts.scheme is either http or https
62-
if (parts.scheme.size() <4)
63-
returnfalse;
64-
if (parts.scheme.substr(0,4) !="http")
56+
// Require that parts.scheme is either http or https, case insensitive
57+
if (parts.scheme.size() <4or parts.scheme.size() >5)
6558
returnfalse;
66-
if (parts.scheme.size() ==5) {
67-
if (parts.scheme[4] !='s')
59+
if (parts.scheme.size() ==4) {
60+
if (notboost::iequals(parts.scheme.substr(0,4),"http"))
6861
returnfalse;
69-
}elseif (parts.scheme.size() >5)
70-
returnfalse;
62+
}else {// size is 5
63+
if (notboost::iequals(parts.scheme.substr(0,5),"https"))
64+
returnfalse;
65+
}
7166

7267
typedef string<tags::http>::type string_type;
7368
typedef range_iterator<string_type>::type iterator;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp