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

Commit39d7630

Browse files
committed
Fixed some compilation errors on MSVC; Added tests for equality when the URI strings are invalid or empty.
1 parent275ed5d commit39d7630

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

‎libs/network/src/uri/normalize.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ uri::string_type normalize_path(const uri::const_range_type &path) {
3030

3131
// remove single dot segments
3232
remove_erase_if(path_segments, [] (const uri::string_type &s) {
33-
returnequal(s,as_literal("."));
33+
returnequal(s,boost::as_literal("."));
3434
});
3535

3636
// remove double dot segments
3737
std::vector<std::string> normalized_segments;
3838
auto depth =0;
3939
for_each(path_segments, [&normalized_segments, &depth] (const uri::string_type &s) {
4040
assert(depth >=0);
41-
if (equal(s,as_literal(".."))) {
41+
if (equal(s,boost::as_literal(".."))) {
4242
normalized_segments.pop_back();
4343
}
4444
else {

‎libs/network/src/uri/uri.cpp‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,18 @@
1010
#include<boost/algorithm/string/predicate.hpp>
1111
#include<map>
1212

13-
#include<iterator>
14-
#include<iostream>
15-
1613
namespacenetwork {
1714
booloperator == (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+
returntrue;
19+
}
20+
21+
if (!valid(lhs) || !valid(rhs)) {
22+
returnfalse;
23+
}
24+
1825
// the scheme can be compared insensitive to case
1926
bool equal =boost::iequals(lhs.scheme_range(), rhs.scheme_range());
2027
if (equal) {
@@ -46,7 +53,7 @@ bool operator == (const uri &lhs, const uri &rhs) {
4653
}
4754

4855
if (equal) {
49-
//TODO:test normalized paths
56+
// test normalized paths
5057
equal =boost::iequals(normalize_path(lhs.path_range()),normalize_path(rhs.path_range()));
5158
}
5259

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp