2 // System.Web.Services.Protocols.HttpWebClientProtocol.cs
\r
5 // Tim Coleman (tim@timcoleman.com)
\r
7 // Copyright (C) Tim Coleman, 2002
\r
11 using System.ComponentModel;
\r
13 using System.Security.Cryptography.X509Certificates;
\r
14 using System.Threading;
\r
15 using System.Web.Services;
\r
17 namespace System.Web.Services.Protocols {
\r
18 public abstract class HttpWebClientProtocol : WebClientProtocol {
\r
22 bool allowAutoRedirect;
\r
23 X509CertificateCollection clientCertificates;
\r
24 CookieContainer cookieContainer;
\r
30 #region Constructors
\r
32 protected HttpWebClientProtocol ()
\r
34 allowAutoRedirect = false;
\r
35 clientCertificates = new X509CertificateCollection ();
\r
36 cookieContainer = null;
\r
37 proxy = null; // FIXME
\r
38 userAgent = String.Format ("Mono Web Services Client Protocol {0}", Environment.Version);
\r
41 #endregion // Constructors
\r
45 [DefaultValue (false)]
\r
46 [WebServicesDescription ("Enable automatic handling of server redirects.")]
\r
47 public bool AllowAutoRedirect {
\r
48 get { return allowAutoRedirect; }
\r
49 set { allowAutoRedirect = value; }
\r
53 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
54 [WebServicesDescription ("The client certificates that will be sent to the server, if the server requests them.")]
\r
55 public X509CertificateCollection ClientCertificates {
\r
56 get { return clientCertificates; }
\r
59 [DefaultValue (null)]
\r
60 [WebServicesDescription ("A container for all cookies received from servers in the current session.")]
\r
61 public CookieContainer CookieContainer {
\r
62 get { return cookieContainer; }
\r
63 set { cookieContainer = value; }
\r
67 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
68 public IWebProxy Proxy {
\r
69 get { return proxy; }
\r
70 set { proxy = value; }
\r
73 [WebServicesDescription ("Sets the user agent http header for the request.")]
\r
74 public string UserAgent {
\r
75 get { return userAgent; }
\r
76 set { userAgent = value; }
\r
79 #endregion // Properties
\r
83 protected override WebRequest GetWebRequest (Uri uri)
\r
86 throw new InvalidOperationException ("The uri parameter is a null reference.");
\r
87 return WebRequest.Create (uri);
\r
90 protected override WebResponse GetWebResponse (WebRequest request)
\r
92 return request.GetResponse ();
\r
95 protected override WebResponse GetWebResponse (WebRequest request, IAsyncResult result)
\r
97 IAsyncResult ar = request.BeginGetResponse (null, null);
\r
98 ar.AsyncWaitHandle.WaitOne ();
\r
99 return request.EndGetResponse (result);
\r
102 #endregion // Methods
\r