Skip to content

Commit 398a20e

Browse files
authored
Fix port-part matches algorithm for a null port input (#435)
The algorithm was expecting a non-null possibly-empty string while being called with null or a non-empty string. Now the algorithm correctly handles a null or non-empty input string.
1 parent 19c98a2 commit 398a20e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

index.bs

+8-5
Original file line numberDiff line numberDiff line change
@@ -4153,16 +4153,19 @@ Content-Type: application/reports+json
41534153
`port-part` matching
41544154
</h5>
41554155

4156-
An <a>ASCII string</a> |input| <dfn export>`port-part` matches</dfn> [=/URL=] |url| if a CSP source expression that
4157-
contained the first as a <a grammar>`port-part`</a> could potentially match a URL containing the latter's [=url/port=]
4158-
and [=url/scheme=]. For example, "80" <a>`port-part` matches</a> matches http://example.com.
4156+
An <a>ASCII string</a> or null |input| <dfn export>`port-part` matches</dfn>
4157+
[=/URL=] |url| if a CSP source expression that contained the first as a <a
4158+
grammar>`port-part`</a> could potentially match a URL containing the latter's
4159+
[=url/port=] and [=url/scheme=]. For example, "80" <a>`port-part` matches</a>
4160+
matches http://example.com.
41594161

41604162
<ol class="algorithm">
4161-
1. Assert: |input| is the empty string, "*", or a sequence of <a>ASCII digits</a>.
4163+
1. Assert: |input| is null, "*", or a sequence of one or more <a>ASCII digits</a>.
41624164

41634165
2. If |input| is equal to "*", return "`Matches`".
41644166

4165-
3. Let |normalizedInput| be null if |input| is the empty string; otherwise |input| interpreted as decimal number.
4167+
3. Let |normalizedInput| be null if |input| null; otherwise |input|
4168+
interpreted as decimal number.
41664169

41674170
4. If |normalizedInput| equals |url|'s [=url/port=], return "`Matches`".
41684171

0 commit comments

Comments
 (0)