Merge pull request #510 from Tobion/uri-ref-edge-cases

[PSR-7] fix delimiters for scheme/authority and edge cases with path
This commit is contained in:
Paul M. Jones
2015-04-13 08:32:25 -05:00

View File

@@ -1613,14 +1613,17 @@ interface UriInterface
* using the appropriate delimiters:
*
* - If a scheme is present, it MUST be suffixed by ":".
* - If the authority information is present, that value will be
* concatenated.
* - If the path is rootless and the authority information is present, the
* path MUST be prefixed by a "/" character. Otherwise, the path can be
* concatenated without additional delimiters.
* - If a query string is present, it MUST be prefixed by a "?" character.
* - If a URI fragment is present, it MUST be prefixed by a "#" character.
*
* - If an authority is present, it MUST be prefixed by "//".
* - The path can be concatenated without delimiters. But there are two
* cases where the path has to be adjusted to make the URI reference
* valid as PHP does not allow to throw an exception in __toString():
* - If the path is rootless and an authority is present, the path MUST
* be prefixed by "/".
* - If the path is starting with more than one "/" and no authority is
* present, the starting slashes MUST be reduced to one.
* - If a query is present, it MUST be prefixed by "?".
* - If a fragment is present, it MUST be prefixed by "#".
*
* @see http://tools.ietf.org/html/rfc3986#section-4.1
* @return string
*/