//\r
// Copyright (C) Tim Coleman, 2002\r
//\r
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
\r
using System.Collections.Specialized;\r
using System.ComponentModel;\r
//\r
// Used by SoapHttpClientProtocol, use this to avoid creating a new Uri on each invocation.\r
//\r
- protected internal Uri uri;\r
+ internal Uri uri;\r
\r
//\r
// Points to the current request, so we can call Abort() on it\r
\r
protected virtual WebRequest GetWebRequest (Uri uri)\r
{\r
+ if (uri == null)\r
+ throw new InvalidOperationException ("uri is null");\r
+\r
current_request = WebRequest.Create (uri);\r
- current_request.Timeout = Timeout;\r
+ current_request.Timeout = timeout;\r
+ current_request.PreAuthenticate = preAuthenticate;\r
+ current_request.ConnectionGroupName = connectionGroupName;\r
\r
if (credentials != null)\r
current_request.Credentials = credentials;\r
- if (connectionGroupName != String.Empty)\r
- current_request.ConnectionGroupName = connectionGroupName;\r
\r
return current_request;\r
}\r
{\r
if (abort)\r
throw new WebException ("The operation has been aborted.", WebExceptionStatus.RequestCanceled);\r
- return request.GetResponse ();\r
+\r
+ WebResponse response = null;\r
+ try {\r
+ request.Timeout = timeout;\r
+ response = request.GetResponse ();\r
+ } catch (WebException e) {\r
+ response = e.Response;\r
+ if (response == null)\r
+ throw;\r
+ }\r
+\r
+ return response;\r
}\r
\r
protected virtual WebResponse GetWebResponse (WebRequest request, IAsyncResult result)\r
if (abort)\r
throw new WebException ("The operation has been aborted.", WebExceptionStatus.RequestCanceled);\r
\r
- IAsyncResult ar = request.BeginGetResponse (null, null);\r
- ar.AsyncWaitHandle.WaitOne ();\r
return request.EndGetResponse (result);\r
}\r
\r