[Mono-bugs] [Bug 688007] WebClient.OpenRead() fails when trying to access an anonymous ftp site
https://bugzilla.novell.com/show_bug.cgi?id=688007 https://bugzilla.novell.com/show_bug.cgi?id=688007#c11 Gonzalo Paniagua Javier changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution||FIXED --- Comment #11 from Gonzalo Paniagua Javier 2011-04-29 15:05:32 UTC --- Ah, ok. That happens when one bug in bugzilla is morphed into what should be 3 different ones. I didn't read all the comments. I'm closing this bug and opening a new one to track the proxy issue. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 688007] WebClient.OpenRead() fails when trying to access an anonymous ftp site
https://bugzilla.novell.com/show_bug.cgi?id=688007 https://bugzilla.novell.com/show_bug.cgi?id=688007#c10 QuickJack . changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | --- Comment #10 from QuickJack . 2011-04-29 12:25:10 UTC --- Hi Gonzalo, thanks for the quick response. This fixes the main part of the problem. However, WebClient is still not working! I checked out your changes and made further tests. As I pointed out in one of my previous posts, there seems to be a problem with proxy access. If a system proxy is set up, WebClient get's totally confused. The following list shows how to reproduce the issue: 1. Setup up a system wide proxy 2. Call OpenRead() to open an anonymous ftp connection to a site on the internet Result: FtpWebRequest.OpenControlConnection() calls Socket.Connect() to connect to the proxy server. But instead of using the correct proxy port, it chooses port 21. As a result, the proxy cannot respond and WebClient.OpenRead() fails. I am running Ubuntu Maverick but I guess the result should be the same when running under Suse. Best regards, Martin -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 688007] WebClient.OpenRead() fails when trying to access an anonymous ftp site
https://bugzilla.novell.com/show_bug.cgi?id=688007 https://bugzilla.novell.com/show_bug.cgi?id=688007#c9 Gonzalo Paniagua Javier changed: What|Removed |Added Status|NEEDINFO|RESOLVED InfoProvider|test051...@hotmail.com | Resolution||FIXED --- Comment #9 from Gonzalo Paniagua Javier 2011-04-29 09:56:28 UTC --- I have applied a modified version of your patch in mono master/d0d40cb7 and mono-2-10/b0c3795. Thanks! -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 688007] WebClient.OpenRead() fails when trying to access an anonymous ftp site
https://bugzilla.novell.com/show_bug.cgi?id=688007 https://bugzilla.novell.com/show_bug.cgi?id=688007#c8 --- Comment #8 from QuickJack . 2011-04-28 11:18:24 UTC --- Hi Gonzalo, I have taken a deeper look into the issue and found a possible solution. ### #Analysis ### The current implementation of WebClient.SetupRequest() is as follows: WebRequest SetupRequest (Uri uri) { WebRequest request = GetWebRequest (uri); if (Proxy != null) request.Proxy = Proxy; if (credentials != null) request.Credentials = credentials; //additional code not included for this demo } It starts by setting up proxy servers and credentials. But it does not try to extract credentials from the url. ### #Solution ### I have extended the above part as follows: WebRequest SetupRequest (Uri uri) { WebRequest request = GetWebRequest (uri); if (Proxy != null) request.Proxy = Proxy; if (credentials != null) request.Credentials = credentials; else if(uri.AbsoluteUri.Contains("@")) { //extract username/password request.Credentials = GetCredentials(uri.AbsoluteUri); } //additional (unchanged) code not included for this demo } internal NetworkCredential GetCredentials(string strUrl) { int i = strUrl.IndexOf("//")+2; int j = strUrl.IndexOf('/', i); string strCredential=strUrl.Substring(i,j-i); strCredential = strCredential.Substring(0, strCredential.LastIndexOf('@')); string[] credentials=strCredential.Split(new char[]{':'}); if (credentials.Length == 2) { if (credentials[0].Contains("\\")) { //extract domain name string[] names=credentials[0].Split(new char[]{'\\'}); if (names.Length == 2) return new NetworkCredential(names[1], credentials[1], names[0]); } return new NetworkCredential(credentials[0], credentials[1]); } return new NetworkCredential(); } The GetCredentials() method extracts username/password and possible domain names from the url and initializes a new NetworkCredential object with them. I have done tests on a password protected ftp site in the intranet that runs on IIS and requires username/password/domain name to authenticate as well as on my Quick'n'Easy ftp test server that requires username/password only. All tests were successful. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 688007] WebClient.OpenRead() fails when trying to access an anonymous ftp site
https://bugzilla.novell.com/show_bug.cgi?id=688007 https://bugzilla.novell.com/show_bug.cgi?id=688007#c7 --- Comment #7 from QuickJack . 2011-04-28 06:31:28 UTC --- I am using different testing machines. This one runs Ubuntu Maverick and does have a direct internet connection and is not using a proxy. I have compiled current Mono master yesterday evening. Anonymous ftp is working now! However, accessing a password protected ftp site is not fully working. I created a console application using the following code: using System; using System.Net; using System.IO; namespace WebClient.Test { class MainClass { public static void Main (string[] args) { System.Net.WebClient client=new System.Net.WebClient(); //client.Credentials=new NetworkCredential("user","test");//explicitly setting credentials works System.IO.Stream strm=client.OpenRead("ftp://user:test@192.168.1.10/test/divx.txt";);//specifying credentials via url fails!!! System.Text.ASCIIEncoding enc=new System.Text.ASCIIEncoding(); byte[] buf=new byte[256]; strm.Read(buf,0,256); string strContent=enc.GetString(buf); strm.Close(); Console.WriteLine ("Hello World!"); } } } I used the Quick'n'Easy Ftp Server (Freeware) under WinXP to set up a password protected site on another machine. Specifiying credentials via the url is not working. The relevant code is in FtpWebRequest.Authenticate() which tries to access the site using anonymous credentials in this case. It simply ignores the credentials which are supplied via the url. This should be fixed. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 688007] WebClient.OpenRead() fails when trying to access an anonymous ftp site
https://bugzilla.novell.com/show_bug.cgi?id=688007 https://bugzilla.novell.com/show_bug.cgi?id=688007#c6 Gonzalo Paniagua Javier changed: What|Removed |Added Status|REOPENED|NEEDINFO InfoProvider||test051...@hotmail.com AssignedTo|mono-bugs@lists.ximian.com |gonz...@novell.com --- Comment #6 from Gonzalo Paniagua Javier 2011-04-27 04:42:13 UTC --- Can you: 1. Paste the output of 'mono --version' for the one that you compiled. 2. Attach a self-contained test case that reproduces the problem. If any special server configuration is needed, let me know. If not, I'll set up a local ftp server. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. You are the assignee for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 688007] WebClient.OpenRead() fails when trying to access an anonymous ftp site
https://bugzilla.novell.com/show_bug.cgi?id=688007 https://bugzilla.novell.com/show_bug.cgi?id=688007#c5 QuickJack . changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | --- Comment #5 from QuickJack . 2011-04-26 23:09:44 UTC --- I reopen the bug because the issue is not yet fixed. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. You are the assignee for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 688007] WebClient.OpenRead() fails when trying to access an anonymous ftp site
https://bugzilla.novell.com/show_bug.cgi?id=688007 https://bugzilla.novell.com/show_bug.cgi?id=688007#c4 --- Comment #4 from QuickJack . 2011-04-26 23:08:03 UTC --- I have built Mono and MonoDevelop from git master. Unfortunately, this had crashed my whole Mono installation. After having fixed the issue, I tested the current implementation. WebClient.OpenRead() is still not working and throws an exception in FtpWebRequest.set_Credentials "Argument cannot be null". However, explicitly setting the credentials before calling WebClient.OpenRead() works. When accessing a password protected ftp site, credentials must also be set prior to calling WebClient.OpenRead(). It does not work in case the credentials are supplied via the url (like ftp://username:passw...@myftpsite.com). Another problem arises when setting up a system proxy to access the internet. In this case, Mono notoriously tries to connect to proxy:21 when accessing an anonymous ftp site. But my proxy port is 3128! -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. You are the assignee for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 688007] WebClient.OpenRead() fails when trying to access an anonymous ftp site
https://bugzilla.novell.com/show_bug.cgi?id=688007 https://bugzilla.novell.com/show_bug.cgi?id=688007#c3 --- Comment #3 from QuickJack . 2011-04-18 18:55:58 UTC --- Thanks for fixing the issue in time. I will continue to check the fixes with my web application tomorrow. I need to use WebClient because it should be possible to specify any kind of resource not only ftp sites via web.config. It would have worked, if the correct credentials for anonymous ftp access would have been set before calling OpenRead(). But this should not be necessary according to the original specification. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. You are the assignee for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 688007] WebClient.OpenRead() fails when trying to access an anonymous ftp site
https://bugzilla.novell.com/show_bug.cgi?id=688007 https://bugzilla.novell.com/show_bug.cgi?id=688007#c2 Gonzalo Paniagua Javier changed: What|Removed |Added Status|NEW |RESOLVED CC||gonz...@novell.com Resolution||FIXED --- Comment #2 from Gonzalo Paniagua Javier 2011-04-17 18:01:12 UTC --- Fixed in master/5fbcc7c and mono-2-10/5f8f481. If you had tried using the FtpWebRequest directly instead of through WebClient, it would have worked fine. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. You are the assignee for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 688007] WebClient.OpenRead() fails when trying to access an anonymous ftp site
https://bugzilla.novell.com/show_bug.cgi?id=688007 https://bugzilla.novell.com/show_bug.cgi?id=688007#c1 --- Comment #1 from QuickJack . 2011-04-16 17:30:46 UTC --- This is a very basic functionality. I can't believe that such a trivial feature is not working in Mono 2.10.1. I think, it should be fixed before the next release. It is especially annoying for me, because I need this feature in one of my web applications to access a password protected ftp site. I tried everything, but was not successful in any way. After that I created the above test case to demonstrate that WebClient.OpenRead() does not even work when trying to access a standard anonymous ftp site. It is important to note, that my web application is currently running under .Net Framework without problems. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. You are the assignee for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs