File tree 2 files changed +13
-6
lines changed
2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -30,15 +30,15 @@ uri::string_type normalize_path(const uri::const_range_type &path) {
30
30
31
31
// remove single dot segments
32
32
remove_erase_if (path_segments, [] (const uri::string_type &s) {
33
- return equal (s, as_literal (" ." ));
33
+ return equal (s, boost:: as_literal (" ." ));
34
34
});
35
35
36
36
// remove double dot segments
37
37
std::vector<std::string> normalized_segments;
38
38
auto depth = 0 ;
39
39
for_each (path_segments, [&normalized_segments, &depth] (const uri::string_type &s) {
40
40
assert (depth >= 0 );
41
- if (equal (s, as_literal (" .." ))) {
41
+ if (equal (s, boost:: as_literal (" .." ))) {
42
42
normalized_segments.pop_back ();
43
43
}
44
44
else {
Original file line number Diff line number Diff line change 10
10
#include < boost/algorithm/string/predicate.hpp>
11
11
#include < map>
12
12
13
- #include < iterator>
14
- #include < iostream>
15
-
16
13
namespace network {
17
14
bool operator == (const uri &lhs, const uri &rhs) {
15
+
16
+ // if both URIs are empty, then we should define them as equal even though they're still invalid.
17
+ if (boost::empty (lhs) && boost::empty (rhs)) {
18
+ return true ;
19
+ }
20
+
21
+ if (!valid (lhs) || !valid (rhs)) {
22
+ return false ;
23
+ }
24
+
18
25
// the scheme can be compared insensitive to case
19
26
bool equal = boost::iequals (lhs.scheme_range (), rhs.scheme_range ());
20
27
if (equal) {
@@ -46,7 +53,7 @@ bool operator == (const uri &lhs, const uri &rhs) {
46
53
}
47
54
48
55
if (equal) {
49
- // TODO: test normalized paths
56
+ // test normalized paths
50
57
equal = boost::iequals (normalize_path (lhs.path_range ()), normalize_path (rhs.path_range ()));
51
58
}
52
59
You can’t perform that action at this time.
0 commit comments