|
6 | 6 | // (See accompanying file LICENSE_1_0.txt of copy at
|
7 | 7 | // http://www.boost.org/LICENSE_1_0.txt)
|
8 | 8 |
|
9 |
| -#include <boost/algorithm/string/case_conv.hpp> |
10 |
| - |
| 9 | +#include <boost/algorithm/string/predicate.hpp> |
11 | 10 | #include <boost/network/uri/http/detail/uri_parts.hpp>
|
12 | 11 | #include <boost/network/uri/detail/parse_uri.hpp>
|
13 | 12 | #include <boost/network/traits/string.hpp>
|
@@ -54,20 +53,16 @@ namespace boost { namespace network { namespace uri {
|
54 | 53 | {
|
55 | 54 | namespace qi = spirit::qi;
|
56 | 55 |
|
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 |
| - return false; |
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() < 4 or parts.scheme.size() > 5) |
65 | 58 | return false;
|
66 |
| - if (parts.scheme.size() == 5) { |
67 |
| - if (parts.scheme[4] != 's') |
| 59 | + if (parts.scheme.size() == 4) { |
| 60 | + if (not boost::iequals(parts.scheme.substr(0, 4), "http")) |
68 | 61 | return false;
|
69 |
| - } else if (parts.scheme.size() > 5) |
70 |
| - return false; |
| 62 | + } else { // size is 5 |
| 63 | + if (not boost::iequals(parts.scheme.substr(0, 5), "https")) |
| 64 | + return false; |
| 65 | + } |
71 | 66 |
|
72 | 67 | typedef string<tags::http>::type string_type;
|
73 | 68 | typedef range_iterator<string_type>::type iterator;
|
|
0 commit comments