[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System/Net DnsPermissionAttribute.cs
From: |
Gopal.V <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System/Net DnsPermissionAttribute.cs,NONE,1.1 DnsPermission.cs,NONE,1.1 GlobalProxySelection.cs,NONE,1.1 WebResponse.cs,1.2,1.3 |
Date: |
Fri, 03 Jan 2003 08:52:42 -0500 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System/Net
In directory subversions:/tmp/cvs-serv14807/System/Net
Modified Files:
WebResponse.cs
Added Files:
DnsPermissionAttribute.cs DnsPermission.cs
GlobalProxySelection.cs
Log Message:
Patch #913 for ECMA compatibility
--- NEW FILE ---
/*
* DnsPermissionAttribute.cs - Implementation of the
"System.Net.DnsPermissionAttribute" 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
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY, without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program, if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Net
{
using System;
using System.Security;
using System.Security.Permissions;
[AttributeUsage(AttributeTargets.Assembly |
AttributeTargets.Class |
AttributeTargets.Struct |
AttributeTargets.Constructor |
AttributeTargets.Method,
AllowMultiple=true, Inherited=false)]
public sealed class DnsPermissionAttribute : CodeAccessSecurityAttribute
{
// Constructor
public DnsPermissionAttribute(SecurityAction action) : base (action)
{
}
// Methods
public override IPermission CreatePermission()
{
if(this.Unrestricted)
{
return new DnsPermission(PermissionState.Unrestricted);
}
return new DnsPermission(PermissionState.None);
}
} // class DnsPermissionAttribute
} //namespace System.Net
--- NEW FILE ---
/*
* DnsPermission.cs - Implementation of the "System.Net.DnsPermission" 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
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY, without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program, if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Net
{
using System;
using System.Security;
using System.Security.Permissions;
public class DnsPermission : CodeAccessPermission
{
bool restrictedState = true;
// Default constructor with option of setting the restricted state
// to either unrestricted (1) or fully restricted (0)
public DnsPermission (PermissionState state)
{
if(state == PermissionState.Unrestricted)
{
restrictedState = false;
}
else
{
if(state != PermissionState.None)
{
throw new ArgumentException("Not a valid state
value");
}
}
}
// Methods
public override IPermission Copy()
{
return this;
}
[TODO]
//Once System XML is fully implemented
public override void FromXml(SecurityElement securityElement)
{
}
public override IPermission Intersect(IPermission target)
{
if(target == null)
{
throw new ArgumentNullException("IPermission");
}
DnsPermission newTarget = target as DnsPermission;
if(newTarget == null)
{
throw new ArgumentException();
}
if(!restrictedState)
{
return newTarget;
}
if(!newTarget.restrictedState)
{
return this;
}
return null;
}
public override bool IsSubsetOf(IPermission target)
{
if(target == null)
{
return false;
}
DnsPermission newTarget = target as DnsPermission;
if(newTarget == null)
{
throw new ArgumentException();
}
if(!restrictedState)
{
if(!newTarget.restrictedState)
{
return true;
}
else
{
return false;
}
}
return true;
}
[TODO]
// Once System XML is fully implemented
public override SecurityElement ToXml()
{
return null;
}
public override IPermission Union(IPermission target)
{
if(target == null)
{
throw new ArgumentNullException("IPermission");
}
DnsPermission newTarget = target as DnsPermission;
if(newTarget == null)
{
throw new ArgumentException();
}
if(IsSubsetOf(newTarget))
{
if((!newTarget.restrictedState) || !restrictedState)
{
return newTarget;
}
}
return null;
}
} // class DnsPermission
} // namespace System.Net
--- NEW FILE ---
/*
* 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
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY, without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program, if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Net
{
using System;
using System.Net;
public class GlobalProxySelection
{
private static IWebProxy globalProxy = new EmptyProxy();
// Constructors
protected 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
Index: WebResponse.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/WebResponse.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** WebResponse.cs 21 Apr 2002 03:24:53 -0000 1.2
--- WebResponse.cs 3 Jan 2003 13:52:40 -0000 1.3
***************
*** 4,7 ****
--- 4,9 ----
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
+ * With contributions from 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
***************
*** 27,53 ****
public abstract class WebResponse : MarshalByRefObject, IDisposable
{
! [TODO]
! protected WebResponse() {}
!
! [TODO]
! public virtual void Close() {}
!
! [TODO]
! public virtual Stream GetResponseStream() { return null; }
!
! [TODO]
! void IDisposable.Dispose() {}
!
! [TODO]
! public virtual long ContentLength { get{ return 0; } set{} }
!
! [TODO]
! public virtual String ContentType { get{ return null; } set{} }
!
! [TODO]
! public virtual WebHeaderCollection Headers { get{ return null; } }
!
! [TODO]
! public virtual Uri ResponseUri { get{ return null; } }
}; //class WebResponse
--- 29,94 ----
public abstract class WebResponse : MarshalByRefObject, IDisposable
{
! // Not used for anything. To create a new instance use Create method.
! protected WebResponse() {
! }
!
! public virtual void Close() {
! throw new NotSupportedException("Close");
! }
!
! public virtual Stream GetResponseStream() {
! throw new NotSupportedException("GetResponseStream");
! }
!
! void IDisposable.Dispose() {
! Close();
! }
!
! public virtual long ContentLength {
! get
! {
! throw new NotSupportedException("ContentLength");
! }
! set
! {
! throw new NotSupportedException("ContentLength");
! }
! }
!
! public virtual String ContentType {
! get
! {
! throw new NotSupportedException("ContentType");
! }
! set
! {
! throw new NotSupportedException("ContentType");
! }
!
! }
!
! public virtual WebHeaderCollection Headers {
! get
! {
! throw new NotSupportedException("Headers");
! }
! set
! {
! throw new NotSupportedException("Headers");
! }
!
! }
!
! public virtual Uri ResponseUri {
! get
! {
! throw new NotSupportedException("ResponseUri");
! }
! set
! {
! throw new NotSupportedException("ResponseUri");
! }
!
! }
}; //class WebResponse
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System/Net DnsPermissionAttribute.cs,NONE,1.1 DnsPermission.cs,NONE,1.1 GlobalProxySelection.cs,NONE,1.1 WebResponse.cs,1.2,1.3,
Gopal.V <address@hidden> <=