Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL parser throws an exception #3138

Closed
marcalff opened this issue Nov 13, 2024 · 1 comment · Fixed by #3142
Closed

URL parser throws an exception #3138

marcalff opened this issue Nov 13, 2024 · 1 comment · Fixed by #3142
Labels
bug Something isn't working good first issue Good for newcomers help wanted Good for taking. Extra help will be provided by maintainers triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@marcalff
Copy link
Member

When parsing https://https://example.com/some/path, the URL parser throws an exception.

The expected result is to return a parse error instead.

diff --git a/ext/test/http/url_parser_test.cc b/ext/test/http/url_parser_test.cc
index aceb4396..118320e4 100644
--- a/ext/test/http/url_parser_test.cc
+++ b/ext/test/http/url_parser_test.cc
@@ -18,6 +18,13 @@ inline const char *BoolToString(bool b)
 TEST(UrlParserTests, BasicTests)
 {
   std::map<std::string, std::map<std::string, std::string>> urls_map{
+      {"https://https://example.com/some/path",
+       {{"host", "www.abc.com"},
+        {"port", "80"},
+        {"scheme", "http"},
+        {"path", "/"},
+        {"query", ""},
+        {"success", "true"}}},
       {"www.abc.com",
        {{"host", "www.abc.com"},
         {"port", "80"},
[malff@malff-desktop build-otelcpp-abiv1]$ ./ext/test/http/url_parser_test
Running main() from /builddir/build/BUILD/googletest-release-1.11.0/googletest/src/gtest_main.cc
[==========] Running 2 tests from 2 test suites.
[----------] Global test environment set-up.
[----------] 1 test from UrlParserTests
[ RUN      ] UrlParserTests.BasicTests
unknown file: Failure
C++ exception with description "stoi" thrown in the test body.
[  FAILED  ] UrlParserTests.BasicTests (0 ms)
[----------] 1 test from UrlParserTests (0 ms total)

[----------] 1 test from UrlDecoderTests
[ RUN      ] UrlDecoderTests.BasicTests
[       OK ] UrlDecoderTests.BasicTests (0 ms)
[----------] 1 test from UrlDecoderTests (0 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 2 test suites ran. (0 ms total)
[  PASSED  ] 1 test.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] UrlParserTests.BasicTests

 1 FAILED TEST
@marcalff marcalff added the bug Something isn't working label Nov 13, 2024
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Nov 13, 2024
@marcalff marcalff added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Nov 13, 2024
@marcalff marcalff added help wanted Good for taking. Extra help will be provided by maintainers good first issue Good for newcomers labels Nov 13, 2024
Copy link

This issue is available for anyone to work on. Make sure to reference this issue in your pull request.
✨ Thank you for your contribution! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Good for taking. Extra help will be provided by maintainers triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant