File tree Expand file tree Collapse file tree 2 files changed +26
-17
lines changed Expand file tree Collapse file tree 2 files changed +26
-17
lines changed Original file line number Diff line number Diff line change @@ -253,25 +253,16 @@ uri::string_type fragment(const uri &uri_) {
253
253
return uri_.fragment ();
254
254
}
255
255
256
+ inline
257
+ uri::string_type hierarchical_part (const uri &uri_) {
258
+ return uri::string_type (boost::begin (uri_.user_info_range ()),
259
+ boost::end (uri_.path_range ()));
260
+ }
261
+
256
262
inline
257
263
uri::string_type authority (const uri &uri_) {
258
- uri::string_type port (uri_.port ());
259
- uri::string_type authority;
260
- if (uri_.user_info_range ())
261
- {
262
- boost::copy (uri_.user_info_range (), std::back_inserter (authority));
263
- authority.push_back (' @' );
264
- }
265
- if (uri_.host_range ())
266
- {
267
- boost::copy (uri_.host (), std::back_inserter (authority));
268
- }
269
- if (uri_.port_range ())
270
- {
271
- authority.push_back (' :' );
272
- boost::copy (uri_.port_range (), std::back_inserter (authority));
273
- }
274
- return authority;
264
+ return uri::string_type (boost::begin (uri_.user_info_range ()),
265
+ boost::end (uri_.port_range ()));
275
266
}
276
267
277
268
inline
Original file line number Diff line number Diff line change @@ -306,12 +306,30 @@ BOOST_AUTO_TEST_CASE(username_test) {
306
306
BOOST_CHECK_EQUAL (uri::password (instance), " password" );
307
307
}
308
308
309
+ BOOST_AUTO_TEST_CASE (hierarchical_part_test) {
310
+ uri::uri
instance (
" http://user:[email protected] :80/path?query#fragment" );
311
+ BOOST_REQUIRE (uri::valid (instance));
312
+ BOOST_CHECK_EQUAL (
uri::hierarchical_part (instance),
" user:[email protected] :80/path" );
313
+ }
314
+
315
+ BOOST_AUTO_TEST_CASE (partial_hierarchical_part_test) {
316
+ uri::uri instance (" http://www.example.com?query#fragment" );
317
+ BOOST_REQUIRE (uri::valid (instance));
318
+ BOOST_CHECK_EQUAL (uri::hierarchical_part (instance), " www.example.com" );
319
+ }
320
+
309
321
BOOST_AUTO_TEST_CASE (authority_test) {
310
322
uri::uri
instance (
" http://user:[email protected] :80/path?query#fragment" );
311
323
BOOST_REQUIRE (uri::valid (instance));
312
324
BOOST_CHECK_EQUAL (
uri::authority (instance),
" user:[email protected] :80" );
313
325
}
314
326
327
+ BOOST_AUTO_TEST_CASE (partial_authority_test) {
328
+ uri::uri instance (" http://www.example.com/path?query#fragment" );
329
+ BOOST_REQUIRE (uri::valid (instance));
330
+ BOOST_CHECK_EQUAL (uri::authority (instance), " www.example.com" );
331
+ }
332
+
315
333
BOOST_AUTO_TEST_CASE (http_query_map_test) {
316
334
uri::uri
instance (
" http://user:[email protected] :80/path?query=something#fragment" );
317
335
BOOST_REQUIRE (uri::valid (instance));
You can’t perform that action at this time.
0 commit comments