-
Notifications
You must be signed in to change notification settings - Fork 192
Closed
Labels
bugConfirmed bugs or reports that are very likely to be bugs.Confirmed bugs or reports that are very likely to be bugs.
Description
Prerequisites
- Put an X between the brackets on this line if you have checked that your issue isn't already filed: https://github.com/search?l=&q=repo%3Aetr%2Flibhttpserver&type=Issues
Description
This test here is in error because that map is populated with the URL including the regexp pattern.
This results in a url that includes the same text as the regex pattern matching, even if that text isn't matched by the regex.
Steps to Reproduce
Add the following to test/integ/basic.cpp (2ea297f):
LT_BEGIN_AUTO_TEST(basic_suite, regex_url_exact_match)
ok_resource resource;
ws->register_resource("/foo/{v|[a-z]}/bar", &resource);
curl_global_init(CURL_GLOBAL_ALL);
string s;
CURL *curl = curl_easy_init();
CURLcode res;
// Exact string match for the registered pattern
curl_easy_setopt(curl, CURLOPT_URL, "localhost:8080/foo/{v|[a-z]}/bar/");
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writefunc);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &s);
res = curl_easy_perform(curl);
LT_ASSERT_EQ(res, 0);
int64_t http_code = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE , &http_code);
LT_ASSERT_EQ(http_code, 404); /// <<<<<<<<<<<<< This fails: 200!=404
curl_easy_cleanup(curl);
LT_END_AUTO_TEST(regex_url_exact_match)
Expected behavior: HTTP 404 (assuming the RE pattern doesn't match itself).
Actual behavior: HTTP 200
Reproduces how often: 100%
Versions
Current master branch
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugConfirmed bugs or reports that are very likely to be bugs.Confirmed bugs or reports that are very likely to be bugs.