X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem%2FTest%2FSystem.Net%2FFtpWebRequestTest.cs;h=dd5df82310ba05891cc02abe68a8a8513f71d9ae;hb=b683b3dc7473d0db665d1e5fa0efa2c4c807ab90;hp=771d5d1fb6ae4cf35c3e05db8b41a44cb6175435;hpb=85c73568b0739fabfe454532a955d80adc2ccc7a;p=mono.git diff --git a/mcs/class/System/Test/System.Net/FtpWebRequestTest.cs b/mcs/class/System/Test/System.Net/FtpWebRequestTest.cs index 771d5d1fb6a..dd5df82310b 100644 --- a/mcs/class/System/Test/System.Net/FtpWebRequestTest.cs +++ b/mcs/class/System/Test/System.Net/FtpWebRequestTest.cs @@ -336,10 +336,20 @@ namespace MonoTests.System.Net DownloadFile (new ServerDownload (true)); } - void DownloadFile (ServerDownload sp) + [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif + public void DownloadFileNonLatinChars () + { + string filename = "\u0411\u0430\u0448\u043DRowan-\u041F\u0435\u0441\u043D\u043F\u0440\u043E\u043C\u043E\u043D\u0430\u0445\u0430\u0422\u0435\u043E\u0434\u043E\u0440\u0443\u0441\u0430\u0438\u0437\u0413\u0430\u043C\u043C\u0435\u043B\u044C\u043D\u0430.mp3"; + DownloadFile (new ServerDownload (null, null, filename, false), "ftp://{0}:{1}/" + filename); + } + + void DownloadFile (ServerDownload sp, string uriTemplate = "ftp://{0}:{1}/file.txt") { sp.Start (); - string uri = String.Format ("ftp://{0}:{1}/file.txt", EncloseIPv6 (sp.IPAddress), sp.Port); + string uri = String.Format (uriTemplate, EncloseIPv6 (sp.IPAddress), sp.Port); try { FtpWebRequest ftp = (FtpWebRequest) WebRequest.Create (uri); ftp.KeepAlive = false; @@ -370,7 +380,7 @@ namespace MonoTests.System.Net { // Some embedded FTP servers in Industrial Automation Hardware report // the PWD using backslashes, but allow forward slashes for CWD. - DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", false)); + DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", null, false)); } [Test] @@ -379,9 +389,12 @@ namespace MonoTests.System.Net #endif public void DownloadFile2_v6 () { + if (!Socket.OSSupportsIPv6) + Assert.Ignore ("IPv6 not supported."); + // Some embedded FTP servers in Industrial Automation Hardware report // the PWD using backslashes, but allow forward slashes for CWD. - DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", true)); + DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", null, true)); } [Test] @@ -580,18 +593,19 @@ namespace MonoTests.System.Net class ServerDownload : FtpServer { - string Pwd, Cwd; + string Pwd, Cwd, Filename; public ServerDownload (bool ipv6) - : this (null, null, ipv6) + : this (null, null, null, ipv6) { } - public ServerDownload (string pwd, string cwd, bool ipv6) + public ServerDownload (string pwd, string cwd, string filename, bool ipv6) : base (ipv6) { Pwd = pwd ?? "/home/someuser"; Cwd = cwd ?? "/home/someuser/"; + Filename = filename ?? "file.txt"; } protected override void Run () @@ -620,8 +634,8 @@ namespace MonoTests.System.Net writer.Flush (); str = reader.ReadLine (); - if (str != "RETR file.txt") { - Where = "RETR - " + str; + if (str != $"RETR {Filename}") { + Where = $"RETR - got: {str}, expected: RETR {Filename}"; client.Close (); return; }