On 27/06/2022 14:10, Pierrick Charron wrote:
The purpose of the CurlUrl class is to be able to build/see/modify an URL
as it is seen by libcurl before/after passing it to your CurlHandle. It is
not meant to be used alone as a representation of an URL.

For example, you may want to do some checks to make sure that the URL you
gave to your CurlHandle is well formatted and that the host or any other
parts are what you want them to be, and that it was not something else
because of some differences on how the URL was parsed. Or you may want to
add/delete/overwrite some parts to sanitize your URL. That's why you have
those setters/getters. This class is definitively not there to replace
PSR-7 UriInterface. I can imagine some Guzzle or other implementation to
build a CurlUrl handle from a UriInterface before giving it to curl.


This leaves me a bit baffled, frankly.

If I've got a URL, which is already a string, what code would I write to "do some checks" on it, outside of a unit test?

If I'm using CurlUrl to "add/delete/overwrite some parts" how is that not "using it alone as a representation of an URL"?

If I'm writing a PSR-7 object, am I only supposed to use CurlUrl when interfacing with curl, and generate the string myself for other purposes? If the implementation I come up with differs from curl's, how does the user know which is the "real" URL?


Regards,

--
Rowan Tommins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to