[Mono-bugs] [Bug 43379][Wis] Changed - Missing WebException.Response property.
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Wed, 21 May 2003 11:20:26 -0400 (EDT)
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 bmaurer@users.sf.net.
http://bugzilla.ximian.com/show_bug.cgi?id=43379
--- shadow/43379 Tue May 20 11:26:11 2003
+++ shadow/43379.tmp.6950 Wed May 21 11:20:26 2003
@@ -5,13 +5,13 @@
OS Details:
Status: NEW
Resolution:
Severity: Unknown
Priority: Wishlist
Component: System
-AssignedTo: mono-bugs@ximian.com
+AssignedTo: bmaurer@users.sf.net
ReportedBy: ben.luckham@bimtech.co.uk
QAContact: mono-bugs@ximian.com
TargetMilestone: ---
URL:
Cc:
Summary: Missing WebException.Response property.
@@ -87,6 +87,47 @@
-----Sample program ends here-----
------- Additional Comments From ben.luckham@bimtech.co.uk 2003-05-20 11:26 -------
Sorry! When I'm babbling on about "new behaviour", I'm referring to
HttpWebRequest.GetResponse() and not HttpWebResponse.GetResponse() as
I wrote.
+
+------- Additional Comments From bmaurer@users.sf.net 2003-05-21 11:20 -------
+Code from the method follows:
+
+
+ public override WebResponse EndGetResponse
+(IAsyncResult asyncResult)
+ {
+ if (asyncResult == null)
+ throw new ArgumentNullException
+("asyncResult");
+ if (!asyncResult.IsCompleted)
+ asyncResult.AsyncWaitHandle.WaitOne
+();
+ AsyncResult async = (AsyncResult) asyncResult;
+ GetResponseCallback cb =
+(GetResponseCallback) async.AsyncDelegate;
+ WebResponse webResponse = cb.EndInvoke
+(asyncResult);
+ asyncResponding = false;
+ if (webResponse != null) {
+ HttpStatusCode code =
+((HttpWebResponse) webResponse).StatusCode;
+ if (code >=
+HttpStatusCode.MultipleChoices) {
+ string msg = String.Format
+("The remote server returned an error: " +
+ "(
+{0}) {1}", (int) code, code);
+ throw new WebException (msg);
+ }
+ }
+
+ return webResponse;
+ }
+
+It looks like we need to add more things when we throw the exception.
+I will look into this.
+
+Can you please write NUnit tests for this, and attach the cvs diff -u
+to this bug. It should test for all the values of the exception.