Imported Upstream version 3.10.0

Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
Jo Shields
2014-10-04 11:27:48 +01:00
parent fe777c5c82
commit 8b9b85e7f5
970 changed files with 20242 additions and 31308 deletions

View File

@@ -69,15 +69,11 @@ namespace System.Web
public override string Get (string name)
{
if (!_loaded) {
#if TARGET_JVM
return InternalGet (name);
#else
string s = InternalGet (name);
if (s != null && s.Length > 0)
return s;
LoadInfo ();
#endif
}
return base.Get (name);

View File

@@ -51,11 +51,7 @@ namespace System.Web
BrowserData parent;
string text;
string pattern;
#if TARGET_JVM
java.util.regex.Pattern regex;
#else
Regex regex;
#endif
ListDictionary data;
public BrowserData (string pattern)
@@ -153,17 +149,9 @@ namespace System.Web
lock (this_lock) {
if (regex == null)
#if TARGET_JVM
regex = java.util.regex.Pattern.compile (pattern);
#else
regex = new Regex (pattern);
#endif
}
#if TARGET_JVM
return regex.matcher ((java.lang.CharSequence) (object) expression).matches ();
#else
return regex.Match (expression).Success;
#endif
}
}
@@ -173,46 +161,9 @@ namespace System.Web
static Hashtable defaultCaps;
static readonly object lockobj = new object ();
#if TARGET_JVM
static bool loaded {
get {
return alldata != null;
}
set {
if (alldata == null)
alldata = new ArrayList ();
}
}
const string alldataKey = "System.Web.CapabilitiesLoader.alldata";
static ICollection alldata {
get {
return (ICollection) AppDomain.CurrentDomain.GetData (alldataKey);
}
set {
AppDomain.CurrentDomain.SetData (alldataKey, value);
}
}
const string userAgentsCacheKey = "System.Web.CapabilitiesLoader.userAgentsCache";
static Hashtable userAgentsCache {
get {
lock (typeof (CapabilitiesLoader)) {
Hashtable agentsCache = (Hashtable) AppDomain.CurrentDomain.GetData (userAgentsCacheKey);
if (agentsCache == null) {
agentsCache = Hashtable.Synchronized (new Hashtable (userAgentsCacheSize + 10));
AppDomain.CurrentDomain.SetData (userAgentsCacheKey, agentsCache);
}
return agentsCache;
}
}
}
#else
static volatile bool loaded;
static ICollection alldata;
static Hashtable userAgentsCache = Hashtable.Synchronized(new Hashtable(userAgentsCacheSize+10));
#endif
CapabilitiesLoader () {}

View File

