@@ -325,18 +325,41 @@ routes.set('/', () => {
325
325
"fastly.com:80" ,
326
326
"fastly.com:443" ,
327
327
"fastly.com:65535" ,
328
+ // Basic zero IPv4 address.
329
+ "0.0.0.0" ,
330
+ // Basic non-zero IPv4 address.
331
+ "192.168.140.255" ,
332
+
333
+ // TODO: These are commented out as the hostcall currently yields an error of "invalid authority" when given an ipv6 address
334
+ // Localhost IPv6.
335
+ // "::1",
336
+ // Fully expanded IPv6 address.
337
+ // "fd7a:115c:a1e0:ab12:4843:cd96:626b:430b",
338
+ // IPv6 with elided fields in the middle.
339
+ // "fd7a:115c::626b:430b",
340
+ // IPv6 with elided fields at the end.
341
+ // "fd7a:115c:a1e0:ab12:4843:cd96::",
342
+ // IPv6 with single elided field at the end.
343
+ // "fd7a:115c:a1e0:ab12:4843:cd96:626b::",
344
+ // IPv6 with single elided field in the middle.
345
+ // "fd7a:115c:a1e0::4843:cd96:626b:430b",
346
+ // IPv6 with the trailing 32 bits written as IPv4 dotted decimal. (4in6)
347
+ // "::ffff:192.168.140.255",
348
+ // IPv6 with capital letters.
349
+ // "FD9E:1A04:F01D::1",
328
350
] ;
329
351
let i = 0 ;
330
352
for ( const target of targets ) {
331
353
let error = assertDoesNotThrow ( ( ) => {
332
- new Backend ( { name : 'target-property-valid-host-' + i , target } )
354
+ console . log ( target )
355
+ new Backend ( { name : 'target-property-valid-host-' + i , target } )
333
356
} )
334
357
if ( error ) { return error }
335
358
i ++ ;
336
359
}
337
360
return pass ( )
338
361
} ) ;
339
-
362
+
340
363
routes . set ( "/backend/constructor/parameter-target-property-invalid-host" , async ( ) => {
341
364
const targets = [
342
365
"-www.fastly.com" ,
@@ -348,11 +371,47 @@ routes.set('/', () => {
348
371
"fastly.com:-1" ,
349
372
"fastly.com:0" ,
350
373
"fastly.com:65536" ,
374
+ // IPv4 address in windows-style "print all the digits" form.
375
+ // "010.000.015.001",
376
+ // IPv4 address with a silly amount of leading zeros.
377
+ // "000001.00000002.00000003.000000004",
378
+ // 4-in-6 with octet with leading zero
379
+ // "::ffff:1.2.03.4",
380
+ // Basic zero IPv6 address.
381
+ "::" ,
382
+ // IPv6 with not enough fields
383
+ "1:2:3:4:5:6:7" ,
384
+ // IPv6 with too many fields
385
+ "1:2:3:4:5:6:7:8:9" ,
386
+ // IPv6 with 8 fields and a :: expander
387
+ "1:2:3:4::5:6:7:8" ,
388
+ // IPv6 with a field bigger than 2b
389
+ "fe801::1" ,
390
+ // IPv6 with non-hex values in field
391
+ "fe80:tail:scal:e::" ,
392
+ // IPv6 with a zone delimiter but no zone.
393
+ "fe80::1%" ,
394
+ // IPv6 (without ellipsis) with too many fields for trailing embedded IPv4.
395
+ "ffff:ffff:ffff:ffff:ffff:ffff:ffff:192.168.140.255" ,
396
+ // IPv6 (with ellipsis) with too many fields for trailing embedded IPv4.
397
+ "ffff::ffff:ffff:ffff:ffff:ffff:ffff:192.168.140.255" ,
398
+ // IPv6 with invalid embedded IPv4.
399
+ "::ffff:192.168.140.bad" ,
400
+ // IPv6 with multiple ellipsis ::.
401
+ "fe80::1::1" ,
402
+ // IPv6 with invalid non hex/colon character.
403
+ "fe80:1?:1" ,
404
+ // IPv6 with truncated bytes after single colon.
405
+ "fe80:" ,
406
+ ":::1" ,
407
+ ":0:1" ,
408
+ ":" ,
351
409
] ;
352
410
let i = 0 ;
353
411
for ( const target of targets ) {
354
412
let error = assertThrows ( ( ) => {
355
- new Backend ( { name : 'target-property-invalid-host-' + i , target } )
413
+ console . log ( target )
414
+ new Backend ( { name : 'target-property-invalid-host-' + i , target } )
356
415
} , TypeError , `Backend constructor: target does not contain a valid IPv4, IPv6, or hostname address` )
357
416
if ( error ) { return error }
358
417
i ++ ;
@@ -604,7 +663,7 @@ routes.set('/', () => {
604
663
// useSSL property
605
664
{
606
665
routes . set ( "/backend/constructor/parameter-useSSL-property-valid-boolean" , async ( ) => {
607
- const types = [ { } , [ ] , Symbol ( ) , 1 , "2" ] ;
666
+ const types = [ { } , [ ] , Symbol ( ) , 1 , "2" ] ;
608
667
for ( const type of types ) {
609
668
let error = assertDoesNotThrow ( ( ) => {
610
669
new Backend ( { name : 'useSSL-property-valid-boolean' + type , target : 'a' , useSSL : type } )
@@ -805,7 +864,7 @@ routes.set('/', () => {
805
864
// checkCertificate property
806
865
{
807
866
routes . set ( "/backend/constructor/parameter-checkCertificate-property-valid-boolean" , async ( ) => {
808
- const types = [ { } , [ ] , Symbol ( ) , 1 , "2" ] ;
867
+ const types = [ { } , [ ] , Symbol ( ) , 1 , "2" ] ;
809
868
for ( const type of types ) {
810
869
let error = assertDoesNotThrow ( ( ) => {
811
870
new Backend ( { name : 'checkCertificate-property-valid-boolean' + type , target : 'a' , checkCertificate : type } )
@@ -865,7 +924,7 @@ routes.set('/', () => {
865
924
return pass ( )
866
925
} ) ;
867
926
}
868
-
927
+
869
928
// sniHostname property
870
929
{
871
930
routes . set ( "/backend/constructor/parameter-sniHostname-property-empty-string" , async ( ) => {
0 commit comments