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

Use empty host for file URL's #260

Merged
merged 9 commits into from
Mar 7, 2017
20 changes: 11 additions & 9 deletions url.bs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ point <a for=/>URLs</a> from <var>A</var> can come from untrusted sources.
<h3 id=host-representation>Host representation</h3>

<p>A <dfn export id=concept-host>host</dfn> is a <a>domain</a>, an
<a>IPv4 address</a>, an <a>IPv6 address</a>, or an <a>opaque host</a>. Typically a <a for=/>host</a>
<a>IPv4 address</a>, an <a>IPv6 address</a>, an <a>opaque host</a>, or an <a>empty host</a>. Typically a <a for=/>host</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't meet the 100 column wrapping requirements.

serves as a network address, but it is sometimes used as opaque identifier in <a for=/>URLs</a>
where a network address is not necessary.

Expand All @@ -280,12 +280,14 @@ eight <dfn id=concept-ipv6-piece lt='IPv6 piece'>16-bit pieces</dfn>.
<p class="note">Support for <code>&lt;zone_id></code> is
<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=27234#c2">intentionally omitted</a>.

<p>An <dfn export>opaque host</dfn> is an <a>ASCII string</a> holding data that can be used for
<p>An <dfn export>opaque host</dfn> is a non-empty <a>ASCII string</a> holding data that can be used for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, I think.

further processing.

<p class="note no-backref">An <a>opaque host</a> is only used by <a lt="is special">non-special</a>
<a for=/>URLs</a>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think either we should have a note like this for empty hosts too or we should drop this one, no?


<p>An <dfn export>empty host</dfn> is the empty string.


<h3 id=host-miscellaneous>Host miscellaneous</h3>

Expand Down Expand Up @@ -383,7 +385,7 @@ up to three <a>ASCII digits</a> per sequence, each representing a decimal number

XXX should we define the format inline instead just like STD 66? -->

<p>An <dfn export>valid opaque-host string</dfn> must be zero or more <a>URL units</a> or:
<p>An <dfn export>valid opaque-host string</dfn> must be one or more <a>URL units</a> or:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change "An" to "A" here while we're changing this? I can also do it before merging.

"<code>[</code>", followed by a <a>valid IPv6-address string</a>, followed by "<code>]</code>".

<p class="note no-backref">This is not part of the definition of <a>valid host string</a> as it
Expand Down Expand Up @@ -768,7 +770,7 @@ no purpose other than being a location the algorithm can jump to.
<a>IPv6 serializer</a> on <var>host</var>,
followed by "<code>]</code>".

<li><p>Otherwise, <var>host</var> is a <a>domain</a> or <a>opaque host</a>, return <var>host</var>.
<li><p>Otherwise, <var>host</var> is a <a>domain</a>, an <a>opaque host</a>, or an <a>empty host</a>, return <var>host</var>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

</ol>

The <dfn id=concept-ipv4-serializer>IPv4 serializer</dfn> takes an
Expand Down Expand Up @@ -1172,9 +1174,9 @@ switching on <a>base URL</a>'s <a for=url>scheme</a>:
<dd><p>a <a>path-relative-scheme-less-URL string</a>
<dt>"<code>file</code>"
<dd><p>a <a>scheme-relative-file-URL string</a>
<dd><p>a <a>path-absolute-URL string</a> if <a>base URL</a>'s <a for=url>host</a> is null
<dd><p>a <a>path-absolute-URL string</a> if <a>base URL</a>'s <a for=url>host</a> is either null or the empty string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should say "an empty host" I think. A base URL is a URL record after all. But also, I thought the idea was that for file URLs the host could never be null so then we should leave that out too.

<dd><p>a <a>path-absolute-non-Windows-file-URL string</a> if <a>base URL</a>'s <a for=url>host</a>
is non-null
is non-empty string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not always a string though. It could be an IPv4 address.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably just say not an empty host.

<dd><p>a <a>path-relative-scheme-less-URL string</a>
<dt>Otherwise
<dd><p>a <a>scheme-relative-URL string</a>
Expand All @@ -1199,7 +1201,7 @@ optionally followed by a <a>path-absolute-URL string</a>.
<a>path-absolute-URL string</a>.

<p>An <dfn export>opaque-host-and-port string</dfn> must be either an empty
<a>valid opaque-host string</a> or: a non-empty <a>valid opaque-host string</a>, optionally followed
string or: a <a>valid opaque-host string</a>, optionally followed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's "the empty string" (and an empty host).

by "<code>:</code>" and a <a>URL-port string</a>.

<p>A <dfn export oldids=syntax-url-file-scheme-relative>scheme-relative-file-URL string</dfn> must be
Expand Down Expand Up @@ -2066,10 +2068,10 @@ string <var>input</var>, optionally with a <a>base URL</a> <var>base</var>, opti
<a>Windows drive letter</a>, then:

<ol>
<li><p>If <var>url</var>'s <a for=url>host</a> is non-null,
<li><p>If <var>url</var>'s <a for=url>host</a> is not the empty string,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here again we're talking about a URL record so we should say "not an empty host". Same below.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both an empty host and an opaque host are strings by definition. So maybe it's fine to set host to the empty string in the parser? For example the opaque host parser returns string, but not an opaque host record.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, I guess some level of implicit casting is probably okay.

<a>validation error</a>.

<li><p>Set <var>url</var>'s <a for=url>host</a> to null and replace the second
<li><p>Set <var>url</var>'s <a for=url>host</a> to the empty string and replace the second
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is >100 columns. "second" needs to go to the next line.

code point in <var>buffer</var> with "<code>:</code>".
</ol>

Expand Down