[Mono-bugs] [Bug 39374][Nor] New - invalid implementation of System.Net.WebClient.OpenRead?
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Sat, 8 Mar 2003 19:43:00 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by mathias.hasselmann@gmx.de.
http://bugzilla.ximian.com/show_bug.cgi?id=39374
--- shadow/39374 Sat Mar 8 19:43:00 2003
+++ shadow/39374.tmp.11394 Sat Mar 8 19:43:00 2003
@@ -0,0 +1,47 @@
+Bug#: 39374
+Product: Mono/Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: mathias.hasselmann@gmx.de
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: invalid implementation of System.Net.WebClient.OpenRead?
+
+The implementation of System.Net.WebClient.OpenRead in Mono 0.22 only
+supports the fixed URL schemes "http", "https" and "file". Since
+System.Net.WebRequest supports registering of custom WebRequest factories
+(interface IWebRequestCreate) I consider this as an unnecessary limitation
+which easily could be overcome by changing the current implementation of
+OpenRead:
+
+public Stream OpenRead (string address)
+{
+ Uri uri = new Uri (address);
+ WebRequest request = null;
+
+ if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
+ request = new HttpWebRequest (uri);
+ else if(uri.Scheme == Uri.UriSchemeFile)
+ request = new FileWebRequest (uri);
+ else
+ throw new NotImplementedException ();
+
+ return request.GetResponse ().GetResponseStream ();
+}
+
+into something like this:
+
+public Stream OpenRead (string address)
+{
+ WebRequest request = WebRequest.Create(address);
+ return request.GetResponse().GetResponseStream();
+}