Skip to content

Commit b740164

Browse files
author
Paul M. Jones
committed
Merge pull request #510 from Tobion/uri-ref-edge-cases
[PSR-7] fix delimiters for scheme/authority and edge cases with path
2 parents 68fb8d2 + 672adc0 commit b740164

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

proposed/http-message.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,14 +1613,17 @@ interface UriInterface
16131613
* Section 4.1. The method concatenates the various components of the URI,
16141614
* using the appropriate delimiters:
16151615
*
1616-
* - If a scheme is present, "://" MUST append the value.
1617-
* - If the authority information is present, that value will be
1618-
* concatenated.
1619-
* - If the path is rootless and the authority information is present, the
1620-
* path MUST be prefixed by a "/" character. Otherwise, the path can be
1621-
* concatenated without additional delimiters.
1622-
* - If a query string is present, it MUST be prefixed by a "?" character.
1623-
* - If a URI fragment is present, it MUST be prefixed by a "#" character.
1616+
* - If a scheme is present, it MUST be suffixed by ":".
1617+
* - If an authority is present, it MUST be prefixed by "//".
1618+
* - The path can be concatenated without delimiters. But there are two
1619+
* cases where the path has to be adjusted to make the URI reference
1620+
* valid as PHP does not allow to throw an exception in __toString():
1621+
* - If the path is rootless and an authority is present, the path MUST
1622+
* be prefixed by "/".
1623+
* - If the path is starting with more than one "/" and no authority is
1624+
* present, the starting slashes MUST be reduced to one.
1625+
* - If a query is present, it MUST be prefixed by "?".
1626+
* - If a fragment is present, it MUST be prefixed by "#".
16241627
*
16251628
* @see http://tools.ietf.org/html/rfc3986#section-4.1
16261629
* @return string

0 commit comments

Comments
 (0)