@@ -394,7 +394,7 @@ LT_BEGIN_AUTO_TEST(basic_suite, duplicate_endpoints)
394394 LT_CHECK_EQ (false , ws->register_resource (" OK/" , &ok2));
395395
396396 // Check how family interacts.
397- LT_CHECK_EQ (false , ws->register_resource (" OK" , &ok2, true ));
397+ LT_CHECK_EQ (true , ws->register_resource (" OK" , &ok2, true ));
398398
399399 // Check that switched case does the right thing, whatever that is here.
400400#ifdef CASE_INSENSITIVE
@@ -406,6 +406,100 @@ LT_BEGIN_AUTO_TEST(basic_suite, duplicate_endpoints)
406406#endif
407407LT_END_AUTO_TEST (duplicate_endpoints)
408408
409+ LT_BEGIN_AUTO_TEST(basic_suite, family_endpoints)
410+ static_resource ok1(" 1" ), ok2(" 2" );
411+ LT_CHECK_EQ (true , ws->register_resource (" OK" , &ok1));
412+ LT_CHECK_EQ (true , ws->register_resource (" OK" , &ok2, true ));
413+
414+ curl_global_init (CURL_GLOBAL_ALL);
415+
416+ {
417+ string s;
418+ CURL *curl = curl_easy_init ();
419+ CURLcode res;
420+ curl_easy_setopt (curl, CURLOPT_URL, " localhost:" PORT_STRING " /OK" );
421+ curl_easy_setopt (curl, CURLOPT_HTTPGET, 1L );
422+ curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, writefunc);
423+ curl_easy_setopt (curl, CURLOPT_WRITEDATA, &s);
424+ res = curl_easy_perform (curl);
425+ LT_ASSERT_EQ (res, 0 );
426+ LT_CHECK_EQ (s, " 1" );
427+ curl_easy_cleanup (curl);
428+ }
429+
430+ {
431+ string s;
432+ CURL *curl = curl_easy_init ();
433+ CURLcode res;
434+ curl_easy_setopt (curl, CURLOPT_URL, " localhost:" PORT_STRING " /OK/" );
435+ curl_easy_setopt (curl, CURLOPT_HTTPGET, 1L );
436+ curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, writefunc);
437+ curl_easy_setopt (curl, CURLOPT_WRITEDATA, &s);
438+ res = curl_easy_perform (curl);
439+ LT_ASSERT_EQ (res, 0 );
440+ LT_CHECK_EQ (s, " 1" );
441+ curl_easy_cleanup (curl);
442+ }
443+
444+ {
445+ string s;
446+ CURL *curl = curl_easy_init ();
447+ CURLcode res;
448+ curl_easy_setopt (curl, CURLOPT_URL, " localhost:" PORT_STRING " /OK/go" );
449+ curl_easy_setopt (curl, CURLOPT_HTTPGET, 1L );
450+ curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, writefunc);
451+ curl_easy_setopt (curl, CURLOPT_WRITEDATA, &s);
452+ res = curl_easy_perform (curl);
453+ LT_ASSERT_EQ (res, 0 );
454+ LT_CHECK_EQ (s, " 2" );
455+ curl_easy_cleanup (curl);
456+ }
457+
458+ #ifdef CASE_INSENSITIVE
459+ {
460+ string s;
461+ CURL *curl = curl_easy_init ();
462+ CURLcode res;
463+ curl_easy_setopt (curl, CURLOPT_URL, " localhost:" PORT_STRING " /OK" );
464+ curl_easy_setopt (curl, CURLOPT_HTTPGET, 1L );
465+ curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, writefunc);
466+ curl_easy_setopt (curl, CURLOPT_WRITEDATA, &s);
467+ res = curl_easy_perform (curl);
468+ LT_ASSERT_EQ (res, 0 );
469+ LT_CHECK_EQ (s, " 1" );
470+ curl_easy_cleanup (curl);
471+ }
472+
473+ {
474+ string s;
475+ CURL *curl = curl_easy_init ();
476+ CURLcode res;
477+ curl_easy_setopt (curl, CURLOPT_URL, " localhost:" PORT_STRING " /OK/" );
478+ curl_easy_setopt (curl, CURLOPT_HTTPGET, 1L );
479+ curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, writefunc);
480+ curl_easy_setopt (curl, CURLOPT_WRITEDATA, &s);
481+ res = curl_easy_perform (curl);
482+ LT_ASSERT_EQ (res, 0 );
483+ LT_CHECK_EQ (s, " 1" );
484+ curl_easy_cleanup (curl);
485+ }
486+
487+ {
488+ string s;
489+ CURL *curl = curl_easy_init ();
490+ CURLcode res;
491+ curl_easy_setopt (curl, CURLOPT_URL, " localhost:" PORT_STRING " /OK/go" );
492+ curl_easy_setopt (curl, CURLOPT_HTTPGET, 1L );
493+ curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, writefunc);
494+ curl_easy_setopt (curl, CURLOPT_WRITEDATA, &s);
495+ res = curl_easy_perform (curl);
496+ LT_ASSERT_EQ (res, 0 );
497+ LT_CHECK_EQ (s, " 2" );
498+ curl_easy_cleanup (curl);
499+ }
500+ #endif
501+ LT_END_AUTO_TEST (family_endpoints)
502+
409503LT_BEGIN_AUTO_TEST(basic_suite, overlapping_endpoints)
410504 // Setup two different resources that can both match the same URL.
411505 static_resource ok1(" 1" ), ok2(" 2" );
@@ -418,7 +512,7 @@ LT_BEGIN_AUTO_TEST(basic_suite, overlapping_endpoints)
418512 string s;
419513 CURL *curl = curl_easy_init ();
420514 CURLcode res;
421- curl_easy_setopt (curl, CURLOPT_URL, " localhost:8080 /foo/bar/" );
515+ curl_easy_setopt (curl, CURLOPT_URL, " localhost:" PORT_STRING " /foo/bar/" );
422516 curl_easy_setopt (curl, CURLOPT_HTTPGET, 1L );
423517 curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, writefunc);
424518 curl_easy_setopt (curl, CURLOPT_WRITEDATA, &s);
@@ -436,7 +530,7 @@ LT_BEGIN_AUTO_TEST(basic_suite, overlapping_endpoints)
436530 string s;
437531 CURL *curl = curl_easy_init ();
438532 CURLcode res;
439- curl_easy_setopt (curl, CURLOPT_URL, " localhost:8080 /foo/bar/" );
533+ curl_easy_setopt (curl, CURLOPT_URL, " localhost:" PORT_STRING " /foo/bar/" );
440534 curl_easy_setopt (curl, CURLOPT_HTTPGET, 1L );
441535 curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, writefunc);
442536 curl_easy_setopt (curl, CURLOPT_WRITEDATA, &s);
@@ -1267,7 +1361,7 @@ LT_BEGIN_AUTO_TEST(basic_suite, non_family_url_with_regex_like_pieces)
12671361 string s;
12681362 CURL *curl = curl_easy_init();
12691363 CURLcode res;
1270- curl_easy_setopt (curl, CURLOPT_URL, " localhost:8080 /settings/{}" );
1364+ curl_easy_setopt (curl, CURLOPT_URL, " localhost:" PORT_STRING " /settings/{}" );
12711365 curl_easy_setopt (curl, CURLOPT_HTTPGET, 1L );
12721366 curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, writefunc);
12731367 curl_easy_setopt (curl, CURLOPT_WRITEDATA, &s);
@@ -1290,7 +1384,7 @@ LT_BEGIN_AUTO_TEST(basic_suite, regex_url_exact_match)
12901384 string s;
12911385 CURL *curl = curl_easy_init ();
12921386 CURLcode res;
1293- curl_easy_setopt (curl, CURLOPT_URL, " localhost:8080 /foo/a/bar/" );
1387+ curl_easy_setopt (curl, CURLOPT_URL, " localhost:" PORT_STRING " /foo/a/bar/" );
12941388 curl_easy_setopt (curl, CURLOPT_HTTPGET, 1L );
12951389 curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, writefunc);
12961390 curl_easy_setopt (curl, CURLOPT_WRITEDATA, &s);
@@ -1309,7 +1403,7 @@ LT_BEGIN_AUTO_TEST(basic_suite, regex_url_exact_match)
13091403 string s;
13101404 CURL *curl = curl_easy_init ();
13111405 CURLcode res;
1312- curl_easy_setopt (curl, CURLOPT_URL, " localhost:8080 /foo/{v|[a-z]}/bar/" );
1406+ curl_easy_setopt (curl, CURLOPT_URL, " localhost:" PORT_STRING " /foo/{v|[a-z]}/bar/" );
13131407 curl_easy_setopt (curl, CURLOPT_HTTPGET, 1L );
13141408 curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, writefunc);
13151409 curl_easy_setopt (curl, CURLOPT_WRITEDATA, &s);
0 commit comments