[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System/Net CredentialCache.cs, 1.3, 1
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System/Net CredentialCache.cs, 1.3, 1.4 GlobalProxySelection.cs, 1.2, 1.3 NetworkCredential.cs, 1.2, 1.3 ServicePoint.cs, 1.2, 1.3 WebProxy.cs, 1.2, 1.3 |
Date: |
Wed, 27 Aug 2003 23:12:22 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System/Net
In directory subversions:/tmp/cvs-serv7878/System/Net
Modified Files:
CredentialCache.cs GlobalProxySelection.cs
NetworkCredential.cs ServicePoint.cs WebProxy.cs
Log Message:
Missing functionality in "System.Net".
Index: CredentialCache.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/CredentialCache.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** CredentialCache.cs 10 Jun 2002 04:14:15 -0000 1.3
--- CredentialCache.cs 28 Aug 2003 03:12:20 -0000 1.4
***************
*** 1,7 ****
/*
! * CredentialCache.cs - Implementation of the "System.Net.CredentialCache"
class.
*
! * Copyright (C) 2002 Southern Storm Software, Pty Ltd.
! * Contributions from Charlie Carnow <address@hidden>
*
* This program is free software; you can redistribute it and/or modify
--- 1,7 ----
/*
! * CredentialCache.cs - Implementation of the
! * "System.Net.CredentialCache" class.
*
! * Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
***************
*** 20,115 ****
*/
-
namespace System.Net
{
! using System.Net;
! using System.Collections;
! using System;
! public class CredentialCache : ICredentials, IEnumerable
{
! private Hashtable cache;
! private static CredentialCache defaultCred;
! public CredentialCache()
! {
! // TODO: Set defaultCred to Credentials of the current
! // process
! cache = new Hashtable();
! }
!
! public void Add(Uri uriPrefix, string authtype,
NetworkCredential cred)
! {
! if (uriPrefix == null || authtype == null)
{
! throw new ArgumentNullException();
}
! if(cache.Contains(uriPrefix) == false)
{
! cache[uriPrefix] = new Hashtable();
}
!
! if(((Hashtable)(cache[uriPrefix])).Contains(authtype))
{
! throw new ArgumentException();
}
- ((Hashtable)(cache[uriPrefix]))[authtype] = cred;
- }
-
- public NetworkCredential GetCredential(Uri uriPrefix, string authType)
- {
- if (uriPrefix == null || authType == null)
- {
- throw new ArgumentNullException();
- }
-
- if (cache.Contains(uriPrefix))
- {
- if (((Hashtable)(cache[uriPrefix])).Contains(authType))
- {
- return (NetworkCredential)
-
(((Hashtable)(cache[uriPrefix]))[authType]);
- }
- }
- // Didn't find credential
- return null;
! }
!
! public IEnumerator GetEnumerator()
! {
! return cache.GetEnumerator();
! }
!
! public void Remove(Uri uriPrefix, string authType)
! {
! if (cache.Contains(uriPrefix))
! {
! if (((Hashtable)(cache[uriPrefix])).Contains(authType))
{
!
((Hashtable)(cache[uriPrefix])).Remove(authType);
}
- }
-
- }
-
- public static ICredentials DefaultCredentials
- {
- get
- {
- return defaultCred;
- }
- }
- }
-
- }
-
-
-
-
--- 20,245 ----
*/
namespace System.Net
{
!
! using System.Collections;
! using System.Globalization;
!
! public class CredentialCache : ICredentials, IEnumerable
! {
! // Internal state.
! private static NetworkCredential defaultCredentials;
! private CredentialInfo list;
!
! // Information about a specific credential.
! private class CredentialInfo
{
! public Uri uriPrefix;
! public String authType;
! public NetworkCredential cred;
! public CredentialInfo next;
!
! }; // class CredentialInfo
!
! // Constructor.
! public CredentialCache()
{
! list = null;
}
! // Get the default system credentials.
! public static ICredentials DefaultCredentials
{
! get
! {
! lock(typeof(CredentialCache))
! {
! if(defaultCredentials == null)
! {
! defaultCredentials =
new NetworkCredential
! (String.Empty,
String.Empty, String.Empty);
! }
! return defaultCredentials;
! }
! }
}
!
! // Add credentials to this cache.
! public void Add(Uri uriPrefix, String authType, NetworkCredential cred)
{
! if(uriPrefix == null)
! {
! throw new
ArgumentNullException("uriPrefix");
! }
! if(authType == null)
! {
! throw new
ArgumentNullException("authType");
! }
! CredentialInfo info = list;
! CredentialInfo last = null;
! while(info != null)
! {
! if(info.uriPrefix.Equals(uriPrefix) &&
! String.Compare(info.authType,
authType, true,
!
CultureInfo.InvariantCulture) == 0)
! {
! throw new ArgumentException
!
(S._("Arg_DuplicateCredentials"));
! }
! last = info;
! info = info.next;
! }
! info = new CredentialInfo();
! info.uriPrefix = uriPrefix;
! info.authType = authType;
! info.cred = cred;
! info.next = null;
! if(last != null)
! {
! last.next = info;
! }
! else
! {
! list = info;
! }
}
! // Determine if we have a credential match.
! private static bool Matches(CredentialInfo info, Uri uriPrefix,
! String authType)
{
! if(String.Compare(info.authType, authType, true,
!
CultureInfo.InvariantCulture) != 0)
! {
! return false;
! }
! return info.uriPrefix.IsPrefix(uriPrefix);
}
+ // Get the credentials for a specific uri/auth combination.
+ public NetworkCredential GetCredential(Uri uriPrefix, String authType)
+ {
+ if(uriPrefix == null)
+ {
+ throw new
ArgumentNullException("uriPrefix");
+ }
+ if(authType == null)
+ {
+ throw new
ArgumentNullException("authType");
+ }
+ CredentialInfo info = list;
+ CredentialInfo longest = null;
+ while(info != null)
+ {
+ if(Matches(info, uriPrefix, authType))
+ {
+ if(longest != null)
+ {
+
if(longest.uriPrefix.ToString().Length <
+
info.uriPrefix.ToString().Length)
+ {
+ longest = info;
+ }
+ }
+ else
+ {
+ longest = info;
+ }
+ }
+ info = info.next;
+ }
+ if(longest != null)
+ {
+ return longest.cred;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ // Get an enumerator for this credential cache.
+ public IEnumerator GetEnumerator()
+ {
+ return new CredentialEnumerator(this);
+ }
+ // Remove a specific uri/auth combination.
+ public void Remove(Uri uriPrefix, String authType)
+ {
+ CredentialInfo info = list;
+ CredentialInfo last = null;
+ while(info != null)
+ {
+ if(info.uriPrefix.Equals(uriPrefix) &&
+ String.Compare(info.authType,
authType, true,
+
CultureInfo.InvariantCulture) == 0)
+ {
+ if(last != null)
+ {
+ last.next = info.next;
+ }
+ else
+ {
+ list = info.next;
+ }
+ return;
+ }
+ last = info;
+ info = info.next;
+ }
+ }
+ // Enumerator class for credential caches.
+ private sealed class CredentialEnumerator : IEnumerator
+ {
+ // Internal state.
+ private CredentialCache cache;
+ private CredentialInfo current;
+ private CredentialInfo next;
+
+ // Constructor.
+ public CredentialEnumerator(CredentialCache cache)
+ {
+ this.cache = cache;
+ this.current = null;
+ this.next = cache.list;
+ }
+
+ // Implement the IEnumerator interface.
+ public bool MoveNext()
+ {
+ if(next != null)
+ {
+ current = next;
+ next = current.next;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ public void Reset()
+ {
+ current = null;
+ next = cache.list;
+ }
+ public Object Current
+ {
+ get
+ {
+ if(current == null)
+ {
+ throw new
InvalidOperationException
+
(S._("Invalid_BadEnumeratorPosition"));
+ }
+ return current.cred;
+ }
+ }
+ }; // class CredentialEnumerator
+ }; // class CredentialCache
+ }; // namespace System.Net
Index: GlobalProxySelection.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/GlobalProxySelection.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** GlobalProxySelection.cs 25 May 2003 10:15:21 -0000 1.2
--- GlobalProxySelection.cs 28 Aug 2003 03:12:20 -0000 1.3
***************
*** 1,9 ****
/*
! * GlobalProxySelection.cs - Implementation of the
"System.Net.GlobalProxySelection" class.
*
! * Copyright (C) 2002 Free Software Foundation, Inc.
*
- * Contributed by Jason Lee <address@hidden>
- *
* This program is free software, you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
--- 1,8 ----
/*
! * GlobalProxySelection.cs - Implementation of the
! * "System.Net.GlobalProxySelection" class.
*
! * Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software, you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
***************
*** 24,111 ****
{
- using System;
- using System.Net;
-
public class GlobalProxySelection
{
! private static IWebProxy globalProxy = new EmptyProxy();
!
! // Constructors
!
! #if !ECMA_COMPAT
! public
! #else
! protected
! #endif
! GlobalProxySelection()
! {
!
! }
!
! // Methods
!
public static IWebProxy GetEmptyWebProxy()
- {
- return new EmptyProxy();
- }
-
- // Properties
-
- // TODO: Figure out security permissions (see spec)
- public static IWebProxy Select
- {
- get
- {
- return globalProxy;
- }
-
- set
- {
- if(value == null)
{
! globalProxy = GetEmptyWebProxy();
}
! else
{
! globalProxy= value;
}
- }
- }
-
- // Internal Classes
! // See IWebProxy.cs
! internal class EmptyProxy : IWebProxy
{
! ICredentials credentials = null;
!
! internal EmptyProxy() {}
public Uri GetProxy(Uri destination)
! {
! return destination;
! }
public bool IsBypassed(Uri host)
! {
! return true;
! }
public ICredentials Credentials
! {
! get
! {
! return credentials;
! }
! set
! {
! credentials = value;
! }
! }
! }
! } // class GlobalProxySelection
! } // namespace System.net
--- 23,104 ----
{
public class GlobalProxySelection
{
+ // Internal state.
+ private static IWebProxy select;
! // Create a new empty proxy.
public static IWebProxy GetEmptyWebProxy()
{
! return new EmptyWebProxy();
}
!
! // Get or set the selected global proxy object.
! [TODO]
! public static IWebProxy Select
{
! get
! {
! lock(typeof(GlobalProxySelection))
! {
! if(select == null)
! {
! // TODO: read the proxy
information from
! // the configuration
settings.
! select = new
EmptyWebProxy();
! }
! return select;
! }
! }
! set
! {
! if(value == null)
! {
! throw new
ArgumentNullException("value");
! }
! lock(typeof(GlobalProxySelection))
! {
! select = value;
! }
! }
}
! // Dummy class that represents empty proxy settings.
! private class EmptyWebProxy : IWebProxy
{
+ // Internal state.
+ private ICredentials credentials;
! // Constructor.
! public EmptyWebProxy() {}
+ // Get proxy information for a destination.
public Uri GetProxy(Uri destination)
! {
! return destination;
! }
+ // Determine if the proxy is bypassed for a host
public bool IsBypassed(Uri host)
! {
! return true;
! }
+ // Get or set the proxy credentials.
public ICredentials Credentials
! {
! get
! {
! return credentials;
! }
! set
! {
! credentials = value;
! }
! }
!
! }; // class EmptyWebProxy
! }; // class GlobalProxySelection
! }; // namespace System.Net
Index: NetworkCredential.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/NetworkCredential.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** NetworkCredential.cs 21 Apr 2002 03:24:53 -0000 1.2
--- NetworkCredential.cs 28 Aug 2003 03:12:20 -0000 1.3
***************
*** 1,6 ****
/*
! * NetworkCredential.cs - Implementation of the
"System.Net.NetworkCredential" class.
*
! * Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
--- 1,7 ----
/*
! * NetworkCredential.cs - Implementation of the
! * "System.Net.NetworkCredential" class.
*
! * Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
***************
*** 22,43 ****
{
- [TODO]
public class NetworkCredential : ICredentials
{
public NetworkCredential() {}
!
! public NetworkCredential(String userName, String password) {}
!
! public NetworkCredential(String userName, String password, String
domain) {}
!
public NetworkCredential GetCredential(Uri uri, String authType)
! { return null; }
!
! public String Domain { get{ return null; } set{} }
!
! public String Password { get{ return null; } set{} }
! public String UserName { get{ return null; } set{} }
! }; //class NetworkCredential
! }; //namespace System.Net
--- 23,89 ----
{
public class NetworkCredential : ICredentials
{
+ // Internal state.
+ private String userName;
+ private String password;
+ private String domain;
+
+ // Constructors.
public NetworkCredential() {}
! public NetworkCredential(String userName, String password)
! {
! this.userName = userName;
! this.password = password;
! }
! public NetworkCredential(String userName, String password, String
domain)
! {
! this.userName = userName;
! this.password = password;
! this.domain = domain;
! }
!
! // Get or set this object's properties.
! public String Domain
! {
! get
! {
! return domain;
! }
! set
! {
! domain = value;
! }
! }
! public String Password
! {
! get
! {
! return password;
! }
! set
! {
! password = value;
! }
! }
! public String UserName
! {
! get
! {
! return userName;
! }
! set
! {
! userName = value;
! }
! }
!
! // Get credential information for a URI and authentication type.
public NetworkCredential GetCredential(Uri uri, String authType)
! {
! return this;
! }
! }; // class NetworkCredential
! }; // namespace System.Net
Index: ServicePoint.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/ServicePoint.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** ServicePoint.cs 21 Apr 2002 03:24:53 -0000 1.2
--- ServicePoint.cs 28 Aug 2003 03:12:20 -0000 1.3
***************
*** 2,6 ****
* ServicePoint.cs - Implementation of the "System.Net.ServicePoint" class.
*
! * Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
--- 2,6 ----
* ServicePoint.cs - Implementation of the "System.Net.ServicePoint" class.
*
! * Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
***************
*** 22,47 ****
{
- [TODO]
public class ServicePoint
{
! public override int GetHashCode() { return 0; }
!
! public Uri Address { get{ return null; } }
!
! public int ConnectionLimit { get{ return 0; } set{} }
!
! public String ConnectionName { get{ return null; } }
!
! public int CurrentConnections { get{ return 0; } }
!
! public DateTime IdleSince { get{ return DateTime.MinValue; } }
!
! public int MaxIdleTime { get{ return 0; } set{} }
!
! public virtual Version ProtocolVersion { get{ return new Version(0, 0);
} }
! public bool SupportsPipelining { get{ return false; } }
! }; //class ServicePoint
! }; //namespace System.Net
--- 22,156 ----
{
+ using System.Security.Cryptography.X509Certificates;
public class ServicePoint
{
! // Internal state.
! internal Uri address;
! #if CONFIG_X509_CERTIFICATES
! internal X509Certificate certificate;
! internal X509Certificate clientCertificate;
! #endif
! internal int connectionLimit;
! internal String connectionName;
! internal int currentConnections;
! internal DateTime idleSince;
! internal int maxIdleTime;
! internal Version version;
! internal bool supportsPipelining;
! internal bool useNagleAlgorithm;
!
! // Constructor.
! internal ServicePoint()
! {
! maxIdleTime = -1;
! }
!
! // Get this object's properties.
! public Uri Address
! {
! get
! {
! return address;
! }
! }
! #if CONFIG_X509_CERTIFICATES
! public X509Certificate Certificate
! {
! get
! {
! return certificate;
! }
! }
! public X509Certificate ClientCertificate
! {
! get
! {
! return clientCertificate;
! }
! }
! #endif
! public int ConnectionLimit
! {
! get
! {
! return connectionLimit;
! }
! set
! {
! if(value <= 0)
! {
! throw new
ArgumentOutOfRangeException
! ("value",
S._("ArgRange_PositiveNonZero"));
! }
! connectionLimit = value;
! }
! }
! public String ConnectionName
! {
! get
! {
! return connectionName;
! }
! }
! public int CurrentConnections
! {
! get
! {
! return currentConnections;
! }
! }
! public DateTime IdleSince
! {
! get
! {
! return idleSince;
! }
! }
! public int MaxIdleTime
! {
! get
! {
! return maxIdleTime;
! }
! set
! {
! if(value < -1)
! {
! throw new
ArgumentOutOfRangeException
! ("value",
S._("ArgRange_NonNegOrNegOne"));
! }
! maxIdleTime = value;
! }
! }
! public virtual Version ProtocolVersion
! {
! get
! {
! return version;
! }
! }
! public bool SupportsPipelining
! {
! get
! {
! return supportsPipelining;
! }
! }
! public bool UseNagleAlgorithm
! {
! get
! {
! return useNagleAlgorithm;
! }
! }
!
! // Get the hash code for this object.
! public override int GetHashCode()
! {
! return base.GetHashCode();
! }
! }; // class ServicePoint
! }; // namespace System.Net
Index: WebProxy.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/WebProxy.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** WebProxy.cs 13 Aug 2003 01:21:40 -0000 1.2
--- WebProxy.cs 28 Aug 2003 03:12:20 -0000 1.3
***************
*** 3,7 ****
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
- * Copyright (C) 2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
--- 3,6 ----
***************
*** 26,30 ****
using System.Runtime.Serialization;
- [TODO]
public class WebProxy : IWebProxy
#if CONFIG_SERIALIZATION
--- 25,28 ----
***************
*** 32,188 ****
#endif
{
! [TODO]
! public WebProxy()
! {
! throw new NotImplementedException(".ctor");
! }
!
! [TODO]
! public WebProxy(string Address)
! {
! throw new NotImplementedException(".ctor");
! }
!
! [TODO]
public WebProxy(Uri Address)
! {
! throw new NotImplementedException(".ctor");
! }
!
#if CONFIG_SERIALIZATION
! [TODO]
! protected WebProxy(SerializationInfo serializationInfo,
StreamingContext streamingContext)
! {
! throw new NotImplementedException(".ctor");
! }
#endif
! [TODO]
! public WebProxy(string Address, bool BypassOnLocal)
! {
! throw new NotImplementedException(".ctor");
! }
!
! [TODO]
! public WebProxy(string Host, int Port)
! {
! throw new NotImplementedException(".ctor");
! }
!
! [TODO]
! public WebProxy(Uri Address, bool BypassOnLocal)
! {
! throw new NotImplementedException(".ctor");
! }
!
! [TODO]
! public WebProxy(string Address, bool BypassOnLocal, string[] BypassList)
! {
! throw new NotImplementedException(".ctor");
! }
!
! [TODO]
! public WebProxy(Uri Address, bool BypassOnLocal, string[] BypassList)
! {
! throw new NotImplementedException(".ctor");
! }
! [TODO]
! public WebProxy(string Address, bool BypassOnLocal, string[]
BypassList, ICredentials Credentials)
! {
! throw new NotImplementedException(".ctor");
! }
!
! [TODO]
! public WebProxy(Uri Address, bool BypassOnLocal, string[] BypassList,
ICredentials Credentials)
! {
! throw new NotImplementedException(".ctor");
! }
!
! [TODO]
public Uri Address
! {
! get
! {
! throw new NotImplementedException("Address");
! }
! set
! {
! throw new NotImplementedException("Address");
! }
! }
!
! [TODO]
public ArrayList BypassArrayList
! {
! get
! {
! throw new NotImplementedException("BypassArrayList");
! }
! }
!
! [TODO]
! public string[] BypassList
! {
! get
! {
! throw new NotImplementedException("BypassList");
! }
! set
! {
! throw new NotImplementedException("BypassList");
! }
! }
!
! [TODO]
public bool BypassProxyOnLocal
! {
! get
! {
! throw new NotImplementedException("BypassProxyOnLocal");
! }
! set
! {
! throw new NotImplementedException("BypassProxyOnLocal");
! }
! }
!
! [TODO]
public virtual ICredentials Credentials
! {
! get
! {
! throw new NotImplementedException("Credentials");
! }
! set
! {
! throw new NotImplementedException("Credentials");
! }
! }
[TODO]
public static WebProxy GetDefaultProxy()
! {
! throw new NotImplementedException("GetDefaultProxy");
! }
! [TODO]
public virtual Uri GetProxy(Uri destination)
! {
! throw new NotImplementedException("GetProxy");
! }
[TODO]
public virtual bool IsBypassed(Uri host)
! {
! throw new NotImplementedException("IsBypassed");
! }
#if CONFIG_SERIALIZATION
! [TODO]
! void ISerializable.GetObjectData(SerializationInfo serializationInfo,
StreamingContext streamingContext)
! {
! throw new
NotImplementedException("ISerializable.GetObjectData");
! }
#endif
--- 30,239 ----
#endif
{
! // Internal state.
! private Uri address;
! private bool bypassOnLocal;
! private ArrayList bypassList;
! private ICredentials credentials;
!
! // Constructors.
! public WebProxy() {}
! public WebProxy(String Address)
! {
! if(Address != null)
! {
! if(Address.IndexOf("://") == -1)
! {
! address = new Uri("http://" +
Address);
! }
! else
! {
! address = new Uri(Address);
! }
! }
! }
public WebProxy(Uri Address)
! {
! address = Address;
! }
! public WebProxy(String Address, bool BypassOnLocal)
! : this(Address)
! {
! bypassOnLocal = BypassOnLocal;
! }
! public WebProxy(String Host, int Port)
! {
! address = new Uri("http://" + Host + ":" +
Port.ToString());
! }
! public WebProxy(Uri Address, bool BypassOnLocal)
! {
! address = Address;
! bypassOnLocal = BypassOnLocal;
! }
! public WebProxy(String Address, bool BypassOnLocal, String[] BypassList)
! : this(Address)
! {
! bypassOnLocal = BypassOnLocal;
! bypassList = MakeBypassList(BypassList);
! }
! public WebProxy(Uri Address, bool BypassOnLocal, String[] BypassList)
! {
! address = Address;
! bypassOnLocal = BypassOnLocal;
! bypassList = MakeBypassList(BypassList);
! }
! public WebProxy(String Address, bool BypassOnLocal,
! String[] BypassList, ICredentials
Credentials)
! : this(Address)
! {
! bypassOnLocal = BypassOnLocal;
! bypassList = MakeBypassList(BypassList);
! credentials = Credentials;
! }
! public WebProxy(Uri Address, bool BypassOnLocal,
! String[] BypassList, ICredentials
Credentials)
! {
! address = Address;
! bypassOnLocal = BypassOnLocal;
! bypassList = MakeBypassList(BypassList);
! credentials = Credentials;
! }
#if CONFIG_SERIALIZATION
! protected WebProxy(SerializationInfo serializationInfo,
! StreamingContext streamingContext)
! {
! if(serializationInfo == null)
! {
! throw new
ArgumentNullException("serializationInfo");
! }
! bypassOnLocal =
serializationInfo.GetBoolean("_BypassOnLocal");
! address = (Uri)(serializationInfo.GetValue
! ("_ProxyAddress", typeof(Uri)));
! bypassList =
(ArrayList)(serializationInfo.GetValue
! ("_BypassList",
typeof(ArrayList)));
! }
#endif
! // Make a bypass list from a list of strings.
! private static ArrayList MakeBypassList(String[] list)
! {
! if(list == null)
! {
! return new ArrayList();
! }
! else
! {
! return new ArrayList(list);
! }
! }
! // Get or set this object's properties.
public Uri Address
! {
! get
! {
! return address;
! }
! set
! {
! address = value;
! }
! }
public ArrayList BypassArrayList
! {
! get
! {
! return bypassList;
! }
! }
! public String[] BypassList
! {
! get
! {
! return
(String[])(bypassList.ToArray(typeof(String)));
! }
! set
! {
! bypassList = MakeBypassList(value);
! }
! }
public bool BypassProxyOnLocal
! {
! get
! {
! return bypassOnLocal;
! }
! set
! {
! bypassOnLocal = value;
! }
! }
public virtual ICredentials Credentials
! {
! get
! {
! return credentials;
! }
! set
! {
! credentials = value;
! }
! }
+ // Get the default proxy settings from the system configuration.
[TODO]
public static WebProxy GetDefaultProxy()
! {
! // TODO: read the system configuration
! return new WebProxy();
! }
! // Get the proxy to use for a particular URI destination.
public virtual Uri GetProxy(Uri destination)
! {
! if(IsBypassed(destination))
! {
! return destination;
! }
! else if(address != null)
! {
! return address;
! }
! else
! {
! return destination;
! }
! }
+ // Dtermine if a URI destination has been bypassed.
[TODO]
public virtual bool IsBypassed(Uri host)
! {
! if(host.IsLoopback)
! {
! return true;
! }
! if(bypassOnLocal && host.Host.IndexOf('.') ==
-1)
! {
! return true;
! }
! // TODO: scan the regexes in the bypass list
for a match
! return false;
! }
#if CONFIG_SERIALIZATION
!
! // Serialize this object.
! void ISerializable.GetObjectData(SerializationInfo serializationInfo,
!
StreamingContext streamingContext)
! {
! if(serializationInfo == null)
! {
! throw new
ArgumentNullException("serializationInfo");
! }
! serializationInfo.AddValue("_BypassOnLocal",
bypassOnLocal);
! serializationInfo.AddValue("_ProxyAddress",
address);
! serializationInfo.AddValue("_BypassList",
bypassList);
! }
!
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System/Net CredentialCache.cs, 1.3, 1.4 GlobalProxySelection.cs, 1.2, 1.3 NetworkCredential.cs, 1.2, 1.3 ServicePoint.cs, 1.2, 1.3 WebProxy.cs, 1.2, 1.3,
Rhys Weatherley <address@hidden> <=