Skip to content

Commit c5a9703

Browse files
authored
Merge pull request #760 from OptimumCode/rfc3490-label-separator
Add test cases for other valid label separators in IDN hostnames
2 parents 39002ae + 4fa572d commit c5a9703

File tree

4 files changed

+189
-4
lines changed

4 files changed

+189
-4
lines changed

tests/draft-next/optional/format/idn-hostname.json

+48-1
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,58 @@
331331
"description": "empty string",
332332
"data": "",
333333
"valid": false
334-
},
334+
}
335+
]
336+
},
337+
{
338+
"description": "validation of separators in internationalized host names",
339+
"specification": [
340+
{"rfc3490": "3.1", "quote": "Whenever dots are used as label separators, the following characters MUST be recognized as dots: U+002E (full stop), U+3002 (ideographic full stop), U+FF0E (fullwidth full stop), U+FF61(halfwidth ideographic full stop)"}
341+
],
342+
"schema": {
343+
"$schema": "https://json-schema.org/draft/next/schema",
344+
"format": "idn-hostname"
345+
},
346+
"tests": [
335347
{
336348
"description": "single dot",
337349
"data": ".",
338350
"valid": false
351+
},
352+
{
353+
"description": "single ideographic full stop",
354+
"data": "\u3002",
355+
"valid": false
356+
},
357+
{
358+
"description": "single fullwidth full stop",
359+
"data": "\uff0e",
360+
"valid": false
361+
},
362+
{
363+
"description": "single halfwidth ideographic full stop",
364+
"data": "\uff61",
365+
"valid": false
366+
},
367+
{
368+
"description": "dot as label separator",
369+
"data": "a.b",
370+
"valid": true
371+
},
372+
{
373+
"description": "ideographic full stop as label separator",
374+
"data": "a\u3002b",
375+
"valid": true
376+
},
377+
{
378+
"description": "fullwidth full stop as label separator",
379+
"data": "a\uff0eb",
380+
"valid": true
381+
},
382+
{
383+
"description": "halfwidth ideographic full stop as label separator",
384+
"data": "a\uff61b",
385+
"valid": true
339386
}
340387
]
341388
}

tests/draft2019-09/optional/format/idn-hostname.json

+48-1
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,58 @@
331331
"description": "empty string",
332332
"data": "",
333333
"valid": false
334-
},
334+
}
335+
]
336+
},
337+
{
338+
"description": "validation of separators in internationalized host names",
339+
"specification": [
340+
{"rfc3490": "3.1", "quote": "Whenever dots are used as label separators, the following characters MUST be recognized as dots: U+002E (full stop), U+3002 (ideographic full stop), U+FF0E (fullwidth full stop), U+FF61(halfwidth ideographic full stop)"}
341+
],
342+
"schema": {
343+
"$schema": "https://json-schema.org/draft/2019-09/schema",
344+
"format": "idn-hostname"
345+
},
346+
"tests": [
335347
{
336348
"description": "single dot",
337349
"data": ".",
338350
"valid": false
351+
},
352+
{
353+
"description": "single ideographic full stop",
354+
"data": "\u3002",
355+
"valid": false
356+
},
357+
{
358+
"description": "single fullwidth full stop",
359+
"data": "\uff0e",
360+
"valid": false
361+
},
362+
{
363+
"description": "single halfwidth ideographic full stop",
364+
"data": "\uff61",
365+
"valid": false
366+
},
367+
{
368+
"description": "dot as label separator",
369+
"data": "a.b",
370+
"valid": true
371+
},
372+
{
373+
"description": "ideographic full stop as label separator",
374+
"data": "a\u3002b",
375+
"valid": true
376+
},
377+
{
378+
"description": "fullwidth full stop as label separator",
379+
"data": "a\uff0eb",
380+
"valid": true
381+
},
382+
{
383+
"description": "halfwidth ideographic full stop as label separator",
384+
"data": "a\uff61b",
385+
"valid": true
339386
}
340387
]
341388
}

tests/draft2020-12/optional/format/idn-hostname.json

+48-1
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,58 @@
331331
"description": "empty string",
332332
"data": "",
333333
"valid": false
334-
},
334+
}
335+
]
336+
},
337+
{
338+
"description": "validation of separators in internationalized host names",
339+
"specification": [
340+
{"rfc3490": "3.1", "quote": "Whenever dots are used as label separators, the following characters MUST be recognized as dots: U+002E (full stop), U+3002 (ideographic full stop), U+FF0E (fullwidth full stop), U+FF61(halfwidth ideographic full stop)"}
341+
],
342+
"schema": {
343+
"$schema": "https://json-schema.org/draft/2020-12/schema",
344+
"format": "idn-hostname"
345+
},
346+
"tests": [
335347
{
336348
"description": "single dot",
337349
"data": ".",
338350
"valid": false
351+
},
352+
{
353+
"description": "single ideographic full stop",
354+
"data": "\u3002",
355+
"valid": false
356+
},
357+
{
358+
"description": "single fullwidth full stop",
359+
"data": "\uff0e",
360+
"valid": false
361+
},
362+
{
363+
"description": "single halfwidth ideographic full stop",
364+
"data": "\uff61",
365+
"valid": false
366+
},
367+
{
368+
"description": "dot as label separator",
369+
"data": "a.b",
370+
"valid": true
371+
},
372+
{
373+
"description": "ideographic full stop as label separator",
374+
"data": "a\u3002b",
375+
"valid": true
376+
},
377+
{
378+
"description": "fullwidth full stop as label separator",
379+
"data": "a\uff0eb",
380+
"valid": true
381+
},
382+
{
383+
"description": "halfwidth ideographic full stop as label separator",
384+
"data": "a\uff61b",
385+
"valid": true
339386
}
340387
]
341388
}

tests/draft7/optional/format/idn-hostname.json

+45-1
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,55 @@
323323
"description": "empty string",
324324
"data": "",
325325
"valid": false
326-
},
326+
}
327+
]
328+
},
329+
{
330+
"description": "validation of separators in internationalized host names",
331+
"specification": [
332+
{"rfc3490": "3.1", "quote": "Whenever dots are used as label separators, the following characters MUST be recognized as dots: U+002E (full stop), U+3002 (ideographic full stop), U+FF0E (fullwidth full stop), U+FF61(halfwidth ideographic full stop)"}
333+
],
334+
"schema": { "format": "idn-hostname" },
335+
"tests": [
327336
{
328337
"description": "single dot",
329338
"data": ".",
330339
"valid": false
340+
},
341+
{
342+
"description": "single ideographic full stop",
343+
"data": "\u3002",
344+
"valid": false
345+
},
346+
{
347+
"description": "single fullwidth full stop",
348+
"data": "\uff0e",
349+
"valid": false
350+
},
351+
{
352+
"description": "single halfwidth ideographic full stop",
353+
"data": "\uff61",
354+
"valid": false
355+
},
356+
{
357+
"description": "dot as label separator",
358+
"data": "a.b",
359+
"valid": true
360+
},
361+
{
362+
"description": "ideographic full stop as label separator",
363+
"data": "a\u3002b",
364+
"valid": true
365+
},
366+
{
367+
"description": "fullwidth full stop as label separator",
368+
"data": "a\uff0eb",
369+
"valid": true
370+
},
371+
{
372+
"description": "halfwidth ideographic full stop as label separator",
373+
"data": "a\uff61b",
374+
"valid": true
331375
}
332376
]
333377
}

0 commit comments

Comments
 (0)