@@ -1277,10 +1277,6 @@ namespace System.Web
context.Handler = handler;
context.PushHandler (handler);
} catch (FileNotFoundException fnf){
#if TARGET_JVM
Console.WriteLine ("$$$$$$$$$$:Sys.Web Pipeline");
Console.WriteLine (fnf.ToString ());
#endif
if (context.Request.IsLocal)
ProcessError (HttpException.NewWithCode (404,
String.Format ("File not found {0}", fnf.FileName),
@@ -1510,9 +1506,7 @@ namespace System.Web
th.CurrentUICulture = new_app_culture;
}
#if !TARGET_JVM
prev_user = Thread.CurrentPrincipal;
#endif
}
void PostDone ()
@@ -1523,10 +1517,8 @@ namespace System.Web
}
Thread th = Thread.CurrentThread;
#if !TARGET_JVM
if (Thread.CurrentPrincipal != prev_user)
Thread.CurrentPrincipal = prev_user;
#endif
if (prev_appui_culture != null && prev_appui_culture != th.CurrentUICulture)
th.CurrentUICulture = prev_appui_culture;
if (prev_app_culture != null && prev_app_culture != th.CurrentCulture)
@@ -1672,11 +1664,7 @@ namespace System.Web
cultures [0] = Thread.CurrentThread.CurrentCulture;
cultures [1] = Thread.CurrentThread.CurrentUICulture;
#if TARGET_JVM
if (true)
#else
if (Thread.CurrentThread.IsThreadPoolThread)
#endif
Start (null);
else
ThreadPool.QueueUserWorkItem (x => {
@@ -1816,7 +1804,6 @@ namespace System.Web
if (type != null)
return type;
#if !TARGET_JVM
Assembly [] assemblies = AppDomain.CurrentDomain.GetAssemblies ();
foreach (Assembly ass in assemblies) {
type = ass.GetType (typeName, false);
@@ -1845,7 +1832,6 @@ namespace System.Web
if (type != null)
return type;
#endif
if (throwOnMissing)
throw new TypeLoadException (String.Format ("Type '{0}' cannot be found", typeName), loadException);

View File

@@ -85,15 +85,7 @@ namespace System.Web
[ThreadStatic]
static Dictionary <string, IResourceProvider> resource_providers;
#if TARGET_JVM
const string app_global_res_key = "HttpContext.app_global_res_key";
internal static Assembly AppGlobalResourcesAssembly {
get { return (Assembly) AppDomain.CurrentDomain.GetData (app_global_res_key); }
set { AppDomain.CurrentDomain.SetData (app_global_res_key, value); }
}
#else
internal static Assembly AppGlobalResourcesAssembly;
#endif
ProfileBase profile = null;
LinkedList<IHttpHandler> handlers;
@@ -178,7 +170,6 @@ namespace System.Web
// The "Current" property is set just after we have constructed it with
// the 'HttpContext (HttpWorkerRequest)' constructor.
//
#if !TARGET_JVM // No remoting CallContext support in Grasshopper
public static HttpContext Current {
get {
return (HttpContext) CallContext.GetData ("c");
@@ -188,7 +179,6 @@ namespace System.Web
CallContext.SetData ("c", value);
}
}
#endif
public Exception Error {
get {
@@ -228,11 +218,9 @@ namespace System.Web
return (cfg.Mode == CustomErrorMode.RemoteOnly) && !Request.IsLocal;
}
}
#if !TARGET_JVM
public bool IsDebuggingEnabled {
get { return RuntimeHelpers.DebuggingEnabled; }
}
#endif
public IDictionary Items {
get {
if (items == null)

View File

@@ -289,11 +289,9 @@ namespace System.Web
}
}
#if !TARGET_JVM
public WindowsIdentity LogonUserIdentity {
get { throw new NotImplementedException (); }
}
#endif
string anonymous_id;
public string AnonymousID {
@@ -580,10 +578,8 @@ namespace System.Web
// GetSubStream returns a 'copy' of the InputStream with Position set to 0.
static Stream GetSubStream (Stream stream)
{
#if !TARGET_JVM
if (stream is IntPtrStream)
return new IntPtrStream (stream);
#endif
if (stream is MemoryStream) {
MemoryStream other = (MemoryStream) stream;
@@ -797,7 +793,6 @@ namespace System.Web
input_stream = new MemoryStream (ms.GetBuffer (), 0, (int) ms.Length, false, true);
}
#if !TARGET_JVM
const int INPUT_BUFFER_SIZE = 32*1024;
TempFileStream GetTempStream ()
@@ -951,7 +946,6 @@ namespace System.Web
if (total < content_length)
throw HttpException.NewWithCode (411, "The request body is incomplete.", WebEventCodes.WebErrorOtherError);
}
#endif
internal void ReleaseResources ()
{
@@ -1563,14 +1557,10 @@ namespace System.Web
if (!isAppVirtualPath && !virtualPath.StartsWith (appVirtualPath, RuntimeHelpers.StringComparison))
throw new InvalidOperationException (String.Format ("Failed to map path '{0}'", virtualPath));
#if TARGET_JVM
return worker_request.MapPath (virtualPath);
#else
string path = worker_request.MapPath (virtualPath);
if (virtualPath [virtualPath.Length - 1] != '/' && path [path.Length - 1] == System.IO.Path.DirectorySeparatorChar)
path = path.TrimEnd (System.IO.Path.DirectorySeparatorChar);
return path;
#endif
}
public void SaveAs (string filename, bool includeHeaders)

View File

@@ -1157,11 +1157,6 @@ namespace System.Web
Flush ();
}
#if TARGET_JVM
public void WriteFile (IntPtr fileHandle, long offset, long size) {
throw new PlatformNotSupportedException("IntPtr not supported");
}
#else
public void WriteFile (IntPtr fileHandle, long offset, long size)
{
if (offset < 0)
@@ -1182,7 +1177,6 @@ namespace System.Web
output_stream.ApplyFilter (false);
Flush ();
}
#endif
public void WriteFile (string filename, long offset, long size)
{

View File

@@ -75,75 +75,6 @@ namespace System.Web
filter = value;
}
}
#if TARGET_JVM
class BlockManager {
const int PreferredLength = 16 * 1024;
static readonly byte[] EmptyBuffer = new byte[0];
byte[] buffer = EmptyBuffer;
int position;
public BlockManager () {
}
public int Position {
get { return position; }
}
void EnsureCapacity (int capacity) {
if (buffer.Length >= capacity)
return;
capacity += PreferredLength;
capacity = (capacity / PreferredLength) * PreferredLength;
byte[] temp = new byte[capacity];
Array.Copy(buffer, 0, temp, 0, buffer.Length);
buffer = temp;
}
public void Write (byte [] buffer, int offset, int count) {
if (count == 0)
return;
EnsureCapacity (position + count);
Array.Copy(buffer, offset, this.buffer, position, count);
position += count;
}
public void Send (HttpWorkerRequest wr, int start, int end) {
int length = end - start;
if (length <= 0)
return;
if (length > buffer.Length - start)
length = buffer.Length - start;
if (start > 0) {
byte[] temp = new byte[length];
Array.Copy(buffer, start, temp, 0, length);
buffer = temp;
}
wr.SendResponseFromMemory(buffer, length);
}
public void Send (Stream stream, int start, int end) {
int length = end - start;
if (length <= 0)
return;
if (length > buffer.Length - start)
length = buffer.Length - start;
stream.Write(buffer, start, length);
}
public void Dispose () {
buffer = null;
}
}
#else // TARGET_JVM
unsafe sealed class BlockManager {
const int PreferredLength = 128 * 1024;
byte *data;
@@ -234,7 +165,6 @@ namespace System.Web
}
}
#endif
abstract class Bucket {
public Bucket Next;
@@ -247,9 +177,7 @@ namespace System.Web
public abstract int Length { get; }
}
#if !TARGET_JVM
unsafe
#endif
class ByteBucket : Bucket {
int start;
int length;
@@ -559,24 +487,12 @@ namespace System.Web
}
}
#if TARGET_JVM
void UnsafeWrite (HttpWorkerRequest wr, byte [] buffer, int offset, int count)
{
if (count <= 0)
return;
byte[] copy = new byte[count];
Array.Copy(buffer, offset, copy, 0, count);
wr.SendResponseFromMemory (copy, count);
}
#else
unsafe void UnsafeWrite (HttpWorkerRequest wr, byte [] buffer, int offset, int count)
{
fixed (byte *ptr = buffer) {
wr.SendResponseFromMemory ((IntPtr) (ptr + offset), count);
}
}
#endif
void AppendBuffer (byte [] buffer, int offset, int count)
{
if (!(cur_bucket is ByteBucket))

View File

@@ -601,13 +601,6 @@ namespace System.Web
}
#endif
#if TARGET_JVM
[MonoNotSupported ("UnloadAppDomain is not supported")]
public static void UnloadAppDomain ()
{
throw new NotImplementedException ("UnloadAppDomain is not supported");
}
#else
//
// Called when we are shutting down or we need to reload an application
// that has been modified (touch global.asax)
@@ -628,7 +621,6 @@ namespace System.Web
}
});
}
#endif
//
// Shuts down the AppDomain
//

View File

@@ -317,7 +317,6 @@ namespace System.Web
// apparently does nothing in MS.NET
}
#if !TARGET_JVM
public virtual void SendResponseFromMemory (IntPtr data, int length)
{
if (data != IntPtr.Zero) {
@@ -326,7 +325,6 @@ namespace System.Web
SendResponseFromMemory (copy, length);
}
}
#endif
public virtual void SetEndOfSendNotification (HttpWorkerRequest.EndOfSendNotification callback, object extraData)
{

View File

@@ -143,14 +143,10 @@ namespace System.Web
{
if (buffer == null || index < 0 || count < 0 || (buffer.Length - index) < count)
throw new ArgumentOutOfRangeException ();
#if TARGET_JVM
output_stream.Write (buffer, index, count);
#else
int length = encoding.GetMaxByteCount (count);
byte [] bytebuffer = GetByteBuffer (length);
int realLength = encoding.GetBytes (buffer, index, count, bytebuffer, 0);
output_stream.Write (bytebuffer, 0, realLength);
#endif
if (response.buffer)
return;
@@ -171,14 +167,10 @@ namespace System.Web
if (index < 0 || count < 0 || ((index + count > s.Length)))
throw new ArgumentOutOfRangeException ();
#if TARGET_JVM
output_stream.Write (s, index, count);
#else
int length = encoding.GetMaxByteCount (count);
byte [] bytebuffer = GetByteBuffer (length);
int realLength = encoding.GetBytes (s, index, count, bytebuffer, 0);
output_stream.Write (bytebuffer, 0, realLength);
#endif
if (response.buffer)
return;

View File

@@ -93,23 +93,8 @@ namespace System.Web
}
}
#if TARGET_JVM
const string SiteMap_provider = "SiteMap_provider";
const string SiteMap_providers = "SiteMap_providers";
static SiteMapProvider provider
{
get { return (SiteMapProvider) AppDomain.CurrentDomain.GetData (SiteMap_provider); }
set { AppDomain.CurrentDomain.SetData (SiteMap_provider, value); }
}
static SiteMapProviderCollection providers
{
get { return (SiteMapProviderCollection) AppDomain.CurrentDomain.GetData (SiteMap_providers); }
set { AppDomain.CurrentDomain.SetData (SiteMap_providers, value); }
}
#else
static SiteMapProvider provider;
static SiteMapProviderCollection providers;
#endif
static object locker = new object ();
}
}

