File tree 3 files changed +44
-8
lines changed
3 files changed +44
-8
lines changed Original file line number Diff line number Diff line change @@ -312,29 +312,31 @@ std::size_t hash_value(const uri &uri_)
312
312
return seed;
313
313
}
314
314
315
- inline
316
- bool operator == (const uri &lhs, const uri &rhs) {
317
- return boost::equal (lhs, rhs);
318
- }
315
+ // inline
316
+ // bool operator == (const uri &lhs, const uri &rhs) {
317
+ // return boost::equal(lhs, rhs);
318
+ // }
319
+
320
+ bool operator == (const uri &lhs, const uri &rhs);
319
321
320
322
inline
321
323
bool operator == (const uri &lhs, const uri::string_type &rhs) {
322
- return boost::equal ( lhs, rhs);
324
+ return lhs == uri ( rhs);
323
325
}
324
326
325
327
inline
326
328
bool operator == (const uri::string_type &lhs, const uri &rhs) {
327
- return boost::equal (lhs, rhs) ;
329
+ return uri (lhs) == rhs;
328
330
}
329
331
330
332
inline
331
333
bool operator == (const uri &lhs, const uri::value_type *rhs) {
332
- return boost::equal ( lhs, boost::as_literal (rhs) );
334
+ return lhs == uri (rhs);
333
335
}
334
336
335
337
inline
336
338
bool operator == (const uri::value_type *lhs, const uri &rhs) {
337
- return boost::equal ( boost::as_literal ( lhs), rhs) ;
339
+ return uri ( lhs) == rhs;
338
340
}
339
341
340
342
inline
Original file line number Diff line number Diff line change 5
5
6
6
7
7
#include < network/uri/uri.ipp>
8
+ #include < network/uri/uri.hpp>
9
+ #include < map>
10
+
11
+ #include < iterator>
12
+ #include < iostream>
13
+
14
+ namespace network {
15
+ bool operator == (const uri &lhs, const uri &rhs) {
16
+ bool equal = boost::equal (
17
+ std::make_pair (std::begin (lhs.scheme_range ()), std::begin (lhs.path_range ())),
18
+ std::make_pair (std::begin (rhs.scheme_range ()), std::begin (rhs.path_range ())));
19
+ if (equal)
20
+ {
21
+ // TODO: test normalized paths
22
+ equal = boost::equal (lhs.path_range (), rhs.path_range ());
23
+ }
24
+
25
+ if (equal)
26
+ {
27
+ // test query order
28
+ std::map<uri::string_type, uri::string_type> lhs_query_params, rhs_query_params;
29
+ equal = (query_map (lhs, lhs_query_params) == query_map (rhs, rhs_query_params));
30
+ }
31
+
32
+ return equal;
33
+ }
34
+ } // namespace network
Original file line number Diff line number Diff line change @@ -363,6 +363,12 @@ BOOST_AUTO_TEST_CASE(equality_test_4) {
363
363
BOOST_CHECK (uri_1.c_str () == uri_2);
364
364
}
365
365
366
+ BOOST_AUTO_TEST_CASE (equality_test_reordered_query) {
367
+ network::uri uri_1 (" http://www.example.com/?a=1&b=2" );
368
+ network::uri uri_2 (" http://www.example.com/?b=2&a=1" );
369
+ BOOST_CHECK (uri_1 == uri_2);
370
+ }
371
+
366
372
BOOST_AUTO_TEST_CASE (inequality_test) {
367
373
network::uri uri_1 (" http://www.example.com/" );
368
374
network::uri uri_2 (" http://www.example.com/" );
@@ -454,6 +460,7 @@ BOOST_AUTO_TEST_CASE(issue_67_test) {
454
460
}
455
461
456
462
BOOST_AUTO_TEST_CASE (from_parts_1) {
463
+ std::cout << __FUNCTION__ << std::endl;
457
464
BOOST_CHECK_EQUAL (network::uri (" http://www.example.com/path?query#fragment" ),
458
465
network::from_parts (network::uri (" http://www.example.com" ), " /path" , " query" , " fragment" ));
459
466
}
You can’t perform that action at this time.
0 commit comments