@@ -301,6 +301,7 @@ public static function serverHostnameProvider()
301301 'REQUEST_URI ' => 'http://test.example.com/news ' ,
302302 ),
303303 'test.example.com ' ,
304+ '80 ' ,
304305 '/news ' ,
305306 ),
306307 array (
@@ -309,6 +310,30 @@ public static function serverHostnameProvider()
309310 'REQUEST_URI ' => 'http://test.example.com/news ' ,
310311 ),
311312 'test.example.com ' ,
313+ '80 ' ,
314+ '/news ' ,
315+ ),
316+ array (
317+ array (
318+ 'SERVER_NAME ' => '[1:2:3:4:5:6::6] ' ,
319+ 'SERVER_ADDR ' => '1:2:3:4:5:6::6 ' ,
320+ 'SERVER_PORT ' => '80 ' ,
321+ 'REQUEST_URI ' => 'http://[1:2:3:4:5:6::6]/news ' ,
322+ ),
323+ '[1:2:3:4:5:6::6] ' ,
324+ '80 ' ,
325+ '/news ' ,
326+ ),
327+ // Test for broken $_SERVER implementation from Windows-Safari
328+ array (
329+ array (
330+ 'SERVER_NAME ' => '[1:2:3:4:5:6:] ' ,
331+ 'SERVER_ADDR ' => '1:2:3:4:5:6::6 ' ,
332+ 'SERVER_PORT ' => '6 ' ,
333+ 'REQUEST_URI ' => 'http://[1:2:3:4:5:6::6]/news ' ,
334+ ),
335+ '[1:2:3:4:5:6::6] ' ,
336+ '80 ' ,
312337 '/news ' ,
313338 ),
314339 array (
@@ -318,6 +343,7 @@ public static function serverHostnameProvider()
318343 'REQUEST_URI ' => 'http://test.example.com/news ' ,
319344 ),
320345 'test.example.com ' ,
346+ '8080 ' ,
321347 '/news ' ,
322348 ),
323349 array (
@@ -328,6 +354,7 @@ public static function serverHostnameProvider()
328354 'REQUEST_URI ' => 'https://test.example.com/news ' ,
329355 ),
330356 'test.example.com ' ,
357+ '443 ' ,
331358 '/news ' ,
332359 ),
333360 );
@@ -339,14 +366,17 @@ public static function serverHostnameProvider()
339366 * @param string $name
340367 * @param string $value
341368 */
342- public function testServerHostnameProvider (array $ server , $ expectedHost , $ expectedRequestUri )
369+ public function testServerHostnameProvider (array $ server , $ expectedHost , $ expectedPort , $ expectedRequestUri )
343370 {
344371 $ _SERVER = $ server ;
345372 $ request = new Request ();
346373
347374 $ host = $ request ->getUri ()->getHost ();
348375 $ this ->assertEquals ($ expectedHost , $ host );
349376
377+ $ port = $ request ->getUri ()->getPort ();
378+ $ this ->assertEquals ($ expectedPort , $ port );
379+
350380 $ requestUri = $ request ->getRequestUri ();
351381 $ this ->assertEquals ($ expectedRequestUri , $ requestUri );
352382 }
0 commit comments