#1224: Support for protocol relative URL generation
-----------------------------------------------------------------+----------
Reporter: graste |
Owner: dominik
Type: enhancement |
Status: closed
Priority: normal |
Milestone: 1.0.3
Component: routing |
Version: 1.0.2
Severity: normal |
Resolution: wontfix
Keywords: routing route scheme generate protocol relative url |
Has_patch: 0
-----------------------------------------------------------------+----------
Changes (by david):
* status: new => closed
* resolution: => wontfix
Comment:
This is in violation of [http://www.apps.ietf.org/rfc/rfc3986.html#sec-3
RFC 3986 Section 3], which states (emphasis is mine):
The generic URI syntax consists of a hierarchical sequence of components
referred to as the scheme, authority, path, query, and fragment.
{{{
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
}}}
'''The scheme and path components are required''', though the path may
be empty (no characters). When authority is present, the path must either
be empty or begin with a slash ("/") character. When authority is not
present, the path cannot begin with two slash characters ("//"). These
restrictions result in five different ABNF rules for a path (Section 3.3),
only one of which will match any given URI reference.
You [http://twitter.com/mivesto/status/9111701878 said on Twitter] that
[http://www.stevesouders.com/blog/2010/02/10/5a-missing-schema-double-
download/ this article] caused you to look into this problem. This is not
an issue in Agavi, as you can (and should) generate a {{{<base href />}}}
element in the document {{{<head>}}}, which for HTTPS requests will
contain the HTTPS prefix and thus cause your relative URLs to work just
fine.
You mentioned [http://www.apps.ietf.org/rfc/rfc3986.html#sec-3 RFC 3986
Section 5.3] which contains pseudocode where the scheme is optional, but
this part is in [http://www.apps.ietf.org/rfc/rfc3986.html#sec-3 RFC 3986
Section 5]:
'''Reference Resolution'''
This section defines the process of resolving a URI reference within a
context that allows relative references so that the result is a string
matching the <URI> syntax rule of Section 3.
In other words, the spec does what all good specs mandate and all good
implementations should follow:
[http://en.wikipedia.org/wiki/Robustness_principle Postel's Law]:
Be conservative in what you do; be liberal in what you accept from
others.
--
Ticket URL: <http://trac.agavi.org/ticket/1224#comment:1>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5
_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets