From cb146b945fb95e93bcc7c942d0eac4572a60f48f Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Thu, 29 Dec 2016 16:02:19 +0100 Subject: [PATCH] IPv4 parser: handle the empty string This is a theoretical issue once #185 lands, but as discussed it seems good to address this anyway. Fixes #79. --- url.bs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/url.bs b/url.bs index 6696bd49..d65c67a3 100644 --- a/url.bs +++ b/url.bs @@ -464,8 +464,17 @@ runs these steps:
  • Let parts be input split on ".". -

  • If the last item in parts is the empty string, set - syntaxViolationFlag and remove the last item from parts. +

  • +

    If the last item in parts is the empty string, then: + +

      +
    1. Set syntaxViolationFlag. + +

    2. If parts has more than one item, then remove the last item from + parts. + +

  • If parts has more than four items, return input.