Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change path parsing for non-special URLs #213

Merged
merged 2 commits into from
Jan 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 35 additions & 10 deletions url.bs
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,9 @@ null or a 16-bit unsigned integer that identifies a networking port. It is initi
<a>ASCII strings</a> holding data, usually identifying a location in hierarchical form. It is
initially the empty list.

<p class="note no-backref">A <a lt="is special">special</a> <a for=/>URL</a> always has a
<a for=list lt="is empty">non-empty</a> <a for=url>path</a>.

<p>A <a for=/>URL</a>'s <dfn export for=url id=concept-url-query>query</dfn> is either
null or an <a>ASCII string</a> holding data. It is initially null.

Expand Down Expand Up @@ -1512,15 +1515,18 @@ string <var>input</var>, optionally with a <a>base URL</a> <var>base</var>, opti
<dd>
<ol>
<li>
<p>If either <a>c</a> is "<code>/</code>", or <var>url</var> <a>is special</a> and
<a>c</a> is "<code>\</code>", run these substeps:
<p>If <var>url</var> <a>is special</a> and <a>c</a> is "<code>/</code>" or "<code>\</code>",
then:

<ol>
<li><p>If <a>c</a> is "<code>\</code>", <a>syntax violation</a>.

<li><p>Set <var>state</var> to <a>special authority ignore slashes state</a>.
</ol>

<li><p>Otherwise, if <a>c</a> is "<code>/</code>", then set <var>state</var> to
<a>authority state</a>.

<li><p>Otherwise, set
<var>url</var>'s <a for=url>username</a> to
<var>base</var>'s <a for=url>username</a>,
Expand Down Expand Up @@ -1877,12 +1883,29 @@ string <var>input</var>, optionally with a <a>base URL</a> <var>base</var>, opti
<dt><dfn>path start state</dfn>
<dd>
<ol>
<li><p>If <var>url</var> <a>is special</a> and <a>c</a> is "<code>\</code>",
<a>syntax violation</a>.
<li>
<p>If <var>url</var> <a>is special</a>, then:

<ol>
<li><p>If <a>c</a> is "<code>\</code>", <a>syntax violation</a>.

<li><p>Set <var>state</var> to <a>path state</a>, and if neither <a>c</a> is
"<code>/</code>", nor <var>url</var> <a>is special</a> and <a>c</a> is
"<code>\</code>", decrease <var>pointer</var> by one.
<li><p>Set <var>state</var> to <a>path state</a>.

<li><p>If <a>c</a> is neither "<code>/</code>" nor "<code>\</code>", then decrease
<var>pointer</var> by one.
</ol>

<li><p>Otherwise, if <var>state override</var> is not given and <a>c</a> is "<code>?</code>",
then set <var>url</var>'s <a for=url>query</a> to the empty string and <var>state</var> to
<a>query state</a>.

<li><p>Otherwise, if <var>state override</var> is not given and <a>c</a> is "<code>#</code>",
then set <var>url</var>'s <a for=url>fragment</a> to the empty string and <var>state</var> to
<a>fragment state</a>.

<li><p>Otherwise, if <a>c</a> is not <a>EOF code point</a>, then: set <var>state</var> to
<a>path state</a> and if <a>c</a> is not "<code>/</code>", then decrease <var>pointer</var> by
one.
</ol>

<dt><dfn>path state</dfn>
Expand Down Expand Up @@ -2141,9 +2164,8 @@ then runs these steps:
<li><p>If <var>url</var>'s <a for=url>cannot-be-a-base-URL flag</a> is set, append the first string
in <var>url</var>'s <a for=url>path</a> to <var>output</var>.

<li><p>Otherwise, append "<code>/</code>", followed by the strings in <var>url</var>'s
<a for=url>path</a> (including empty strings), if any, separated from each other by
"<code>/</code>", to <var>output</var>.
<li><p>Otherwise, then <a for=list>for each</a> string in <var>url</var>'s <a for=url>path</a>,
append "<code>/</code>" followed by the string to <var>output</var>.

<li><p>If <var>url</var>'s <a for=url>query</a> is non-null, append
"<code>?</code>", followed by <var>url</var>'s <a for=url>query</a>, to
Expand Down Expand Up @@ -2692,6 +2714,9 @@ the setter to always "reset" both.
<li><p>If <a>context object</a>'s <a for=URL>url</a>'s <a for=url>cannot-be-a-base-URL flag</a> is
set, then return <a>context object</a>'s <a for=URL>url</a>'s <a for=url>path</a>[0].

<li><p>If <a>context object</a>'s <a for=URL>url</a>'s <a for=url>path</a>
<a for=list>is empty</a>, then return the empty string.

<li><p>Return "<code>/</code>", followed by the strings in <a>context object</a>'s
<a for=URL>url</a>'s <a for=url>path</a> (including empty strings), if any, separated from each
other by "<code>/</code>".
Expand Down