cpprestsdk icon indicating copy to clipboard operation
cpprestsdk copied to clipboard

web::uri::validate returns false on uri with "":"" in query

Open zamx opened this issue 4 years ago • 1 comments

web::uri::validate() wrongly assumes uri foo?bar=foo:bar is a absolute path because of the ":" in the query. RFC-3986 allows queries to contain ":".

zamx avatar Jun 21 '21 12:06 zamx

I think you're right, I believe your example is a valid relative-ref.

Per RFC 3986 section 4.2:

relative-ref  = relative-part [ "?" query ] [ "#" fragment ]

Therefore, probably https://github.com/microsoft/cpprestsdk/blob/bfe34877914fd280512c97d41aaa99e88564fd8d/Release/src/uri/uri.cpp#L180 needs to also stop at ? or #...

An example like yours should be added to the test cases near relative_ref_string... https://github.com/microsoft/cpprestsdk/blob/bfe34877914fd280512c97d41aaa99e88564fd8d/Release/tests/functional/uri/constructor_tests.cpp#L73

Edit: I now have a test case and fix, so I'll make a PR later.

garethsb avatar Jul 01 '21 13:07 garethsb