Author: lslezak Date: Tue Jan 20 14:10:11 2009 New Revision: 54804 URL: http://svn.opensuse.org/viewcvs/yast?rev=54804&view=rev Log: - URL.ycp - fixed parsing and building IPv6 URLs, testsuite update (bnc#465820) - 2.17.62 Modified: branches/SuSE-Code-11-Branch/yast2/VERSION branches/SuSE-Code-11-Branch/yast2/library/types/src/URL.ycp branches/SuSE-Code-11-Branch/yast2/library/types/testsuite/tests/URL.out branches/SuSE-Code-11-Branch/yast2/library/types/testsuite/tests/URL.ycp branches/SuSE-Code-11-Branch/yast2/package/yast2.changes Modified: branches/SuSE-Code-11-Branch/yast2/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/yast2/VERSION?rev=54804&r1=54803&r2=54804&view=diff ============================================================================== --- branches/SuSE-Code-11-Branch/yast2/VERSION (original) +++ branches/SuSE-Code-11-Branch/yast2/VERSION Tue Jan 20 14:10:11 2009 @@ -1 +1 @@ -2.17.61 +2.17.62 Modified: branches/SuSE-Code-11-Branch/yast2/library/types/src/URL.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/yast2/library/types/src/URL.ycp?rev=54804&r1=54803&r2=54804&view=diff ============================================================================== --- branches/SuSE-Code-11-Branch/yast2/library/types/src/URL.ycp (original) +++ branches/SuSE-Code-11-Branch/yast2/library/types/src/URL.ycp Tue Jan 20 14:10:11 2009 @@ -225,6 +225,21 @@ else tokens["host"] = userpass[7]:""; + string hostport6 = substring(rawtokens[2]:"", size(userpass[0]:"")); + y2debug("hostport6: %1", hostport6); + + // check if there is an IPv6 address + string host6 = regexpsub(hostport6, "^\\[(.*)\\]", "\\1"); + + if (host6 != nil && host6 != "") + { + y2milestone("IPv6 host detected: %1", host6); + tokens["host"] = host6; + string port6 = regexpsub(hostport6, "^\\[.*\\]:(.*)", "\\1"); + y2debug("port: %1", port6); + tokens["port"] = (port6 != nil) ? port6 : ""; + } + // some exceptions for samba scheme (there is optional extra option "domain") if (tokens["scheme"]:""=="samba" || tokens["scheme"]:""=="smb"){ list<string> tmp_list = filter(string row, splitstring(tokens["path"]:"", "/"), {return (size(row)>0);}); @@ -255,6 +270,8 @@ map tokens = Parse(url); + y2debug("tokens: %1", tokens); + /* Check "scheme" : "http" */ if(!regexpmatch(tokens["scheme"]:"", "^[[:alpha:]]*$")) return false; @@ -319,7 +336,10 @@ if(Hostname::CheckFQ(tokens["host"]:"") || IP::Check(tokens["host"]:"")) { - url = sformat("%1%2", url, tokens["host"]:""); + // enclose an IPv6 address in square brackets + url = (IP::Check6(tokens["host"]:"")) ? + sformat("%1[%2]", url, tokens["host"]:"") : + sformat("%1%2", url, tokens["host"]:""); } y2debug("url: %1", url); Modified: branches/SuSE-Code-11-Branch/yast2/library/types/testsuite/tests/URL.out URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/yast2/library/types/testsuite/tests/URL.out?rev=54804&r1=54803&r2=54804&view=diff ============================================================================== --- branches/SuSE-Code-11-Branch/yast2/library/types/testsuite/tests/URL.out (original) +++ branches/SuSE-Code-11-Branch/yast2/library/types/testsuite/tests/URL.out Tue Jan 20 14:10:11 2009 @@ -21,6 +21,11 @@ Return ftp://ftp.example.com/%2fpath/to/dir Return ftp://ftp.example.com/%2fpath/to/dir Return ftp://ftp.example.com/%2fpath/to/dir +Return ftp://[2001:de8:0:f123::1]/%2fpath/to/dir +Return http://[2001:de8:0:f123::1]:8080/path/to/dir +Return $["fragment":"", "host":"2001:de8:0:f123::1", "pass":"", "path":"/path/to/dir", "port":"", "query":"", "scheme":"http", "user":""] +Return $["fragment":"", "host":"2001:de8:0:f123::1", "pass":"password", "path":"/path/to/dir", "port":"8080", "query":"", "scheme":"http", "user":"user"] +Return http://user:password@[2001:de8:0:f123::1]:8080/path/to/dir Return dir:/// Return http://download.opensuse.org/very/log/path/which/will/be/truncated/target_fi... Return http://download.opensuse.org/.../target_file Modified: branches/SuSE-Code-11-Branch/yast2/library/types/testsuite/tests/URL.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/yast2/library/types/testsuite/tests/URL.ycp?rev=54804&r1=54803&r2=54804&view=diff ============================================================================== --- branches/SuSE-Code-11-Branch/yast2/library/types/testsuite/tests/URL.ycp (original) +++ branches/SuSE-Code-11-Branch/yast2/library/types/testsuite/tests/URL.ycp Tue Jan 20 14:10:11 2009 @@ -51,6 +51,14 @@ TEST(``(URL::Build($["scheme":"ftp","host":"ftp.example.com","path":"//path/to/dir"])), [], nil); TEST(``(URL::Build($["scheme":"ftp","host":"ftp.example.com","path":"///path/to/dir"])), [], nil); +// IPv6 tests +TEST(``(URL::Build($["scheme":"ftp","host":"2001:de8:0:f123::1","path":"///path/to/dir"])), [], nil); +TEST(``(URL::Build($["scheme":"http","host":"2001:de8:0:f123::1","path":"///path/to/dir", "port" : "8080"])), [], nil); +TEST(``(URL::Parse("http://[2001:de8:0:f123::1]/path/to/dir")), [], nil); +TEST(``(URL::Parse("http://user:password@[2001:de8:0:f123::1]:8080/path/to/dir")), [], nil); +TEST(``(URL::Build(URL::Parse("http://user:password@[2001:de8:0:f123::1]:8080/path/to/dir"))), [], nil); + + TEST(``(URL::Build(URL::Parse("dir:///"))), [], nil); string long_url = "http://download.opensuse.org/very/log/path/which/will/be/truncated/target_fi..."; Modified: branches/SuSE-Code-11-Branch/yast2/package/yast2.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/yast2/package/yast2.changes?rev=54804&r1=54803&r2=54804&view=diff ============================================================================== --- branches/SuSE-Code-11-Branch/yast2/package/yast2.changes (original) +++ branches/SuSE-Code-11-Branch/yast2/package/yast2.changes Tue Jan 20 14:10:11 2009 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Jan 19 17:38:12 CET 2009 - lslezak@suse.cz + +- URL.ycp - fixed parsing and building IPv6 URLs, testsuite update + (bnc#465820) +- 2.17.62 + +------------------------------------------------------------------- Mon Jan 5 14:18:09 CET 2009 - lslezak@suse.cz - 2.17.61 -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org