View File

@@ -41,16 +41,7 @@ namespace System.Web
public class SiteMapNodeCollection : IList, IHierarchicalEnumerable
{
ArrayList list;
#if TARGET_JVM
const string _siteMapNodeCollection_EmptyList = "SiteMapNodeCollection.EmptyList";
internal static SiteMapNodeCollection EmptyList
{
get { return (SiteMapNodeCollection) AppDomain.CurrentDomain.GetData (_siteMapNodeCollection_EmptyList); }
set { AppDomain.CurrentDomain.SetData (_siteMapNodeCollection_EmptyList, value); }
}
#else
internal static SiteMapNodeCollection EmptyList;
#endif
static SiteMapNodeCollection ()
{

View File

@@ -86,24 +86,7 @@ namespace System.Web
if (strHeader != null) {
DateTime dtIfModifiedSince = DateTime.ParseExact (strHeader, "r", null);
DateTime ftime;
#if TARGET_JVM
try
{
ftime = fi.LastWriteTime.ToUniversalTime ();
}
catch (NotSupportedException)
{
// The file is in a WAR, it might be modified with last redeploy.
try {
ftime = (DateTime) AppDomain.CurrentDomain.GetData (".appStartTime");
}
catch {
ftime = DateTime.MaxValue;
}
}
#else
ftime = fi.LastWriteTime.ToUniversalTime ();
#endif
if (ftime <= dtIfModifiedSince) {
response.ContentType = MimeTypes.GetMimeType (fileName);
response.StatusCode = 304;