You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@@ -136,7 +136,7 @@ namespace System.Net
|
||||
if (auth == null)
|
||||
continue;
|
||||
|
||||
auth.Module = mod;
|
||||
auth.ModuleAuthenticationType = mod.AuthenticationType;
|
||||
return auth;
|
||||
}
|
||||
}
|
||||
@@ -159,7 +159,7 @@ namespace System.Net
|
||||
if (auth == null)
|
||||
continue;
|
||||
|
||||
auth.Module = mod;
|
||||
auth.ModuleAuthenticationType = mod.AuthenticationType;
|
||||
return auth;
|
||||
}
|
||||
}
|
||||
|
@@ -1,35 +0,0 @@
|
||||
//
|
||||
// System.Net.AuthenticationSchemeSelector.cs
|
||||
//
|
||||
// Author:
|
||||
// Gonzalo Paniagua Javier <gonzalo@novell.com>
|
||||
//
|
||||
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#if SECURITY_DEP
|
||||
|
||||
namespace System.Net {
|
||||
public delegate AuthenticationSchemes AuthenticationSchemeSelector (HttpListenerRequest httpRequest);
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,46 +0,0 @@
|
||||
//
|
||||
// System.Net.AuthenticationSchemes.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// (C) 2005 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
using System.Collections;
|
||||
using System.Configuration;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
[Flags]
|
||||
public enum AuthenticationSchemes {
|
||||
None,
|
||||
Digest = 1,
|
||||
Negotiate = 2,
|
||||
Ntlm = 4,
|
||||
IntegratedWindowsAuthentication = 6,
|
||||
Basic = 8,
|
||||
Anonymous = 0x8000,
|
||||
}
|
||||
}
|
||||
|
@@ -1,95 +0,0 @@
|
||||
//
|
||||
// System.Net.Authorization.cs
|
||||
//
|
||||
// Author:
|
||||
// Miguel de Icaza (miguel@ximian.com)
|
||||
// Lawrence Pit (loz@cable.a2000.nl)
|
||||
//
|
||||
// (C) Ximian, Inc. http://www.ximian.com
|
||||
//
|
||||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
namespace System.Net {
|
||||
|
||||
public class Authorization {
|
||||
string token;
|
||||
bool complete;
|
||||
string connectionGroupId;
|
||||
string [] protectionRealm;
|
||||
IAuthenticationModule module;
|
||||
|
||||
public Authorization (string token) : this (token, true)
|
||||
{
|
||||
}
|
||||
|
||||
public Authorization (string token, bool finished)
|
||||
: this (token, finished, null)
|
||||
{
|
||||
}
|
||||
|
||||
public Authorization (string token, bool finished, string connectionGroupId)
|
||||
{
|
||||
this.token = token;
|
||||
this.complete = finished;
|
||||
this.connectionGroupId = connectionGroupId;
|
||||
}
|
||||
|
||||
public string Message {
|
||||
get { return token; }
|
||||
}
|
||||
|
||||
public bool Complete {
|
||||
get { return complete; }
|
||||
}
|
||||
|
||||
public string ConnectionGroupId {
|
||||
get { return connectionGroupId; }
|
||||
}
|
||||
|
||||
public string[] ProtectionRealm {
|
||||
get { return protectionRealm; }
|
||||
set { protectionRealm = value; }
|
||||
}
|
||||
|
||||
internal IAuthenticationModule Module {
|
||||
get { return module; }
|
||||
set { module = value; }
|
||||
}
|
||||
|
||||
static Exception GetMustImplement ()
|
||||
{
|
||||
return new NotImplementedException ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public bool MutuallyAuthenticated
|
||||
{
|
||||
get {
|
||||
throw GetMustImplement ();
|
||||
}
|
||||
set {
|
||||
throw GetMustImplement ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1 +0,0 @@
|
||||
28f2b747b7c503c5a4a8180b0d927f500e9cff8d
|
@@ -1,58 +0,0 @@
|
||||
// ConnectionModes.cs
|
||||
//
|
||||
// This code was automatically generated from
|
||||
// ECMA CLI XML Library Specification.
|
||||
// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
|
||||
// Created: Wed, 5 Sep 2001 06:35:39 UTC
|
||||
// Source file: all.xml
|
||||
// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
|
||||
//
|
||||
// (C) 2001 Ximian, Inc. http://www.ximian.com
|
||||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
|
||||
namespace System.Net {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
enum ConnectionModes {
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
Single = 0,
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
Persistent = 1,
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
Pipeline = 2,
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
Mux = 3,
|
||||
} // ConnectionModes
|
||||
|
||||
} // System.Net
|
@@ -1,107 +0,0 @@
|
||||
//
|
||||
// System.Net.DnsEndPoint
|
||||
//
|
||||
// Authors:
|
||||
// Stephane Delcroix <stephane@delcroix.org>
|
||||
//
|
||||
// (c) 2007, 2009 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace System.Net {
|
||||
|
||||
#if NET_2_1
|
||||
sealed
|
||||
#endif
|
||||
public class DnsEndPoint : EndPoint {
|
||||
string host;
|
||||
int port;
|
||||
AddressFamily addressFamily = AddressFamily.Unspecified;
|
||||
|
||||
public DnsEndPoint (string host, int port)
|
||||
{
|
||||
if (host == null)
|
||||
throw new ArgumentNullException ("host");
|
||||
if (host == String.Empty)
|
||||
throw new ArgumentException ("host parameter contains an empty string");
|
||||
if (port < 0 || port > 0xffff)
|
||||
throw new ArgumentOutOfRangeException ("port is less than 0 or greater than 0xffff");
|
||||
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public DnsEndPoint (string host, int port, AddressFamily addressFamily) : this (host, port)
|
||||
{
|
||||
switch (addressFamily) {
|
||||
case AddressFamily.InterNetwork:
|
||||
case AddressFamily.InterNetworkV6:
|
||||
case AddressFamily.Unspecified:
|
||||
this.addressFamily = addressFamily;
|
||||
break;
|
||||
default:
|
||||
// throw for Unknown or any invalid value
|
||||
throw new ArgumentException ("addressFamily");
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals (object comparand)
|
||||
{
|
||||
DnsEndPoint dep = (comparand as DnsEndPoint);
|
||||
return (comparand != null) && Equals (dep);
|
||||
}
|
||||
|
||||
private bool Equals (DnsEndPoint other)
|
||||
{
|
||||
if (port != other.port || addressFamily != other.addressFamily|| host != other.host)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return port ^ (int)addressFamily ^ host.GetHashCode ();
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return String.Format ("{0}/{1}:{2}", addressFamily, host, port);
|
||||
}
|
||||
|
||||
public override AddressFamily AddressFamily {
|
||||
get { return addressFamily; }
|
||||
}
|
||||
|
||||
public string Host {
|
||||
get { return host; }
|
||||
}
|
||||
|
||||
public int Port {
|
||||
get { return port; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,65 +0,0 @@
|
||||
//
|
||||
// System.Net.EndPoint.cs
|
||||
//
|
||||
// Author:
|
||||
// Dick Porter (dick@ximian.com)
|
||||
//
|
||||
// (C) Ximian, Inc. http://www.ximian.com
|
||||
//
|
||||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace System.Net {
|
||||
[Serializable]
|
||||
public abstract class EndPoint {
|
||||
|
||||
// NB: These methods really do nothing but throw
|
||||
// NotImplementedException
|
||||
|
||||
public virtual AddressFamily AddressFamily {
|
||||
get { throw NotImplemented (); }
|
||||
}
|
||||
|
||||
public virtual EndPoint Create (SocketAddress socketAddress)
|
||||
{
|
||||
throw NotImplemented ();
|
||||
}
|
||||
|
||||
public virtual SocketAddress Serialize ()
|
||||
{
|
||||
throw NotImplemented ();
|
||||
}
|
||||
|
||||
protected EndPoint ()
|
||||
{
|
||||
}
|
||||
|
||||
static Exception NotImplemented ()
|
||||
{
|
||||
// hide the "normal" NotImplementedException from corcompare-like tools
|
||||
return new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -73,7 +73,8 @@ namespace System.Net {
|
||||
SocketAsyncEventArgs args = new SocketAsyncEventArgs ();
|
||||
args.UserToken = this;
|
||||
args.Completed += OnAccept;
|
||||
sock.AcceptAsync (args);
|
||||
Socket dummy = null;
|
||||
Accept (sock, args, ref dummy);
|
||||
prefixes = new Hashtable ();
|
||||
unregistered = new Dictionary<HttpConnection, HttpConnection> ();
|
||||
}
|
||||
@@ -82,28 +83,37 @@ namespace System.Net {
|
||||
get { return listener; }
|
||||
}
|
||||
|
||||
static void OnAccept (object sender, EventArgs e)
|
||||
{
|
||||
SocketAsyncEventArgs args = (SocketAsyncEventArgs) e;
|
||||
EndPointListener epl = (EndPointListener) args.UserToken;
|
||||
Socket accepted = null;
|
||||
if (args.SocketError == SocketError.Success) {
|
||||
accepted = args.AcceptSocket;
|
||||
args.AcceptSocket = null;
|
||||
}
|
||||
|
||||
static void Accept (Socket socket, SocketAsyncEventArgs e, ref Socket accepted) {
|
||||
e.AcceptSocket = null;
|
||||
bool asyn;
|
||||
try {
|
||||
if (epl.sock != null)
|
||||
epl.sock.AcceptAsync (args);
|
||||
asyn = socket.AcceptAsync(e);
|
||||
} catch {
|
||||
if (accepted != null) {
|
||||
try {
|
||||
accepted.Close ();
|
||||
} catch {}
|
||||
} catch {
|
||||
}
|
||||
accepted = null;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!asyn) {
|
||||
ProcessAccept(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void ProcessAccept (SocketAsyncEventArgs args)
|
||||
{
|
||||
Socket accepted = null;
|
||||
if (args.SocketError == SocketError.Success)
|
||||
accepted = args.AcceptSocket;
|
||||
|
||||
EndPointListener epl = (EndPointListener) args.UserToken;
|
||||
|
||||
|
||||
Accept (epl.sock, args, ref accepted);
|
||||
if (accepted == null)
|
||||
return;
|
||||
|
||||
@@ -118,7 +128,12 @@ namespace System.Net {
|
||||
conn.BeginReadRequest ();
|
||||
}
|
||||
|
||||
internal void RemoveConnection (HttpConnection conn)
|
||||
static void OnAccept (object sender, SocketAsyncEventArgs e)
|
||||
{
|
||||
ProcessAccept (e);
|
||||
}
|
||||
|
||||
internal void RemoveConnection (HttpConnection conn)
|
||||
{
|
||||
lock (unregistered) {
|
||||
unregistered.Remove (conn);
|
||||
|
@@ -1,342 +0,0 @@
|
||||
//
|
||||
// System.Net.FileWebRequest
|
||||
//
|
||||
// Author:
|
||||
// Lawrence Pit (loz@cable.a2000.nl)
|
||||
//
|
||||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
[Serializable]
|
||||
public class FileWebRequest : WebRequest, ISerializable
|
||||
{
|
||||
private Uri uri;
|
||||
private WebHeaderCollection webHeaders;
|
||||
|
||||
private ICredentials credentials;
|
||||
private string connectionGroup;
|
||||
private long contentLength;
|
||||
private FileAccess fileAccess = FileAccess.Read;
|
||||
private string method = "GET";
|
||||
private IWebProxy proxy;
|
||||
private bool preAuthenticate;
|
||||
private int timeout = 100000;
|
||||
|
||||
private Stream requestStream;
|
||||
private FileWebResponse webResponse;
|
||||
private AutoResetEvent requestEndEvent;
|
||||
private bool requesting;
|
||||
private bool asyncResponding;
|
||||
|
||||
// Constructors
|
||||
|
||||
internal FileWebRequest (Uri uri)
|
||||
{
|
||||
this.uri = uri;
|
||||
this.webHeaders = new WebHeaderCollection ();
|
||||
}
|
||||
|
||||
[Obsolete ("Serialization is obsoleted for this type", false)]
|
||||
protected FileWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||
{
|
||||
SerializationInfo info = serializationInfo;
|
||||
webHeaders = (WebHeaderCollection) info.GetValue ("headers", typeof (WebHeaderCollection));
|
||||
proxy = (IWebProxy) info.GetValue ("proxy", typeof (IWebProxy));
|
||||
uri = (Uri) info.GetValue ("uri", typeof (Uri));
|
||||
connectionGroup = info.GetString ("connectionGroupName");
|
||||
method = info.GetString ("method");
|
||||
contentLength = info.GetInt64 ("contentLength");
|
||||
timeout = info.GetInt32 ("timeout");
|
||||
fileAccess = (FileAccess) info.GetValue ("fileAccess", typeof (FileAccess));
|
||||
preAuthenticate = info.GetBoolean ("preauthenticate");
|
||||
}
|
||||
|
||||
// Properties
|
||||
|
||||
// currently not used according to spec
|
||||
public override string ConnectionGroupName {
|
||||
get { return connectionGroup; }
|
||||
set { connectionGroup = value; }
|
||||
}
|
||||
|
||||
public override long ContentLength {
|
||||
get { return contentLength; }
|
||||
set {
|
||||
if (value < 0)
|
||||
throw new ArgumentException ("The Content-Length value must be greater than or equal to zero.", "value");
|
||||
contentLength = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ContentType {
|
||||
get { return webHeaders ["Content-Type"]; }
|
||||
set { webHeaders ["Content-Type"] = value; }
|
||||
}
|
||||
|
||||
public override ICredentials Credentials {
|
||||
get { return credentials; }
|
||||
set { credentials = value; }
|
||||
}
|
||||
|
||||
public override WebHeaderCollection Headers {
|
||||
get { return webHeaders; }
|
||||
}
|
||||
|
||||
// currently not used according to spec
|
||||
public override string Method {
|
||||
get { return this.method; }
|
||||
set {
|
||||
if (value == null || value.Length == 0)
|
||||
throw new ArgumentException ("Cannot set null or blank "
|
||||
+ "methods on request.", "value");
|
||||
this.method = value;
|
||||
}
|
||||
}
|
||||
|
||||
// currently not used according to spec
|
||||
public override bool PreAuthenticate {
|
||||
get { return preAuthenticate; }
|
||||
set { preAuthenticate = value; }
|
||||
}
|
||||
|
||||
// currently not used according to spec
|
||||
public override IWebProxy Proxy {
|
||||
get { return proxy; }
|
||||
set { proxy = value; }
|
||||
}
|
||||
|
||||
public override Uri RequestUri {
|
||||
get { return this.uri; }
|
||||
}
|
||||
|
||||
public override int Timeout {
|
||||
get { return timeout; }
|
||||
set {
|
||||
if (value < -1)
|
||||
throw new ArgumentOutOfRangeException ("Timeout can be "
|
||||
+ "only set to 'System.Threading.Timeout.Infinite' "
|
||||
+ "or a value >= 0.");
|
||||
timeout = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool UseDefaultCredentials
|
||||
{
|
||||
get {
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
set {
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
}
|
||||
// Methods
|
||||
|
||||
private delegate Stream GetRequestStreamCallback ();
|
||||
private delegate WebResponse GetResponseCallback ();
|
||||
|
||||
static Exception GetMustImplement ()
|
||||
{
|
||||
return new NotImplementedException ();
|
||||
}
|
||||
|
||||
/* LAMESPEC: Docs suggest this was present in 1.1 and
|
||||
* 1.0 profiles, but the masterinfos say otherwise
|
||||
*/
|
||||
[MonoTODO]
|
||||
public override void Abort ()
|
||||
{
|
||||
throw GetMustImplement ();
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state)
|
||||
{
|
||||
if (string.Compare ("GET", method, true) == 0 ||
|
||||
string.Compare ("HEAD", method, true) == 0 ||
|
||||
string.Compare ("CONNECT", method, true) == 0)
|
||||
throw new ProtocolViolationException ("Cannot send a content-body with this verb-type.");
|
||||
lock (this) {
|
||||
if (asyncResponding || webResponse != null)
|
||||
throw new InvalidOperationException ("This operation cannot be performed after the request has been submitted.");
|
||||
if (requesting)
|
||||
throw new InvalidOperationException ("Cannot re-call start of asynchronous method while a previous call is still in progress.");
|
||||
requesting = true;
|
||||
}
|
||||
GetRequestStreamCallback c = new GetRequestStreamCallback (this.GetRequestStreamInternal);
|
||||
return c.BeginInvoke (callback, state);
|
||||
}
|
||||
|
||||
public override Stream EndGetRequestStream (IAsyncResult asyncResult)
|
||||
{
|
||||
if (asyncResult == null)
|
||||
throw new ArgumentNullException ("asyncResult");
|
||||
if (!asyncResult.IsCompleted)
|
||||
asyncResult.AsyncWaitHandle.WaitOne ();
|
||||
AsyncResult async = (AsyncResult) asyncResult;
|
||||
GetRequestStreamCallback cb = (GetRequestStreamCallback) async.AsyncDelegate;
|
||||
return cb.EndInvoke (asyncResult);
|
||||
}
|
||||
|
||||
public override Stream GetRequestStream()
|
||||
{
|
||||
IAsyncResult asyncResult = BeginGetRequestStream (null, null);
|
||||
if (!(asyncResult.AsyncWaitHandle.WaitOne (timeout, false))) {
|
||||
throw new WebException("The request timed out", WebExceptionStatus.Timeout);
|
||||
}
|
||||
return EndGetRequestStream (asyncResult);
|
||||
}
|
||||
|
||||
internal Stream GetRequestStreamInternal ()
|
||||
{
|
||||
this.requestStream = new FileWebStream (
|
||||
this,
|
||||
FileMode.Create,
|
||||
FileAccess.Write,
|
||||
FileShare.Read);
|
||||
return this.requestStream;
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state)
|
||||
{
|
||||
lock (this) {
|
||||
if (asyncResponding)
|
||||
throw new InvalidOperationException ("Cannot re-call start of asynchronous method while a previous call is still in progress.");
|
||||
asyncResponding = true;
|
||||
}
|
||||
GetResponseCallback c = new GetResponseCallback (this.GetResponseInternal);
|
||||
return c.BeginInvoke (callback, state);
|
||||
}
|
||||
|
||||
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;
|
||||
FileWebResponse webResponse = (FileWebResponse) cb.EndInvoke(asyncResult);
|
||||
asyncResponding = false;
|
||||
if (webResponse.HasError)
|
||||
throw webResponse.Error;
|
||||
return webResponse;
|
||||
}
|
||||
|
||||
public override WebResponse GetResponse ()
|
||||
{
|
||||
IAsyncResult asyncResult = BeginGetResponse (null, null);
|
||||
if (!(asyncResult.AsyncWaitHandle.WaitOne (timeout, false))) {
|
||||
throw new WebException("The request timed out", WebExceptionStatus.Timeout);
|
||||
}
|
||||
return EndGetResponse (asyncResult);
|
||||
}
|
||||
|
||||
WebResponse GetResponseInternal ()
|
||||
{
|
||||
if (webResponse != null)
|
||||
return webResponse;
|
||||
lock (this) {
|
||||
if (requesting) {
|
||||
requestEndEvent = new AutoResetEvent (false);
|
||||
}
|
||||
}
|
||||
if (requestEndEvent != null) {
|
||||
requestEndEvent.WaitOne ();
|
||||
}
|
||||
FileStream fileStream = null;
|
||||
try {
|
||||
fileStream = new FileWebStream (this, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
this.webResponse = new FileWebResponse (this.uri, fileStream);
|
||||
} catch (Exception ex) {
|
||||
this.webResponse = new FileWebResponse (this.uri, new WebException (ex.Message, ex));
|
||||
}
|
||||
return this.webResponse;
|
||||
}
|
||||
|
||||
void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||
{
|
||||
GetObjectData (serializationInfo, streamingContext);
|
||||
}
|
||||
|
||||
protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||
{
|
||||
SerializationInfo info = serializationInfo;
|
||||
info.AddValue ("headers", webHeaders, typeof (WebHeaderCollection));
|
||||
info.AddValue ("proxy", proxy, typeof (IWebProxy));
|
||||
info.AddValue ("uri", uri, typeof (Uri));
|
||||
info.AddValue ("connectionGroupName", connectionGroup);
|
||||
info.AddValue ("method", method);
|
||||
info.AddValue ("contentLength", contentLength);
|
||||
info.AddValue ("timeout", timeout);
|
||||
info.AddValue ("fileAccess", fileAccess);
|
||||
info.AddValue ("preauthenticate", false);
|
||||
}
|
||||
|
||||
internal void Close ()
|
||||
{
|
||||
// already done in class below
|
||||
// if (requestStream != null) {
|
||||
// requestStream.Close ();
|
||||
// }
|
||||
|
||||
lock (this) {
|
||||
requesting = false;
|
||||
if (requestEndEvent != null)
|
||||
requestEndEvent.Set ();
|
||||
// requestEndEvent = null;
|
||||
}
|
||||
}
|
||||
|
||||
// to catch the Close called on the FileStream
|
||||
internal class FileWebStream : FileStream
|
||||
{
|
||||
FileWebRequest webRequest;
|
||||
|
||||
internal FileWebStream (FileWebRequest webRequest,
|
||||
FileMode mode,
|
||||
FileAccess access,
|
||||
FileShare share)
|
||||
: base (webRequest.RequestUri.LocalPath,
|
||||
mode, access, share)
|
||||
{
|
||||
this.webRequest = webRequest;
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
base.Close ();
|
||||
FileWebRequest req = webRequest;
|
||||
webRequest = null;
|
||||
if (req != null)
|
||||
req.Close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// System.Net.FileWebRequestCreator
|
||||
//
|
||||
// Authors:
|
||||
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
|
||||
//
|
||||
// (C) 2003 Ximian, Inc (http://www.ximian.com)
|
||||
//
|
||||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
class FileWebRequestCreator : IWebRequestCreate
|
||||
{
|
||||
internal FileWebRequestCreator ()
|
||||
{
|
||||
}
|
||||
|
||||
public WebRequest Create (Uri uri)
|
||||
{
|
||||
return new FileWebRequest (uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,183 +0,0 @@
|
||||
//
|
||||
// System.Net.FileWebResponse
|
||||
//
|
||||
// Author:
|
||||
// Lawrence Pit (loz@cable.a2000.nl)
|
||||
//
|
||||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
[Serializable]
|
||||
public class FileWebResponse : WebResponse, ISerializable, IDisposable
|
||||
{
|
||||
private Uri responseUri;
|
||||
private FileStream fileStream;
|
||||
private long contentLength;
|
||||
private WebHeaderCollection webHeaders;
|
||||
private bool disposed;
|
||||
Exception exception;
|
||||
|
||||
// Constructors
|
||||
|
||||
internal FileWebResponse (Uri responseUri, FileStream fileStream)
|
||||
{
|
||||
try {
|
||||
this.responseUri = responseUri;
|
||||
this.fileStream = fileStream;
|
||||
this.contentLength = fileStream.Length;
|
||||
this.webHeaders = new WebHeaderCollection ();
|
||||
this.webHeaders.Add ("Content-Length", Convert.ToString (contentLength));
|
||||
this.webHeaders.Add ("Content-Type", "application/octet-stream");
|
||||
} catch (Exception e) {
|
||||
throw new WebException (e.Message, e);
|
||||
}
|
||||
}
|
||||
|
||||
internal FileWebResponse (Uri responseUri, WebException exception)
|
||||
{
|
||||
this.responseUri = responseUri;
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
[Obsolete ("Serialization is obsoleted for this type", false)]
|
||||
protected FileWebResponse (SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||
{
|
||||
SerializationInfo info = serializationInfo;
|
||||
|
||||
responseUri = (Uri) info.GetValue ("responseUri", typeof (Uri));
|
||||
contentLength = info.GetInt64 ("contentLength");
|
||||
webHeaders = (WebHeaderCollection) info.GetValue ("webHeaders", typeof (WebHeaderCollection));
|
||||
}
|
||||
|
||||
// Properties
|
||||
internal bool HasError {
|
||||
get { return exception != null; }
|
||||
}
|
||||
|
||||
internal Exception Error {
|
||||
get { return exception; }
|
||||
}
|
||||
|
||||
public override long ContentLength {
|
||||
get {
|
||||
CheckDisposed ();
|
||||
return this.contentLength;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ContentType {
|
||||
get {
|
||||
CheckDisposed ();
|
||||
return "application/octet-stream";
|
||||
}
|
||||
}
|
||||
|
||||
public override WebHeaderCollection Headers {
|
||||
get {
|
||||
CheckDisposed ();
|
||||
return this.webHeaders;
|
||||
}
|
||||
}
|
||||
|
||||
public override Uri ResponseUri {
|
||||
get {
|
||||
CheckDisposed ();
|
||||
return this.responseUri;
|
||||
}
|
||||
}
|
||||
|
||||
// Methods
|
||||
|
||||
void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||
{
|
||||
GetObjectData (serializationInfo, streamingContext);
|
||||
}
|
||||
|
||||
protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||
{
|
||||
SerializationInfo info = serializationInfo;
|
||||
|
||||
info.AddValue ("responseUri", responseUri, typeof (Uri));
|
||||
info.AddValue ("contentLength", contentLength);
|
||||
info.AddValue ("webHeaders", webHeaders, typeof (WebHeaderCollection));
|
||||
}
|
||||
|
||||
public override Stream GetResponseStream()
|
||||
{
|
||||
CheckDisposed ();
|
||||
return this.fileStream;
|
||||
}
|
||||
|
||||
// Cleaning up stuff
|
||||
|
||||
~FileWebResponse ()
|
||||
{
|
||||
Dispose (false);
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
((IDisposable) this).Dispose ();
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
Dispose (true);
|
||||
|
||||
// see spec, suppress finalization of this object.
|
||||
GC.SuppressFinalize (this);
|
||||
}
|
||||
|
||||
protected override
|
||||
void Dispose (bool disposing)
|
||||
{
|
||||
if (this.disposed)
|
||||
return;
|
||||
this.disposed = true;
|
||||
|
||||
if (disposing) {
|
||||
// release managed resources
|
||||
this.responseUri = null;
|
||||
this.webHeaders = null;
|
||||
}
|
||||
|
||||
// release unmanaged resources
|
||||
FileStream stream = fileStream;
|
||||
fileStream = null;
|
||||
if (stream != null)
|
||||
stream.Close (); // also closes webRequest
|
||||
base.Dispose (disposing);
|
||||
}
|
||||
|
||||
private void CheckDisposed ()
|
||||
{
|
||||
if (disposed)
|
||||
throw new ObjectDisposedException (GetType ().FullName);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,75 +0,0 @@
|
||||
//
|
||||
// System.Net.FtpStatusCode.cs
|
||||
//
|
||||
// Author:
|
||||
// Carlos Alberto Cortez (calberto.oortez@gmail.com)
|
||||
//
|
||||
// (c) Copyright 2005 Novell, Inc. (http://www.ximian.com)
|
||||
//
|
||||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
public enum FtpStatusCode
|
||||
{
|
||||
Undefined = 0,
|
||||
RestartMarker = 110,
|
||||
ServiceTemporarilyNotAvailable = 120,
|
||||
DataAlreadyOpen = 125,
|
||||
OpeningData = 150,
|
||||
CommandOK = 200,
|
||||
CommandExtraneous = 202,
|
||||
DirectoryStatus = 212,
|
||||
FileStatus = 213,
|
||||
SystemType = 215,
|
||||
SendUserCommand = 220,
|
||||
ClosingControl = 221,
|
||||
ClosingData = 226,
|
||||
EnteringPassive = 227,
|
||||
LoggedInProceed = 230,
|
||||
ServerWantsSecureSession = 234,
|
||||
FileActionOK = 250,
|
||||
PathnameCreated = 257,
|
||||
SendPasswordCommand = 331,
|
||||
NeedLoginAccount = 332,
|
||||
FileCommandPending = 350,
|
||||
ServiceNotAvailable = 421,
|
||||
CantOpenData = 425,
|
||||
ConnectionClosed = 426,
|
||||
ActionNotTakenFileUnavailableOrBusy = 450,
|
||||
ActionAbortedLocalProcessingError = 451,
|
||||
ActionNotTakenInsufficientSpace = 452,
|
||||
CommandSyntaxError = 500,
|
||||
ArgumentSyntaxError = 501,
|
||||
CommandNotImplemented = 502,
|
||||
BadCommandSequence = 503,
|
||||
NotLoggedIn = 530,
|
||||
AccountNeeded = 532,
|
||||
ActionNotTakenFileUnavailable = 550,
|
||||
ActionAbortedUnknownPageType = 551,
|
||||
FileActionAborted = 552,
|
||||
ActionNotTakenFilenameNotAllowed = 553
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -115,6 +115,12 @@ namespace System.Net
|
||||
}
|
||||
}
|
||||
|
||||
public override bool SupportsHeaders {
|
||||
get {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public string StatusDescription {
|
||||
get {
|
||||
return statusDescription;
|
||||
|
@@ -31,20 +31,12 @@
|
||||
#if MONO_SECURITY_ALIAS
|
||||
extern alias MonoSecurity;
|
||||
#endif
|
||||
#if MONO_X509_ALIAS
|
||||
extern alias PrebuiltSystem;
|
||||
#endif
|
||||
|
||||
#if MONO_SECURITY_ALIAS
|
||||
using MSI = MonoSecurity::Mono.Security.Interface;
|
||||
#else
|
||||
using MSI = Mono.Security.Interface;
|
||||
#endif
|
||||
#if MONO_X509_ALIAS
|
||||
using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
|
||||
#else
|
||||
using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
|
||||
#endif
|
||||
|
||||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
|
@@ -1,55 +0,0 @@
|
||||
//
|
||||
// System.Net.HttpListenerException
|
||||
//
|
||||
// Author:
|
||||
// Gonzalo Paniagua Javier (gonzalo@novell.com)
|
||||
//
|
||||
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
namespace System.Net {
|
||||
[Serializable]
|
||||
public class HttpListenerException : Win32Exception
|
||||
{
|
||||
public HttpListenerException ()
|
||||
{
|
||||
}
|
||||
|
||||
public HttpListenerException (int errorCode) : base (errorCode)
|
||||
{
|
||||
}
|
||||
|
||||
public HttpListenerException (int errorCode, string message) : base (errorCode, message)
|
||||
{
|
||||
}
|
||||
|
||||
protected HttpListenerException (SerializationInfo serializationInfo, StreamingContext streamingContext) : base (serializationInfo, streamingContext)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ErrorCode {
|
||||
get { return base.ErrorCode; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -146,6 +146,54 @@ namespace System.Net {
|
||||
}
|
||||
}
|
||||
|
||||
static bool MaybeUri (string s)
|
||||
{
|
||||
int p = s.IndexOf (':');
|
||||
if (p == -1)
|
||||
return false;
|
||||
|
||||
if (p >= 10)
|
||||
return false;
|
||||
|
||||
return IsPredefinedScheme (s.Substring (0, p));
|
||||
}
|
||||
|
||||
//
|
||||
// Using a simple block of if's is twice as slow as the compiler generated
|
||||
// switch statement. But using this tuned code is faster than the
|
||||
// compiler generated code, with a million loops on x86-64:
|
||||
//
|
||||
// With "http": .10 vs .51 (first check)
|
||||
// with "https": .16 vs .51 (second check)
|
||||
// with "foo": .22 vs .31 (never found)
|
||||
// with "mailto": .12 vs .51 (last check)
|
||||
//
|
||||
//
|
||||
static bool IsPredefinedScheme (string scheme)
|
||||
{
|
||||
if (scheme == null || scheme.Length < 3)
|
||||
return false;
|
||||
|
||||
char c = scheme [0];
|
||||
if (c == 'h')
|
||||
return (scheme == "http" || scheme == "https");
|
||||
if (c == 'f')
|
||||
return (scheme == "file" || scheme == "ftp");
|
||||
|
||||
if (c == 'n'){
|
||||
c = scheme [1];
|
||||
if (c == 'e')
|
||||
return (scheme == "news" || scheme == "net.pipe" || scheme == "net.tcp");
|
||||
if (scheme == "nntp")
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
if ((c == 'g' && scheme == "gopher") || (c == 'm' && scheme == "mailto"))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void FinishInitialization ()
|
||||
{
|
||||
string host = UserHostName;
|
||||
@@ -156,7 +204,7 @@ namespace System.Net {
|
||||
|
||||
string path;
|
||||
Uri raw_uri = null;
|
||||
if (Uri.MaybeUri (raw_url.ToLowerInvariant ()) && Uri.TryCreate (raw_url, UriKind.Absolute, out raw_uri))
|
||||
if (MaybeUri (raw_url.ToLowerInvariant ()) && Uri.TryCreate (raw_url, UriKind.Absolute, out raw_uri))
|
||||
path = raw_uri.PathAndQuery;
|
||||
else
|
||||
path = raw_url;
|
||||
@@ -403,7 +451,7 @@ namespace System.Net {
|
||||
}
|
||||
|
||||
public bool IsLocal {
|
||||
get { return IPAddress.IsLoopback (RemoteEndPoint.Address); }
|
||||
get { return LocalEndPoint.Address.Equals (RemoteEndPoint.Address); }
|
||||
}
|
||||
|
||||
public bool IsSecureConnection {
|
||||
|
@@ -427,7 +427,7 @@ namespace System.Net {
|
||||
|
||||
StreamWriter writer = new StreamWriter (ms, encoding, 256);
|
||||
writer.Write ("HTTP/{0} {1} {2}\r\n", version, status_code, status_description);
|
||||
string headers_str = headers.ToStringMultiValue ();
|
||||
string headers_str = headers.ToString ();
|
||||
writer.Write (headers_str);
|
||||
writer.Flush ();
|
||||
int preamble = (encoding.CodePage == 65001) ? 3 : encoding.GetPreamble ().Length;
|
||||
|
@@ -1,73 +0,0 @@
|
||||
//
|
||||
// System.Net.HttpRequestHeader
|
||||
//
|
||||
// Author:
|
||||
// Gonzalo Paniagua Javier (gonzalo@novell.com)
|
||||
//
|
||||
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
namespace System.Net {
|
||||
public enum HttpRequestHeader {
|
||||
CacheControl,
|
||||
Connection,
|
||||
Date,
|
||||
KeepAlive,
|
||||
Pragma,
|
||||
Trailer,
|
||||
TransferEncoding,
|
||||
Upgrade,
|
||||
Via,
|
||||
Warning,
|
||||
Allow,
|
||||
ContentLength,
|
||||
ContentType,
|
||||
ContentEncoding,
|
||||
ContentLanguage,
|
||||
ContentLocation,
|
||||
ContentMd5,
|
||||
ContentRange,
|
||||
Expires,
|
||||
LastModified,
|
||||
Accept,
|
||||
AcceptCharset,
|
||||
AcceptEncoding,
|
||||
AcceptLanguage,
|
||||
Authorization,
|
||||
Cookie,
|
||||
Expect,
|
||||
From,
|
||||
Host,
|
||||
IfMatch,
|
||||
IfModifiedSince,
|
||||
IfNoneMatch,
|
||||
IfRange,
|
||||
IfUnmodifiedSince,
|
||||
MaxForwards,
|
||||
ProxyAuthorization,
|
||||
Referer,
|
||||
Range,
|
||||
Te,
|
||||
Translate,
|
||||
UserAgent
|
||||
}
|
||||
}
|
||||
|
@@ -1,62 +0,0 @@
|
||||
//
|
||||
// System.Net.HttpResponseHeader
|
||||
//
|
||||
// Author:
|
||||
// Gonzalo Paniagua Javier (gonzalo@novell.com)
|
||||
//
|
||||
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
namespace System.Net {
|
||||
public enum HttpResponseHeader {
|
||||
CacheControl,
|
||||
Connection,
|
||||
Date,
|
||||
KeepAlive,
|
||||
Pragma,
|
||||
Trailer,
|
||||
TransferEncoding,
|
||||
Upgrade,
|
||||
Via,
|
||||
Warning,
|
||||
Allow,
|
||||
ContentLength,
|
||||
ContentType,
|
||||
ContentEncoding,
|
||||
ContentLanguage,
|
||||
ContentLocation,
|
||||
ContentMd5,
|
||||
ContentRange,
|
||||
Expires,
|
||||
LastModified,
|
||||
AcceptRanges,
|
||||
Age,
|
||||
ETag,
|
||||
Location,
|
||||
ProxyAuthenticate,
|
||||
RetryAfter,
|
||||
Server,
|
||||
SetCookie,
|
||||
Vary,
|
||||
WwwAuthenticate
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user