microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
8.01k stars 1.65k forks source link

Why is web::uri::validate throwing on a perfect valid link that I can use in the browser? #1542

Open Xyncgas opened 3 years ago

Xyncgas commented 3 years ago

https://dynasty-scans.com/system/releases/000/024/483/[Yuri_Ichigo]_Tadokoro-san_c32_02.png Chrome.

Xyncgas commented 3 years ago

no I saw rfc3986, now do we have a method to escape these "reserved characters" in the library? other wise given any string which often is the case when you got a json file and read object's perma link which was created without escaping those characters which does happen because no current infrastructures or guidelines is general and adopted enough by the tools to stop people from doing this in the first place and that's likely never gonna happen, can you please make web::uri::validate to throw at least with some sort of message to point to a feature in library for people to use to encode these special characters ?

Xyncgas commented 3 years ago

https://stackoverflow.com/questions/154536/encode-decode-urls-in-c

garethsb commented 3 years ago

As per RFC 3986, paths cannot contain [ and ] characters, which fall under gen-delims not sub-delims. They would need to be percent-encoded as %5B and %5D. (Same answer as https://github.com/microsoft/cpprestsdk/issues/1272)

Use e.g. uri::encode_uri(path, uri::components::path).