You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
We’ve had some hairy issues with the code in mbgl::util::mapbox that relies on artisanal string parsing to manipulate URL components. For example: #5554#5723. At one point, it was manageable because we were only manipulating schemes and paths. But increasingly we need to work with query parameters as well (#6182). I guess I’m spoiled by the robustness of URL on the Web and NSURL and NSURLComponents on Apple platforms, which provide object-oriented, RFC-compliant URL parsing. Could we make mbgl::util::mapbox depend on a similarly robust, well-tested URL parsing library for C++?
I'd love to use a well-tested URL parsing library for C++, providing it meets other quality metrics. The uri class from cpp-netlib seems to be the leading contender. I can't find any official API reference for it, but it was the basis for a standards proposal and there is standalone code floating about.
It looks promising, but I also see some warning signs. We'd probably need to devote some time to trying it out and seeing if it meets our quality bar, or whether we'd need to write something from scratch.
I wonder how much trouble it would be to extract WebCore::URLParser from the WebKit project. It depends on WTF for a StringBuilder class, but that doesn’t seem like a showstopper.
Edit: Never mind, that particular implementation looks very new. But maybe one of the browser projects has something ready-made.
How about http-parser. It has a function called http_parser_parse_url. Since it is used by Nodejs, so we can keep consistency with mapbox-gl-js in URL handling
As far as the scope of this goes: Do we need Punycode parsing/normalization? IPv6 IP support? Auth (https://foo:[email protected]) handling?
Another thing I was worried about is an object-oriented, RFC-compliant URL parsing library would be too heavy for Mapbox GL Native. Benchmarks would also affected. So I would rather suggest to keep it simple.
@kkaefer I do not think we need these Punycode staff features until some use cases come out.
Activity
jfirebaugh commentedon Aug 26, 2016
I'd love to use a well-tested URL parsing library for C++, providing it meets other quality metrics. The
uriclass from cpp-netlib seems to be the leading contender. I can't find any official API reference for it, but it was the basis for a standards proposal and there is standalone code floating about.It looks promising, but I also see some warning signs. We'd probably need to devote some time to trying it out and seeing if it meets our quality bar, or whether we'd need to write something from scratch.
1ec5 commentedon Aug 29, 2016
I wonder how much trouble it would be to extract
WebCore::URLParserfrom the WebKit project. It depends on WTF for a StringBuilder class, but that doesn’t seem like a showstopper.Edit: Never mind, that particular implementation looks very new. But maybe one of the browser projects has something ready-made.
springmeyer commentedon Sep 26, 2016
Does not appear maintained, so not a viable contender (https://github.com/bnoordhuis/uriparser2), but dropping here nonetheless for reference.
jingsam commentedon Sep 27, 2016
How about http-parser. It has a function called
http_parser_parse_url. Since it is used by Nodejs, so we can keep consistency with mapbox-gl-js in URL handlingkkaefer commentedon Sep 27, 2016
Node.js'
urlmodule parsing functionality is done in https://github.com/nodejs/node/blob/master/lib/url.js, and mapbox-gl-js doesn't use Node.js at all since it's typically run in the browser. That being said, we could look at porting the JavaScript code in Node.js to C++.As far as the scope of this goes: Do we need Punycode parsing/normalization? IPv6 IP support? Auth (
https://foo:[email protected]) handling?jingsam commentedon Sep 27, 2016
Another thing I was worried about is an object-oriented, RFC-compliant URL parsing library would be too heavy for Mapbox GL Native. Benchmarks would also affected. So I would rather suggest to keep it simple.
@kkaefer I do not think we need these Punycode staff features until some use cases come out.
jfirebaugh commentedon Feb 11, 2017
Good here with #7464.
kkaefer commentedon Sep 10, 2018
https://daniel.haxx.se/blog/2018/09/09/libcurl-gets-a-url-api/