curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Change Curl_is_absolute_url to allow URI without authority

From: Aron Bergman via curl-library <curl-library_at_cool.haxx.se>
Date: Sat, 4 May 2019 12:37:26 +0200

>> I propose to change the check for a slash to instead check that the char isn’t a number.
>
> But why? Can you show us what benefit this brings to anyone?

As stated in the first mail, this will make it possible to use protocols which doesn’t use the authority component. I don’t think that any of the protocols that cURL currently implements will have any use of this change. I see it as more of a preemptive change for future protocol implementations. More specifically I’m thinking of the DNS protocol.

Two weeks ago, I decided to try to implement the DNS protocol into cURL as an exercise to learn more about the cURL internals and to get to know the DNS protocol better. Since the DNS protocol doesn’t require an authority in the URI, if the default name server for the computer should be used, I had to change the Curl_is_absolute_url function to allow such a URI. I haven’t really thought about whether cURL would actually like to have support for DNS, since there is already plenty of tools for that (e.g. dig and res_* functions). I never intended to push any code (at least not until I had a working implementation), but I felt like this change could be used by others in the future, irregardless of whether I were able to complete my exercise.

> To me it seems it will mostly just make curl think some strings are absulute URLs that it just can't parse and won't accept anyway?

Hmm, do you have any examples in mind? I have tested this (logically, not programmatically and only with the HTTP protocol, since I’m not too familiar with the structure of the other protocols implemented) and the proposed change would behave the same as the current implementation. So if I’m not completely wrong, all URIs that can be parsed today should be able to be parsed with the change.

Regards
Aron Bergman
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-05-04