From 3c41b2d37d8a854678168445f3d2db7e9e4dba87 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 10 Mar 2017 09:56:15 +0100 Subject: [PATCH 1/2] Restrict setting protocol to "file" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As file URLs cannot have username/password/port we don’t want to allow changing the scheme of a URL that contains one or more of those components. Fixes #259. --- url.bs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/url.bs b/url.bs index ec35294e..8129944e 100644 --- a/url.bs +++ b/url.bs @@ -1490,6 +1490,9 @@ string input, optionally with a base URL base, opti

If state override is given, run these subsubsteps:

    +
  1. If url includes credentials or has a non-null port, + and buffer is "file", then return. +

  2. If url's scheme is a special scheme and buffer is not, then return. From a8ed8d2aefeec1e742490d08844c3d91a87e77fb Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 10 Mar 2017 12:12:21 +0100 Subject: [PATCH 2/2] Also account for switching away from "file" Fixes #270. --- url.bs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/url.bs b/url.bs index 8129944e..6c566e1d 100644 --- a/url.bs +++ b/url.bs @@ -1490,14 +1490,17 @@ string input, optionally with a base URL base, opti

    If state override is given, run these subsubsteps:

      -
    1. If url includes credentials or has a non-null port, - and buffer is "file", then return. -

    2. If url's scheme is a special scheme and buffer is not, then return.

    3. If url's scheme is not a special scheme and buffer is, then return. + +

    4. If url includes credentials or has a non-null port, + and buffer is "file", then return. + +

    5. If url's scheme is "file" and its + host is an empty host or null, then return.

  3. Set url's scheme to buffer.