@@ -49,6 +49,11 @@ public function trustedDomainDataProvider() {
4949 'host.two.test ' ,
5050 '[1fff:0:a88:85a3::ac1f] ' ,
5151 'host.three.test:443 ' ,
52+ '*.leading.host ' ,
53+ 'trailing.host* ' ,
54+ 'cen*ter ' ,
55+ '*.leadingwith.port:123 ' ,
56+ 'trailingwith.port*:456 ' ,
5257 ];
5358 return [
5459 // empty defaults to false with 8.1
@@ -76,7 +81,31 @@ public function trustedDomainDataProvider() {
7681 [$ trustedHostTestList , 'localhost: evil.host ' , false ],
7782 // do not trust casting
7883 [[1 ], '1 ' , false ],
84+ // leading *
85+ [$ trustedHostTestList , 'abc.leading.host ' , true ],
86+ [$ trustedHostTestList , 'abc.def.leading.host ' , true ],
87+ [$ trustedHostTestList , 'abc.def.leading.host.another ' , false ],
88+ [$ trustedHostTestList , 'abc.def.leading.host:123 ' , true ],
89+ [$ trustedHostTestList , 'leading.host ' , false ],
90+ // trailing *
91+ [$ trustedHostTestList , 'trailing.host ' , true ],
92+ [$ trustedHostTestList , 'trailing.host.abc ' , true ],
93+ [$ trustedHostTestList , 'trailing.host.abc.def ' , true ],
94+ [$ trustedHostTestList , 'trailing.host.abc:123 ' , true ],
95+ [$ trustedHostTestList , 'another.trailing.host ' , false ],
96+ // center *
97+ [$ trustedHostTestList , 'center ' , true ],
98+ [$ trustedHostTestList , 'cenxxxter ' , true ],
99+ [$ trustedHostTestList , 'cen.x.y.ter ' , true ],
100+ // with port
101+ [$ trustedHostTestList , 'abc.leadingwith.port:123 ' , true ],
102+ [$ trustedHostTestList , 'abc.leadingwith.port:1234 ' , false ],
103+ [$ trustedHostTestList , 'trailingwith.port.abc:456 ' , true ],
104+ [$ trustedHostTestList , 'trailingwith.port.abc:123 ' , false ],
105+ // bad hostname
106+ [$ trustedHostTestList , '-bad ' , false ],
107+ [$ trustedHostTestList , '-bad.leading.host ' , false ],
108+ [$ trustedHostTestList , 'bad..der.leading.host ' , false ],
79109 ];
80110 }
81-
82111}
0 commit comments