libcpr/cpr

Fully featured Url parser

Closed this issue · 1 comments

Is your feature request related to a problem?

When working with requests error handling in interceptors, when trying to find trusted CA by domain etc it's very inconvenient without complete Url parser.

While working with boost, I found it's Url parser very convenient and helpful.
I don't want to use any standalone uri parsers in my project or use boost, so when it comes to the need of replacing domain on failure or get linked CA from map<domain, ca> I have to create some string parsing crutches every time that of course can lead to errors due to not using complete Url parsing.

Possible Solution

Add something similar to this.
https://www.boost.org/doc/libs/1_84_0/libs/url/doc/html/url/urls/containers.html

Minimal musthave(set\get):
port
host (w/o protocol)
path
scheme(http\https\etc)

Session:
API work with current Url: set new Url, get url, get mutable reference(?)(so no need to get copy->modify copy->set new url)

Alternatives

No response

Additional Context

No response

COM8 commented

I think curl_url_set is the function you are looking for (https://curl.se/libcurl/c/curl_url_set.html).

Here is an example for getting the curl object:
#1057 (comment)