@@ -276,6 +276,10 @@ defmodule URI do
276
276
@ doc """
277
277
Parses a URI into components.
278
278
279
+ This parsing is not strict and therefore does not validate the URI.
280
+ See the examples section below of how `URI.parse/1` can be used to
281
+ parse a wide range of relative URIs.
282
+
279
283
URIs have portions that are handled specially for the particular
280
284
scheme of the URI. For example, http and https have different
281
285
default ports. Such values can be accessed and registered via
@@ -288,6 +292,18 @@ defmodule URI do
288
292
authority: "elixir-lang.org", userinfo: nil,
289
293
host: "elixir-lang.org", port: 80}
290
294
295
+ iex> URI.parse("//elixir-lang.org/")
296
+ %URI{authority: "elixir-lang.org", fragment: nil, host: "elixir-lang.org",
297
+ path: "/", port: nil, query: nil, scheme: nil, userinfo: nil}
298
+
299
+ iex> URI.parse("/foo/bar")
300
+ %URI{authority: nil, fragment: nil, host: nil, path: "/foo/bar",
301
+ port: nil, query: nil, scheme: nil, userinfo: nil}
302
+
303
+ iex> URI.parse("foo/bar")
304
+ %URI{authority: nil, fragment: nil, host: nil, path: "foo/bar",
305
+ port: nil, query: nil, scheme: nil, userinfo: nil}
306
+
291
307
"""
292
308
def parse ( % URI { } = uri ) , do: uri
293
309
0 commit comments