Bumping up this discussion as it seems it was overlooked/forgotten.
@Larry did our responses correctly answer your concerns? If so can this be
put into vote. If not what still need to be addressed ? What changes do you
want tobion to make to his PR. FWIW there was an alternative to this
proposal here
Ignace
Le jeudi 9 juin 2016 14:21:15 UTC+2, ignace nyamagana a écrit :
>
> Yep, but adding a default host is trying to solve a educational problem
> with something I'd consider being a hack. Better let the developer
> understand why it fails and learn from it too.
>
> my .2$
>
> Le jeudi 9 juin 2016 00:12:50 UTC+2, Tobion a écrit :
>>
>> Yep. But that creates the problem that in theory one of the most common
>> approaches would turn invalid:
>>
>> (new Uri)->withScheme('http')->withHost('example.org');
>>
>>
>> This would be invalid if you enforce that because the moment the URI has
>> the http scheme, there is no host yet.
>> To avoid this problem I proposed for guzzle/psr7 to just define localhost
>> as default host for http(s) URIs when
>> there is no host yet. See https://github.com/guzzle/psr7/pull/94
>>
>> This also makes sure that you can call
>>
>> $uri->withPort(8080)->withHost('host')
>>
>> whatever the scheme might be.
>>
>> Am Mittwoch, 8. Juni 2016 22:02:13 UTC+2 schrieb Matthew Weier O'Phinney:
>>>
>>> On Mon, Jun 6, 2016 at 4:29 AM, Tobion <[email protected]> wrote:
>>> > https://tools.ietf.org/html/rfc3986#appendix-A
>>> >
>>> >
>>> > authority = [ userinfo "@" ] host [ ":" port ]
>>> >
>>> > host = IP-literal / IPv4address / reg-name
>>> >
>>> > reg-name = *( unreserved / pct-encoded / sub-delims )
>>> >
>>> >
>>> > As you can see reg-name can be empty which means the host can be empty
>>> which
>>> > means
>>> >
>>> > "urn://user:pass@:123/path" is a valid URI. The reasoning is also
>>> given:
>>> >
>>> >
>>> > https://tools.ietf.org/html/rfc3986#section-3.2.2
>>> >
>>> >> If the URI scheme defines a default for host,
>>>
>>> That's the key phrase, then. HTTP and HTTPS, which are the only
>>> schemes supported by UriInterface, do not define defaults for the
>>> host, which would make lack of a host an invalid URI for those
>>> schemes.
>>>
>>> --
>>> Matthew Weier O'Phinney
>>> [email protected]
>>> https://mwop.net/
>>>
>>
--
You received this message because you are subscribed to the Google Groups "PHP
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/php-fig/013686ad-2615-4caf-a663-f69e5bdebe2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.