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 the url spec to parse ice server urls. #2694

Closed
wants to merge 6 commits into from
Closed
Changes from 2 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
74 changes: 47 additions & 27 deletions webrtc.html
Original file line number Diff line number Diff line change
Expand Up @@ -3124,30 +3124,51 @@ <h4>
</p>
<ol>
<li>
<p>
Parse the <var>url</var> using the generic URI syntax
defined in [[!RFC3986]] and obtain the <var>scheme
name</var>. If the parsing based on the syntax
defined in [[!RFC3986]] fails, [= exception/throw =]
a {{SyntaxError}}. If the <var>scheme name</var> is
not implemented by the browser [= exception/throw =]
a {{NotSupportedError}}. If <var>scheme name</var> is
<code class="scheme">turn</code> or <code class=
"scheme">turns</code>, and parsing the <var>url</var>
using the syntax defined in [[!RFC7065]] fails, [=
exception/throw =] a {{SyntaxError}}. If <var>scheme
name</var> is <code class="scheme">stun</code> or
<code class="scheme">stuns</code>, and parsing the
<var>url</var> using the syntax defined in
[[!RFC7064]] fails, [= exception/throw =] a
{{SyntaxError}}.
</p>
<p>Let <var>parsedURL</var> be the result of
<a data-cite="!url#concept-url-parser">parsing</a>
<var>url</var> with <code>null</code>.</p>
</li>
<li>
<p>If <var>parsedURL</var> is failure, then
[= exception/throw =] a {{SyntaxError}}.
jan-ivar marked this conversation as resolved.
Show resolved Hide resolved
</li>
<li>
<p>If <var>parsedURL</var>
<a data-cite="!url#include-credentials">includes
credentials</a>, then [= exception/throw =] a
{{SyntaxError}}.
</li>
<li>
<p>Let <var>scheme</var> be <var>parsedURL</var>'s
<a data-cite="!url#concept-url-scheme">scheme</a>.</p>
</li>
<li>
<p>If <var>scheme</var> is neither <code>stun</code>,
jan-ivar marked this conversation as resolved.
Show resolved Hide resolved
<code>stuns</code>, <code>turn</code>, nor
<code>turns</code>, then [= exception/throw =] a
{{SyntaxError}}.</p>
</li>
<li>
<p>If <var>scheme</var> is not implemented by the
user agent, then [= exception/throw =]
a {{NotSupportedError}}.
jan-ivar marked this conversation as resolved.
Show resolved Hide resolved
</li>
<li>
<p>If <var>scheme</var> is <code>stun</code> or
<code>stuns</code>, and <var>parsedURL</var> violates
the syntax defined in [[!RFC7064]] section 3.1,
then [= exception/throw =] a {{SyntaxError}}.</p>
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 work as parsedURL is a data structure. How is this implemented?

Copy link
Member Author

Choose a reason for hiding this comment

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

This tries to preserve the existing normative language. I shold s/parsedURL/url/ again perhaps. As I mention in the OP, looking for ideas on how to specify the requirements using the URL spec. We want to prevent hierarchical urls, e.g. stun:foo.bar.com:1234

Copy link
Member Author

Choose a reason for hiding this comment

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

In Firefox, this is implemented here.

Copy link
Member

Choose a reason for hiding this comment

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

That URL isn't hierarchical though, is it? Hierarchical URLs contain slashes, as far as I know.

It sounds like you want https://url.spec.whatwg.org/#url-opaque-path to be true, although you wouldn't have to check for credentials in that case.

And then as per the Firefox code you'd have to parse parsedURL's path (which will be a string in this case) in a custom manner to obtain the host and port (split on :, then handle each?). Potentially this logic could be shared with the URL Standard in some way.

And then you'd handle the parsedURL's query as per Firefox logic for the query.

</li>
<li>
<p>If <var>scheme</var> is <code>turn</code> or
<code>turns</code>, and <var>parsedURL</var> violates
the syntax defined in [[!RFC7065]] section 3.1,
[= exception/throw =] a {{SyntaxError}}.</p>
</li>
<li>
<p>
If <var>scheme name</var> is <code class=
"scheme">turn</code> or <code class=
"scheme">turns</code>, and either of
If <var>scheme</var> is <code>turn</code> or
<code>turns</code>, and either of
<var>server</var>.{{RTCIceServer/username}} or
<var>server</var>.{{RTCIceServer/credential}} are
omitted, then [= exception/throw =] an
Expand All @@ -3156,14 +3177,13 @@ <h4>
</li>
<li>
<p>
If <var>scheme name</var> is <code class=
"scheme">turn</code> or <code class=
"scheme">turns</code>, and
If <var>scheme</var> is <code>turn</code> or
<code>turns</code>, and
<var>server</var>.{{RTCIceServer/credentialType}} is
{{RTCIceCredentialType/"password"}}, and
<var>server</var>.{{RTCIceServer/credential}} is not
a <span class="idlMemberType">DOMString</span>, then
[= exception/throw =] an {{InvalidAccessError}}.
<var>server</var>.{{RTCIceServer/credential}} is
<code>""</code>, then [= exception/throw =] an
{{InvalidAccessError}}.
</p>
</li>
</ol>
Expand Down