From e3370f18eec1012c72c628f48819f33707daef8a 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 88845f18..c7c94aad 100644 --- a/url.bs +++ b/url.bs @@ -450,8 +450,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.