<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>164508</bug_id>
          
          <creation_ts>2016-11-08 00:37:33 -0800</creation_ts>
          <short_desc>WebRTC: URL class can&apos;t parse ICE helper server urls properly</short_desc>
          <delta_ts>2023-06-12 09:04:32 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebRTC</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>143211</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Adam Bergkvist">adam.bergkvist</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>achristensen</cc>
    
    <cc>agouaillard</cc>
    
    <cc>alex</cc>
    
    <cc>annevk</cc>
    
    <cc>jonlee</cc>
    
    <cc>philn</cc>
    
    <cc>pnormand</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1249002</commentid>
    <comment_count>0</comment_count>
    <who name="Adam Bergkvist">adam.bergkvist</who>
    <bug_when>2016-11-08 00:37:33 -0800</bug_when>
    <thetext>WebKit&apos;s URL class can only parse the scheme part of a ICE helper server url. These urls have a host and a port but are not hierarchical [1].

The OpenWebRTC WebRTC backend (MediaEndpointOwr) currently extracts the original url string from the URL object and parses it again.

[1] https://tools.ietf.org/html/rfc7064#section-3.1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272398</commentid>
    <comment_count>1</comment_count>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2017-02-02 00:17:40 -0800</bug_when>
    <thetext>I just noticed this after having rewritten the URLParser.  Could you give an example of such a URL?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1274806</commentid>
    <comment_count>2</comment_count>
    <who name="Adam Bergkvist">adam.bergkvist</who>
    <bug_when>2017-02-09 04:38:59 -0800</bug_when>
    <thetext>The URI schemas are defined here [1][2].

A simple example is:
stun:stun1.example.net

[1] https://tools.ietf.org/html/rfc7064#section-3
[2] https://tools.ietf.org/html/rfc7065#section-3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1274911</commentid>
    <comment_count>3</comment_count>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2017-02-09 10:28:40 -0800</bug_when>
    <thetext>&lt;script&gt;
try {
    var u = new URL(&quot;stun:stun1.example.net&quot;);
    alert(&quot;scheme &quot; + u.scheme);
    alert(&quot;host &quot; + u.host);
    alert(&quot;pathname &quot; + u.pathname);
} catch (e) { alert(&quot;threw&quot;); }
&lt;/script&gt;

This behaves the same in Chrome, Firefox, and Safari.  Are you expecting the host to be stun1.example.net?  What problems are actually caused by this?  It&apos;s possible we will need to revise either the URL grammar or the grammars defined in those RFCs.  We definitely need to keep the URL object&apos;s behavior for schemes like mailto, though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1275243</commentid>
    <comment_count>4</comment_count>
    <who name="Adam Bergkvist">adam.bergkvist</who>
    <bug_when>2017-02-10 00:11:41 -0800</bug_when>
    <thetext>I was a bit unclear in the bug title, but I was referring to the cpp class URL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1343126</commentid>
    <comment_count>5</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2017-08-29 09:52:01 -0700</bug_when>
    <thetext>&lt;rdar://problem/34134444&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1343271</commentid>
    <comment_count>6</comment_count>
    <who name="Jon Lee">jonlee</who>
    <bug_when>2017-08-29 15:44:38 -0700</bug_when>
    <thetext>Is this still a valid bug?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1343472</commentid>
    <comment_count>7</comment_count>
    <who name="Adam Bergkvist">adam.bergkvist</who>
    <bug_when>2017-08-29 23:57:21 -0700</bug_when>
    <thetext>I don&apos;t have a build available to test at the moment.

For example in [1], the ICE helper server urls are parsed to WebKit URLs. Host and port are not parsed correctly.

[1] https://github.com/WebKit/webkit/blob/master/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp#L305</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1945933</commentid>
    <comment_count>8</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2023-04-01 01:06:03 -0700</bug_when>
    <thetext>This is tracked by https://github.com/w3c/webrtc-pc/issues/2660 standards-wise.

How does OpenWebRTC parse it?

I agree that RTCPeerConnection::iceServersFromConfiguration doesn&apos;t robust in the face of how these URLs are parsed by the URL parser.

(Note that the cpp class and JavaScript class should behave equivalently. We don&apos;t want them to diverge.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1945958</commentid>
    <comment_count>9</comment_count>
    <who name="Philippe Normand">philn</who>
    <bug_when>2023-04-01 07:35:05 -0700</bug_when>
    <thetext>(In reply to Anne van Kesteren from comment #8)
&gt; This is tracked by https://github.com/w3c/webrtc-pc/issues/2660
&gt; standards-wise.
&gt; 
&gt; How does OpenWebRTC parse it?

OpenWebRTC is no longer maintained. The corresponding backend was removed from webKit soon after the migration to libwebrtc was completed.

The WPE/GTK ports rely on a different backend, based on GstWebRTC.
In GStreamerMediaEndpoint::setConfiguration() we replace `stun:` with `stun://` (same for turn:) and pass the result to the WebKit URL parser. This is a workaround indeed :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1946052</commentid>
    <comment_count>10</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2023-04-02 08:28:13 -0700</bug_when>
    <thetext>That will do the wrong thing most likely for IPv4 and a variety of non-ASCII or percent-encoded host names.

I think what we want to do is something like this:

* Let inputURL be the result of URL parsing input.
* If inputURL is failure, then return failure.
* If inputURL&apos;s scheme is not &quot;stun&quot; or &quot;turn&quot;, then return failure.
* If inputURL&apos;s path is not an opaque path, then return failure.
* If inputURL&apos;s query or fragment is non-null, then return failure.
* Let hostAndPortString be inputURL&apos;s path.
* Let hostAndPortURL be the result of URL parsing the concatenation of &quot;https://&quot; and hostAndPortURL.
* If hostAndPortURL is failure, then return failure.
* Return (hostAndPortURL&apos;s host, hostAndPortURL&apos;s port).

(The URL Standard should probably offer a primitive for the hostAndPort bit, that&apos;s not exactly pretty.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1961060</commentid>
    <comment_count>11</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2023-06-12 09:04:32 -0700</bug_when>
    <thetext>https://w3c.github.io/webrtc-pc/#set-pc-configuration (step 4) defines parsing now in a way that is compatible with URLs.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>