<?php
-// $Id: SpamTest.php,v 1.15 2007/06/16 13:38:00 henoheno Exp $
+// $Id: SpamTest.php,v 1.16 2007/06/23 14:11:10 henoheno Exp $
// Copyright (C) 2007 heno
//
// Design test case for spam.php (called from runner.php)
$this->assertEquals('top_story.htm', $results[3]['file']);
$this->assertEquals('', $results[3]['query']);
$this->assertEquals('', $results[3]['fragment']);
+
+
+ // Specific tests ----
+
+ // Divider: Back-slash
+ $test_string = ' http:\\backslash.org\fobar.html ';
+ $results = uri_pickup_normalize(uri_pickup($test_string));
+ $this->assertEquals('backslash.org', $results[0]['host']);
+
+ // Host: Underscore
+ $test_string = ' http://under_score.org/fobar.html ';
+ $results = uri_pickup_normalize(uri_pickup($test_string));
+ $this->assertEquals('under_score.org',$results[0]['host']); // Not 'under'
+
+ // Host: IPv4
+ $test_string = ' http://192.168.0.1/fobar.html ';
+ $results = uri_pickup_normalize(uri_pickup($test_string));
+ $this->assertEquals('192.168.0.1', $results[0]['host']);
}
function testFunc_scheme_normalize()
<?php
-// $Id: spam.php,v 1.188 2007/06/18 14:25:24 henoheno Exp $
+// $Id: spam.php,v 1.189 2007/06/23 14:11:10 henoheno Exp $
// Copyright (C) 2006-2007 PukiWiki Developers Team
// License: GPL v2 or (at your option) any later version
//
// 3: Host
'\[[0-9a-f:.]+\]' . '|' . // IPv6([colon-hex and dot]): RFC2732
'(?:[0-9]{1,3}\.){3}[0-9]{1,3}' . '|' . // IPv4(dot-decimal): 001.22.3.44
- '[a-z0-9][a-z0-9.-]+[a-z0-9]' . // hostname(FQDN) : foo.example.org
+ '[a-z0-9][a-z0-9_.-]+[a-z0-9]' . // hostname(FQDN) : foo.example.org
')' .
'(?::([0-9]*))?' . // 4: Port
'((?:/+[^\s<>"\'\[\]/\#]+)*/+)?' . // 5: Directory path or path-info