Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,163 @@
//
// System.Web.Util.AltSerialization
//
// Author(s):
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
// Jackson Harper (jackson@ximian.com)
//
// (C) 2003 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;
using System.IO;
using System.Collections;
using System.Runtime.Serialization.Formatters.Binary;
namespace System.Web.Util {
internal sealed class AltSerialization
{
AltSerialization () { }
internal static void Serialize (BinaryWriter w, object value)
{
TypeCode typeCode = value != null ? Type.GetTypeCode (value.GetType ()) : TypeCode.Empty;
w.Write ((byte)typeCode);
switch (typeCode) {
case TypeCode.Boolean:
w.Write ((bool) value);
break;
case TypeCode.Byte:
w.Write ((byte) value);
break;
case TypeCode.Char:
w.Write ((char) value);
break;
case TypeCode.DateTime:
w.Write (((DateTime) value).Ticks);
break;
case TypeCode.DBNull:
break;
case TypeCode.Decimal:
w.Write ((decimal) value);
break;
case TypeCode.Double:
w.Write ((double) value);
break;
case TypeCode.Empty:
break;
case TypeCode.Int16:
w.Write ((short) value);
break;
case TypeCode.Int32:
w.Write ((int) value);
break;
case TypeCode.Int64:
w.Write ((long) value);
break;
case TypeCode.Object:
#if TARGET_J2EE
if (w.BaseStream is java.io.ObjectOutput) {
((java.io.ObjectOutput) w.BaseStream).writeObject (value);
return;
}
#endif
BinaryFormatter bf = new BinaryFormatter ();
bf.Serialize (w.BaseStream, value);
break;
case TypeCode.SByte:
w.Write ((sbyte) value);
break;
case TypeCode.Single:
w.Write ((float) value);
break;
case TypeCode.String:
w.Write ((string) value);
break;
case TypeCode.UInt16:
w.Write ((ushort) value);
break;
case TypeCode.UInt32:
w.Write ((uint) value);
break;
case TypeCode.UInt64:
w.Write ((ulong) value);
break;
}
}
internal static object Deserialize (BinaryReader r)
{
TypeCode typeCode = (TypeCode)r.ReadByte();
switch (typeCode) {
case TypeCode.Boolean:
return r.ReadBoolean ();
case TypeCode.Byte:
return r.ReadByte ();
case TypeCode.Char:
return r.ReadChar ();
case TypeCode.DateTime:
return new DateTime (r.ReadInt64 ());
case TypeCode.DBNull:
return DBNull.Value;
case TypeCode.Decimal:
return r.ReadDecimal ();
case TypeCode.Double:
return r.ReadDouble ();
case TypeCode.Empty:
return null;
case TypeCode.Int16:
return r.ReadInt16 ();
case TypeCode.Int32:
return r.ReadInt32 ();
case TypeCode.Int64:
return r.ReadInt64 ();
case TypeCode.Object:
#if TARGET_J2EE
if (r.BaseStream is java.io.ObjectInput)
return ((java.io.ObjectInput) r.BaseStream).readObject ();
#endif
BinaryFormatter bf = new BinaryFormatter ();
return bf.Deserialize (r.BaseStream);
case TypeCode.SByte:
return r.ReadSByte ();
case TypeCode.Single:
return r.ReadSingle ();
case TypeCode.String:
return r.ReadString ();
case TypeCode.UInt16:
return r.ReadUInt16 ();
case TypeCode.UInt32:
return r.ReadUInt32 ();
case TypeCode.UInt64:
return r.ReadUInt64 ();
default:
throw new ArgumentOutOfRangeException ("TypeCode:" + typeCode);
}
}
}
}

View File

@@ -0,0 +1,460 @@
2010-06-04 Jb Evain <jbevain@novell.com>
* HttpEncoder.cs: only net_4_0 uses System.Web.Configuration.
2010-06-01 Marek Habersack <mhabersack@novell.com>
* HttpEncoder.cs: added. A 4.0 type but also used in 2.0 profile,
internally.
2010-03-06 Marek Habersack <mhabersack@novell.com>
* RequestValidator.cs: added
* RequestValidationSource.cs: added
2010-03-04 Marek Habersack <mhabersack@novell.com>
* RuntimeHelpers.cs: added. Contains methods moved here from
HttpRuntime, so that initialization sequence of various objects is
independent of HttpRuntime.
2009-03-01 Gonzalo Paniagua Javier <gonzalo@novell.com>
* WebEncoding.cs: another GetWebApplication here.
2009-02-20 Gonzalo Paniagua Javier <gonzalo@novell.com>
* ICalls.cs: new internal call to get a pointer to the
win32 resource associated with the control's assembly.
2009-01-27 Marek Habersack <mhabersack@novell.com>
* SearchPattern.cs: added
2009-01-22 Marek Habersack <mhabersack@novell.com>
* FileUtils.cs: added two conditionally compiled methods (they
require DEVEL to be defined) which output lines to a log file.
2008-12-25 Gonzalo Paniagua Javier <gonzalo@novell.com>
* UrlUtils.cs: use Replace (char, char).
2008-08-19 Marek Habersack <mhabersack@novell.com>
* UrlUtils.cs: fail gracefully if the path passed to GetSessionId
is null.
2008-07-29 Marek Habersack <mhabersack@novell.com>
* UrlUtils.cs: fixed a typo in HasSessionId which made it always
return False. Fixes bug #397418
2008-06-27 Robert Jordan <robertj@gmx.net>
* TimeUtil.cs (ToUtcTimeString): convert using the invariant
culture. Fixes bug #404083. Contributed by
Hubert FONGARNAND <informatique.internet@fiducial.fr>.
2008-06-16 Marek Habersack <mhabersack@novell.com>
* UrlUtils.cs: optimize string usage (do not compare against "").
2008-06-16 Noam Lampert <noaml@mainsoft.com>
* UrlUtils.cs: Fixed some bugs in Canonize method. Add several tests
2008-06-04 Marek Habersack <mhabersack@novell.com>
* UrlUtils.cs: added internal method HasSessionId
2007-12-12 Marek Habersack <mhabersack@novell.com>
* SettingsMappingManager.cs: use the 'settings.map.config' name
for the application-specific mapper configuration. This ensures
that the file won't be downloadable on systems which don't support
the mapping feature without the need to add the extra handler
entry to the app's Web.config file. Thanks to Joe Audette for the
idea.
2007-12-11 Marek Habersack <mhabersack@novell.com>
* SettingsMappingManager.cs: made the class public - it is
required for user-defined mappers to work.
Added a new property, Platform, which specifies the platform we're
running on. Platform check is now done only on initialization
time.
LoadMappings considers only the mappings which apply to the
current platform. Other entries are not loaded.
* SettingsMapping.cs: made the class public.
* SettingsMappingWhat.cs: made the class public.
* ISectionSettingsMapper.cs: made the interface public.
2007-12-08 Marek Habersack <mhabersack@novell.com>
* SerializationHelper.cs: added - serialization helper for the
Sqlite Profile Provider.
* RoleManagerSectionMapper.cs: added - section settings mapper for
the RoleManager section.
* MembershipSectionMapper.cs: added - section settings mapper for
the Membership section.
* ISectionSettingsMapper.cs: added - interface definition for
section settings mappers.
* SettingsMappingWhat.cs: added - describes a single 'what' tag
instance inside the mapper definition in the settings.map file.
* SettingsMapping.cs: added - represents a single mapper entry in
the settings.map file.
* SettingsMappingManager.cs: added - manages settings mapping as
defined in the settings.map file.
2006-08-19 Vladimir Krasnov <vladimirk@mainsoft.com>
* UrlUtils.cs: optimized string.Replace in RemoveDoubleSlashes
2007-03-21 Konstantin Triger <kostat@mainsoft.com>
AltSerialization.cs: refactoring for Serialize/Deserialize functionality.
2007-03-18 Marek Habersack <mhabersack@novell.com>
* UrlUtils.cs: GetDirectory always returns a path with trailing
slash.
2007-03-16 Marek Habersack <mhabersack@novell.com>
* UrlUtils.cs: make sure the trailing slash is present.
2007-03-05 Marek Habersack <mhabersack@novell.com>
* UrlUtils.cs: Make sure GetDirectory returns a directory with the
trailing slash.
2007-01-30 Adar Wesley <adarw@mainsoft.com>
* UrlUtils.cs: fixed GetFile to throw right exception
2007-01-20 Miguel de Icaza <miguel@novell.com>
* FileUtils.cs (CreateTemporaryFile): Remove unused variable.
2006-11-26 Igor Zelmanovich <igorz@mainsoft.com>
* StrUtils.cs: added new helper method EscapeQuotesAndBackslashes
2006-11-13 Marek Habersack <grendello@gmail.com>
* FileUtils.cs: Added a utility class for temporary file creation
(and possibly other future common file operations)
2006-03-15 Vladimir Krasnov <vladimirk@mainsoft.com>
* DataSourceResolver.cs: corrected exceptions type in
ResolveDataSource
2006-02-01 Chris Toshok <toshok@ximian.com>
* WebEncoding.cs: CONFIGURATION_2_0 => NET_2_0, and use GetSection
instead of GetWebApplicationSection.
2006-01-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: more than one consecutive slash are turned into one.
2006-01-26 Chris Toshok <toshok@ximian.com>
* WebEncoding.cs: rework this so we cache the section, and so we
swallow exceptions based on a broken configuration.
2006-01-09 Konstantin Triger <kostat@mainsoft.com>
AltSerialization.cs: under TARGET_JVM: merging /main/4
2005-11-28 Chris Toshok <toshok@ximian.com>
* WebEncoding.cs (FileEncoding, ResponseEncoding,
RequestEncoding): CONFIGURATION_2_0 work.
2005-09-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: fix GetFile to work with '/blah'.
2005-09-11 Sebastien Pouliot <sebastien@ximian.com>
* IWebObjectFactory.cs: New. 2.0 interface.
* IWebPropertyAccessor.cs: New. 2.0 interface.
* Transactions.cs: Added [Link|Inheritance]Demand for Minimal.
* WorkItem.cs: Added [Link|Inheritance]Demand for Minimal. Added
Demand for UnmanagedCode on the static Post method,
2005-08-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: removed 2 unused methods. IsRelativeUrl returns false if
there's a colon in the string, assuming it's the beginning of the ://
after the schema.
2005-07-15 Ben Maurer <bmaurer@ximian.com>
* DataSourceHelper.cs: Obsolete
* DataSourceResolver.cs: Moved from DataSourceHelper.
2005-07-14 Ben Maurer <bmaurer@ximian.com>
* DataSourceHelper.cs: Helper method used for data binding.
2005-06-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: (Combine) if the base path is "~", expand it.
2005-06-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* StrUtils.cs: new string utilities.
2005-05-09 Ben Maurer <bmaurer@ximian.com>
* UrlUtils.cs (Reduce): a more efficient impl that avoids an
arraylist, making an arraylist into an array, and a replace
operation.
2004-11-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: made (Insert|Get|Remove)SessionId use the appRoot +
SessionID + vpath format.
2004-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: don't pass double slash when the path begins with a
tilde. Fixes bug #61654.
2004-05-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs:
(GetFile): not public, and fixed to really return just the file name.
(InsertSessionId): ensure that the directory ends with a "/". This
fixes cookieless sessions.
(RemoveSessionId): don't return "/" twice.
Fixed bug #59051.
2004-05-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: respect trailing slashes. Fixes bug #56802.
2004-05-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: no more ^Ms.
2004-04-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: MakeRelative was returning null for virtual paths without
directory.
2004-04-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* FileAction.cs:
* FileChangeEventHandler.cs:
* FileChangedEventArgs.cs:
* FileChangesMonitor.cs:
* FilePathParser.cs: removed unused/obsolete files.
2004-04-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: fixed MakeRelative. nGallery goes one step further.
2004-03-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: small fix from George Kodinov for Combine when ~ is used.
2004-02-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: ~ is not always /. Fixed.
2004-02-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs:
(Combine): handle subdirectories and tilde. Fixes bug 54231.
2004-02-01 Alon Gazit <along@mainsoft.com>
* UrlUtils.cs: little fix in GetDirectory ().
2004-01-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* TransactedCallback.cs:
* WorkItemCallback.cs:
* WorkItem.cs:
* Transactions.cs: Added and stubbed/ implemented
2004-01-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* WebEqualComparer.cs:
* WebHashCodeProvider.cs:
* FileAction.cs:
* FileChangeEventHandler.cs:
* NativeFileChangeEventHandler.cs: Monostyled header, internalized
2004-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: make reduce not to throw an exception for '../'. Fixes
bug #52599.
2003-12-03 Jackson Harper <jackson@ximian.com>
* UrlUtils.cs: Some methods for working with session ids in urls.
2003-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* WebEncoding.cs: use the Default encoding when the globalization
configuration is not available.
2003-12-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: don't forget basePath when relative path is not rooted.
Fixes bug #51522.
2003-11-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: fix bug introduced with last change that makes relative
paths fail. Closes bug #51448.
2003-11-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: fixed Combine() handling of ~.
2003-11-25 Jackson Harper <jackson@ximian.com>
* AltSerialization.cs: Utility methods for optimized serializing.
2003-11-13 Jackson Harper <jackson@ximian.com>
* TimeUtil.cs: Utility methods for dealing with time.
2003-11-08 Ben Maurer <bmaurer@users.sourceforge.net>
* UrlUtils.cs: new function to do the app mapping, but make
it return a physical path.
2003-11-07 Ben Maurer <bmaurer@users.sourceforge.net>
* UrlUtils.cs: add a new function for mapping app absolute
paths to virual paths (ie, ~/blah/ to /application/root/blah/)
2003-11-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* WebEncoding.cs: added properties to access configuration files
encoding.
2003-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* ICalls.cs: holds a couple of icalls.
2003-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: made Reduce work when a "/" is passed.
2003-05-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: fixed Combine and reworked Reduce.
2003-03-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: another little fix in Combine ().
2003-01-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: fixed Combine ().
2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: fixed IsRelativeUrl and IsRootUrl.
2002-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* PathUtil.cs: removed.
* UrlUtils.cs: fixed Combine to handle '~'.
2002-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* PathUtil.cs: some path handling methods that are not available in
System.IO.Path.
2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
* DataSourceHelper.cs : Fresh implementation. Moved from
System.Web.UI.WebControls.DataGrid
::ResolveData(object, string).
2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* WebTrace.cs: fixed namespace.
* WebEncoding.cs: new class that holds the default encoding for
System.Web.
2002-01-03 Nick Drochak <ndrochak@gol.com>
* FileChangesMonitor.cs: remove redundant using statement; use int
for MAXLEN; capitalize correctly 'WebHashCodeProvider';
fix typo rsLock -> rwLock; Change IsRooted to IsPathRooted;
set out parameter value where needed
* FilePathParser.cs: qualify method GetPathRoot() with 'Path.'
* IISVersionInfo.cs: initialize static member to avoid compile error.
* WebEqualComparer.cs: static member defC shouldn't be readonly;
the string comparer had some typos (fixed)
* WebHashCodeProvider.cs: needed System.Globalization; static member
defHcp shouldn't be readonly; remove double equal typo.
2002-01-02 Nick Drochak <ndrochak@gol.com>
* FileAction.cs: Use 0x7FFFFFFF as enum value for error. 0xFFFFFFFF
is too big for Int32.
* FileChangeEventHandler.cs: put missing 'void' return type on delegate
FileChangeEventHandler()
* FileChangedEventArgs.cs: ditto for FileChangedEvent()
* NativeFileChangeEventHandler.cs: ditto for NativeFileChangeEventHandler()
* FileChangesMonitor.cs: add needed namespaces and comment out imcomplete
code.
2001-12-21 Gaurav Vaish <gvaish@iitk.ac.in>
* ApacheVersionInfo.cs - Dummy class, for later use.
* FileAction.cs:
* FileChangeEventHandler.cs:
* FileChangeEventArgs.cs:
* FileChangesMonitor.cs:
* NativeFileChangeEventHandler.cs
- To be used in System.Web/Http* classes.
Initially needed for HttpRuntime
* IISVersionInfo.cs - Some useful methods
2001-12-17 Gaurav Vaish <gvaish@iitk.ac.in>
* UrlUtils.cs - Added functions Combine and Reduce
2001-12-16 Miguel de Icaza <miguel@ximian.com>
* DataSourceHelper.cs, UrlUtils.cs: Set the correct namespace.
2001-11-30
Gaurav Vaish <gvaish@iitk.ac.in>
* DataSourceHelper.cs - Resolving DataSource objects
2001-11-09
Gaurav Vaish <gvaish@iitk.ac.in>
* UrlUtil.cs - Some basic functions
2001-11-08
Gaurav Vaish <gvaish@iitk.ac.in>
* Namespace - Created the namespace for commonly used,
otherwise not available functions

View File

@@ -0,0 +1,49 @@
//
// System.Web.Util.DataSourceHelper
//
// Authors:
// Ben Maurer (bmaurer@novell.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.
//
//
// This is from
// _Developing Microsoft ASP.NET Server Controls and Components_ (Kothari, Datye)
// Listing 20-3 "GetDataSource" (page 564)
//
using System.Collections;
using System.ComponentModel;
namespace System.Web.Util {
class DataSourceHelper
{
DataSourceHelper () {}
[Obsolete ("Use DataSourceResolver")]
public static IEnumerable GetResolvedDataSource (object o, string data_member)
{
return DataSourceResolver.ResolveDataSource (o, data_member);
}
}
}

View File

@@ -0,0 +1,82 @@
//
// System.Web.Util.DataSourceResolver
//
// Authors:
// Ben Maurer (bmaurer@novell.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.
//
//
// This is from
// _Developing Microsoft ASP.NET Server Controls and Components_ (Kothari, Datye)
// Listing 20-3 "GetDataSource" (page 564)
//
using System.Collections;
using System.ComponentModel;
namespace System.Web.Util {
class DataSourceResolver
{
DataSourceResolver () {}
public static IEnumerable ResolveDataSource (object o, string data_member)
{
IEnumerable ds;
ds = o as IEnumerable;
if (ds != null)
return ds;
IListSource ls = o as IListSource;
if (ls == null)
return null;
IList member_list = ls.GetList ();
if (! ls.ContainsListCollection)
return member_list;
ITypedList tl = member_list as ITypedList;
if (tl == null)
return null;
PropertyDescriptorCollection pd = tl.GetItemProperties (new PropertyDescriptor [0]);
if (pd == null || pd.Count == 0)
throw new HttpException ("The selected data source did not contain any data members to bind to");
PropertyDescriptor member_desc = data_member == "" ?
pd [0] :
pd.Find (data_member, true);
if (member_desc != null)
ds = member_desc.GetValue (member_list [0]) as IEnumerable;
if (ds == null)
throw new HttpException ("A list corresponding to the selected DataMember was not found");
return ds;
}
}
}

View File

@@ -0,0 +1,102 @@
//
// System.Web.Compilation.AppCodeCompiler: A compiler for the App_Code folder
//
// Authors:
// Marek Habersack (grendello@gmail.com)
//
// (C) 2006 Marek Habersack
//
//
// 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.Diagnostics;
using System.Globalization;
using System.IO;
namespace System.Web.Util
{
internal sealed class FileUtils
{
internal delegate object CreateTempFile (string path);
static Random rnd = new Random ();
internal static object CreateTemporaryFile (string tempdir, CreateTempFile createFile)
{
return CreateTemporaryFile (tempdir, null, null, createFile);
}
internal static object CreateTemporaryFile (string tempdir, string extension, CreateTempFile createFile)
{
return CreateTemporaryFile (tempdir, null, extension, createFile);
}
internal static object CreateTemporaryFile (string tempdir, string prefix, string extension, CreateTempFile createFile)
{
if (tempdir == null || tempdir.Length == 0)
return null;
if (createFile == null)
return null;
string path = null;
object ret = null;
int num;
do {
lock (rnd) {
num = rnd.Next ();
}
path = Path.Combine (tempdir,
String.Format ("{0}{1}{2}", (prefix != null) ? prefix + "." : "",
num.ToString ("x", Helpers.InvariantCulture),
(extension != null) ? "." + extension : ""));
try {
ret = createFile (path);
} catch (System.IO.IOException) {
} catch { throw; }
} while (ret == null);
return ret;
}
[Conditional ("DEVEL")]
public static void WriteLineLog (string logFilePath, string format, params object[] parms)
{
WriteLog (logFilePath, format + Environment.NewLine, parms);
}
[Conditional ("DEVEL")]
public static void WriteLog (string logFilePath, string format, params object[] parms)
{
string path = logFilePath != null && logFilePath.Length > 0 ? logFilePath :
Path.Combine (Path.GetTempPath (), "System.Web.log");
using (TextWriter tw = new StreamWriter (path, true)) {
if (parms != null && parms.Length > 0)
tw.Write (format, parms);
else
tw.Write (format);
}
}
}
}

View File

@@ -0,0 +1,38 @@
//
// System.Web.Util.Helpers
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2009 Novell, Inc (http://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;
using System.Globalization;
namespace System.Web.Util
{
class Helpers
{
public static readonly CultureInfo InvariantCulture = CultureInfo.InvariantCulture;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,55 @@
//
// System.Web.Util.ICalls
//
// 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.
//
using System.Reflection;
using System.Runtime.CompilerServices;
namespace System.Web.Util
{
class ICalls
{
ICalls () {}
#if TARGET_DOTNET
static public string GetMachineConfigPath () {
return System.Runtime.InteropServices.RuntimeEnvironment.SystemConfigurationFile;
}
#else
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern static public string GetMachineConfigPath ();
#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern static public string GetMachineInstallDirectory ();
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern static public bool GetUnmanagedResourcesPtr (Assembly assembly, out IntPtr ptr, out int length);
}
}

View File

@@ -0,0 +1,39 @@
//
// System.Web.Util.IWebObjectFactory interface
//
// Author:
// Sebastien Pouliot <sebastien@ximian.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 NET_2_0
namespace System.Web.Util {
public interface IWebObjectFactory {
object CreateInstance ();
}
}
#endif

View File

@@ -0,0 +1,40 @@
//
// System.Web.Util.IWebPropertyAccessor interface
//
// Author:
// Sebastien Pouliot <sebastien@ximian.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 NET_2_0
namespace System.Web.Util {
public interface IWebPropertyAccessor {
object GetProperty (object target);
void SetProperty (object target, object value);
}
}
#endif

View File

@@ -0,0 +1,315 @@
//
// System.Web.Util.MachineKeySectionUtils
//
// Authors:
// Chris Toshok (toshok@ximian.com)
// Sebastien Pouliot <sebastien@ximian.com>
//
// (c) Copyright 2005, 2010 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.Configuration;
using System.Configuration.Provider;
using System.Security.Cryptography;
using System.Text;
using System.Web.Configuration;
#if NET_2_0
namespace System.Web.Util {
static class MachineKeySectionUtils {
static byte ToHexValue (char c, bool high)
{
byte v;
if (c >= '0' && c <= '9')
v = (byte) (c - '0');
else if (c >= 'a' && c <= 'f')
v = (byte) (c - 'a' + 10);
else if (c >= 'A' && c <= 'F')
v = (byte) (c - 'A' + 10);
else
throw new ArgumentException ("Invalid hex character");
if (high)
v <<= 4;
return v;
}
internal static byte [] GetBytes (string key, int len)
{
byte [] result = new byte [len / 2];
for (int i = 0; i < len; i += 2)
result [i / 2] = (byte) (ToHexValue (key [i], true) + ToHexValue (key [i + 1], false));
return result;
}
static public string GetHexString (byte [] bytes)
{
StringBuilder sb = new StringBuilder (bytes.Length * 2);
int letterPart = 55;
const int numberPart = 48;
for (int i = 0; i < bytes.Length; i++) {
int tmp = (int) bytes [i];
int second = tmp & 15;
int first = (tmp >> 4) & 15;
sb.Append ((char) (first > 9 ? letterPart + first : numberPart + first));
sb.Append ((char) (second > 9 ? letterPart + second : numberPart + second));
}
return sb.ToString ();
}
// decryption="Auto" [Auto | DES | 3DES | AES | alg:algorithm_name]
// http://msdn.microsoft.com/en-us/library/w8h3skw9.aspx
public static SymmetricAlgorithm GetDecryptionAlgorithm (string name)
{
SymmetricAlgorithm sa = null;
switch (name) {
case "AES":
case "Auto":
sa = Rijndael.Create ();
break;
case "DES":
sa = DES.Create ();
break;
case "3DES":
sa = TripleDES.Create ();
break;
default:
#if NET_4_0
if (name.StartsWith ("alg:")) {
sa = SymmetricAlgorithm.Create (name.Substring (4));
break;
}
#endif
throw new ConfigurationErrorsException ();
}
return sa;
}
// validation="HMACSHA256" [SHA1 | MD5 | 3DES | AES | HMACSHA256 | HMACSHA384 | HMACSHA512 | alg:algorithm_name]
// [1] http://msdn.microsoft.com/en-us/library/system.web.configuration.machinekeyvalidation.aspx
// [2] http://msdn.microsoft.com/en-us/library/w8h3skw9.aspx
public static KeyedHashAlgorithm GetValidationAlgorithm (MachineKeySection section)
{
KeyedHashAlgorithm kha = null;
switch (section.Validation) {
case MachineKeyValidation.MD5:
kha = new HMACMD5 ();
break;
case MachineKeyValidation.AES: // see link [1] or [2]
case MachineKeyValidation.TripleDES: // see link [2]
case MachineKeyValidation.SHA1:
kha = new HMACSHA1 ();
break;
#if NET_4_0
case MachineKeyValidation.HMACSHA256:
kha = new HMACSHA256 ();
break;
case MachineKeyValidation.HMACSHA384:
kha = new HMACSHA384 ();
break;
case MachineKeyValidation.HMACSHA512:
kha = new HMACSHA512 ();
break;
case MachineKeyValidation.Custom:
// remove the "alg:" from the start of the string
string algo = section.ValidationAlgorithm;
if (algo.StartsWith ("alg:"))
kha = KeyedHashAlgorithm.Create (algo.Substring (4));
break;
#endif
}
return kha;
}
// helpers to ease unit testing of the cryptographic code
#if TEST
static byte [] decryption_key;
static byte [] validation_key;
static SymmetricAlgorithm GetDecryptionAlgorithm (MachineKeySection section)
{
return GetDecryptionAlgorithm (section.Decryption);
}
static byte [] GetDecryptionKey (MachineKeySection section)
{
if (decryption_key == null)
decryption_key = GetDecryptionAlgorithm (section).Key;
return decryption_key;
}
static byte [] GetValidationKey (MachineKeySection section)
{
if (validation_key == null)
validation_key = GetValidationAlgorithm (section).Key;
return validation_key;
}
#else
static SymmetricAlgorithm GetDecryptionAlgorithm (MachineKeySection section)
{
return section.GetDecryptionAlgorithm ();
}
static byte[] GetDecryptionKey (MachineKeySection section)
{
return section.GetDecryptionKey ();
}
public static byte [] GetValidationKey (MachineKeySection section)
{
return section.GetValidationKey ();
}
#endif
static public byte [] Decrypt (MachineKeySection section, byte [] encodedData)
{
return Decrypt (section, encodedData, 0, encodedData.Length);
}
static byte [] Decrypt (MachineKeySection section, byte [] encodedData, int offset, int length)
{
using (SymmetricAlgorithm sa = GetDecryptionAlgorithm (section)) {
sa.Key = GetDecryptionKey (section);
return Decrypt (sa, encodedData, offset, length);
}
}
static public byte [] Decrypt (SymmetricAlgorithm alg, byte [] encodedData, int offset, int length)
{
// alg.IV is randomly set (default behavior) and perfect for our needs
// iv is the first part of the encodedPassword
byte [] iv = new byte [alg.IV.Length];
Array.Copy (encodedData, 0, iv, 0, iv.Length);
using (ICryptoTransform decryptor = alg.CreateDecryptor (alg.Key, iv)) {
try {
return decryptor.TransformFinalBlock (encodedData, iv.Length + offset, length - iv.Length);
}
catch (CryptographicException) {
return null;
}
}
}
static public byte [] Encrypt (MachineKeySection section, byte [] data)
{
using (SymmetricAlgorithm sa = GetDecryptionAlgorithm (section)) {
sa.Key = GetDecryptionKey (section);
return Encrypt (sa, data);
}
}
static public byte [] Encrypt (SymmetricAlgorithm alg, byte [] data)
{
// alg.IV is randomly set (default behavior) and perfect for our needs
byte [] iv = alg.IV;
using (ICryptoTransform encryptor = alg.CreateEncryptor (alg.Key, iv)) {
byte [] encrypted = encryptor.TransformFinalBlock (data, 0, data.Length);
byte [] output = new byte [iv.Length + encrypted.Length];
// note: the IV can be public, however it should not be based on the password
Array.Copy (iv, 0, output, 0, iv.Length);
Array.Copy (encrypted, 0, output, iv.Length, encrypted.Length);
return output;
}
}
// in [data]
// return [data][signature]
public static byte [] Sign (MachineKeySection section, byte [] data)
{
return Sign (section, data, 0, data.Length);
}
static byte [] Sign (MachineKeySection section, byte [] data, int offset, int length)
{
using (KeyedHashAlgorithm kha = GetValidationAlgorithm (section)) {
kha.Key = GetValidationKey (section);
byte [] signature = kha.ComputeHash (data, offset, length);
byte [] block = new byte [length + signature.Length];
Array.Copy (data, block, length);
Array.Copy (signature, 0, block, length, signature.Length);
return block;
}
}
public static byte [] Verify (MachineKeySection section, byte [] data)
{
byte [] unsigned_data = null;
bool valid = true;
using (KeyedHashAlgorithm kha = GetValidationAlgorithm (section)) {
kha.Key = GetValidationKey (section);
int signlen = kha.HashSize >> 3; // bits to bytes
byte [] signature = Sign (section, data, 0, data.Length - signlen);
for (int i = 0; i < signature.Length; i++) {
if (signature [i] != data [data.Length - signature.Length + i])
valid = false; // do not return (timing attack)
}
unsigned_data = new byte [data.Length - signlen];
Array.Copy (data, 0, unsigned_data, 0, unsigned_data.Length);
}
return valid ? unsigned_data : null;
}
// do NOT sign then encrypt
public static byte [] EncryptSign (MachineKeySection section, byte [] data)
{
byte [] encdata = Encrypt (section, data);
return Sign (section, encdata);
}
// note: take no shortcut (timing attack) while verifying or decrypting
public static byte [] VerifyDecrypt (MachineKeySection section, byte [] block)
{
bool valid = true;
int signlen;
using (KeyedHashAlgorithm kha = GetValidationAlgorithm (section)) {
kha.Key = GetValidationKey (section);
signlen = kha.HashSize >> 3; // bits to bytes
byte [] signature = Sign (section, block, 0, block.Length - signlen);
for (int i = 0; i < signature.Length; i++) {
if (signature [i] != block [block.Length - signature.Length + i])
valid = false; // do not return (timing attack)
}
}
// whatever the signature continue with decryption
try {
byte [] decdata = Decrypt (section, block, 0, block.Length - signlen);
return valid ? decdata : null;
}
catch {
return null;
}
}
}
}
#endif

View File

@@ -0,0 +1,41 @@
//
// Authors:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2010 Novell, Inc (http://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.Web.Util
{
public enum RequestValidationSource
{
QueryString,
Form,
Cookies,
Files,
RawUrl,
Path,
PathInfo,
Headers
}
}

View File

@@ -0,0 +1,124 @@
//
// Authors:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2010 Novell, Inc (http://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;
using System.Configuration;
using System.Web;
using System.Web.Configuration;
namespace System.Web.Util
{
public class RequestValidator
{
static RequestValidator current;
static Lazy <RequestValidator> lazyLoader;
// The stack trace from .NET shows it uses Lazy <T>:
//
// Server stack trace:
// at System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase)
// at System.Web.Util.RequestValidator.GetCustomValidatorFromConfig()
// at System.Lazy`1.CreateValue()
//
public static RequestValidator Current {
get {
if (current == null)
current = lazyLoader.Value;
return current;
}
set {
if (value == null)
throw new ArgumentNullException ("value");
current = value;
}
}
static RequestValidator ()
{
lazyLoader = new Lazy <RequestValidator> (new Func <RequestValidator> (LoadConfiguredValidator));
}
public RequestValidator ()
{
}
protected internal virtual bool IsValidRequestString (HttpContext context, string value, RequestValidationSource requestValidationSource,
string collectionKey, out int validationFailureIndex)
{
validationFailureIndex = 0;
return !HttpRequest.IsInvalidString (value, out validationFailureIndex);
}
static void ParseTypeName (string spec, out string typeName, out string assemblyName)
{
try {
if (String.IsNullOrEmpty (spec)) {
typeName = null;
assemblyName = null;
return;
}
int comma = spec.IndexOf (',');
if (comma == -1) {
typeName = spec;
assemblyName = null;
return;
}
typeName = spec.Substring (0, comma).Trim ();
assemblyName = spec.Substring (comma + 1).Trim ();
} catch {
typeName = spec;
assemblyName = null;
}
}
static RequestValidator LoadConfiguredValidator ()
{
HttpRuntimeSection runtimeConfig = HttpRuntime.Section;
Type validatorType = null;
string typeSpec = runtimeConfig.RequestValidationType;
try {
validatorType = HttpApplication.LoadType <RequestValidator> (typeSpec, true);
} catch (TypeLoadException ex) {
string typeName, assemblyName;
ParseTypeName (typeSpec, out typeName, out assemblyName);
throw new ConfigurationErrorsException (
String.Format ("Could not load type '{0}' from assembly '{1}'.", typeName, assemblyName),
ex);
}
return (RequestValidator) Activator.CreateInstance (validatorType);
}
}
}

View File

@@ -0,0 +1,144 @@
//
// System.Web.Util.RuntimeHelpers
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2006-2010 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;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Web.Configuration;
namespace System.Web.Util
{
static class RuntimeHelpers
{
public static bool CaseInsensitive {
get; private set;
}
public static bool DebuggingEnabled {
get {
CompilationSection cs = WebConfigurationManager.GetSection ("system.web/compilation") as CompilationSection;
if (cs != null)
return cs.Debug;
return false;
}
}
public static IEqualityComparer <string> StringEqualityComparer {
get; private set;
}
public static IEqualityComparer <string> StringEqualityComparerCulture {
get; private set;
}
public static bool IsUncShare {
get; private set;
}
public static string MonoVersion {
get; private set;
}
public static bool RunningOnWindows {
get; private set;
}
public static StringComparison StringComparison {
get; private set;
}
public static StringComparison StringComparisonCulture {
get; private set;
}
static RuntimeHelpers ()
{
PlatformID pid = Environment.OSVersion.Platform;
RunningOnWindows = ((int) pid != 128 && pid != PlatformID.Unix && pid != PlatformID.MacOSX);
if (RunningOnWindows) {
CaseInsensitive = true;
string appDomainAppPath = AppDomain.CurrentDomain.GetData (".appPath") as string;
if (!String.IsNullOrEmpty (appDomainAppPath)) {
try {
IsUncShare = new Uri (appDomainAppPath).IsUnc;
} catch {
// ignore
}
}
} else {
string mono_iomap = Environment.GetEnvironmentVariable ("MONO_IOMAP");
if (!String.IsNullOrEmpty (mono_iomap)) {
if (mono_iomap == "all")
CaseInsensitive = true;
else {
string[] parts = mono_iomap.Split (':');
foreach (string p in parts) {
if (p == "all" || p == "case") {
CaseInsensitive = true;
break;
}
}
}
}
}
if (CaseInsensitive) {
StringEqualityComparer = StringComparer.OrdinalIgnoreCase;
StringEqualityComparerCulture = StringComparer.CurrentCultureIgnoreCase;
StringComparison = StringComparison.OrdinalIgnoreCase;
StringComparisonCulture = StringComparison.CurrentCultureIgnoreCase;
} else {
StringEqualityComparer = StringComparer.Ordinal;
StringEqualityComparerCulture = StringComparer.CurrentCulture;
StringComparison = StringComparison.Ordinal;
StringComparisonCulture = StringComparison.CurrentCulture;
}
string monoVersion = null;
try {
Type monoRuntime = Type.GetType ("Mono.Runtime", false);
if (monoRuntime != null) {
MethodInfo mi = monoRuntime.GetMethod ("GetDisplayName", BindingFlags.Static | BindingFlags.NonPublic);
if (mi != null)
monoVersion = mi.Invoke (null, new object [0]) as string;
}
} catch {
// ignore
}
if (monoVersion == null)
monoVersion = Environment.Version.ToString ();
MonoVersion = monoVersion;
}
}
}

View File

@@ -0,0 +1,196 @@
//
// System.IO.SearchPattern.cs: Filename glob support.
//
// Author:
// Dan Lewis (dihlewis@yahoo.co.uk)
//
// (C) 2002
//
//
// Copyright (C) 2004 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;
namespace System.Web.Util {
// FIXME: there's a complication with this algorithm under windows.
// the pattern '*.*' matches all files (i think . matches the extension),
// whereas under UNIX it should only match files containing the '.' character.
class SearchPattern
{
public SearchPattern (string pattern) : this (pattern, false) { }
public SearchPattern (string pattern, bool ignore)
{
SetPattern (pattern, ignore);
}
public void SetPattern (string pattern, bool ignore)
{
this.ignore = ignore;
Compile (pattern);
}
public bool IsMatch (string text)
{
return Match (ops, text, 0);
}
// private
private Op ops; // the compiled pattern
private bool ignore; // ignore case
private void Compile (string pattern)
{
if (pattern == null)
throw new ArgumentException ("Invalid search pattern.");
if (pattern == "*") { // common case
ops = new Op (OpCode.True);
return;
}
ops = null;
int ptr = 0;
Op last_op = null;
while (ptr < pattern.Length) {
Op op;
switch (pattern [ptr]) {
case '?':
op = new Op (OpCode.AnyChar);
++ ptr;
break;
case '*':
op = new Op (OpCode.AnyString);
++ ptr;
break;
default:
op = new Op (OpCode.ExactString);
int end = pattern.IndexOfAny (WildcardChars, ptr);
if (end < 0)
end = pattern.Length;
op.Argument = pattern.Substring (ptr, end - ptr);
if (ignore)
op.Argument = op.Argument.ToLower ();
ptr = end;
break;
}
if (last_op == null)
ops = op;
else
last_op.Next = op;
last_op = op;
}
if (last_op == null)
ops = new Op (OpCode.End);
else
last_op.Next = new Op (OpCode.End);
}
private bool Match (Op op, string text, int ptr)
{
while (op != null) {
switch (op.Code) {
case OpCode.True:
return true;
case OpCode.End:
if (ptr == text.Length)
return true;
return false;
case OpCode.ExactString:
int length = op.Argument.Length;
if (ptr + length > text.Length)
return false;
string str = text.Substring (ptr, length);
if (ignore)
str = str.ToLower ();
if (str != op.Argument)
return false;
ptr += length;
break;
case OpCode.AnyChar:
if (++ ptr > text.Length)
return false;
break;
case OpCode.AnyString:
while (ptr <= text.Length) {
if (Match (op.Next, text, ptr))
return true;
++ ptr;
}
return false;
}
op = op.Next;
}
return true;
}
// private static
internal static readonly char [] WildcardChars = { '*', '?' };
private class Op {
public Op (OpCode code)
{
this.Code = code;
this.Argument = null;
this.Next = null;
}
public OpCode Code;
public string Argument;
public Op Next;
}
private enum OpCode {
ExactString, // literal
AnyChar, // ?
AnyString, // *
End, // end of pattern
True // always succeeds
};
}
}

View File

@@ -0,0 +1,131 @@
//
// System.Collections.SecureHashCodeProvider.cs
//
// Authors:
// Sergey Chaban (serge@wildwestsoftware.com)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
// Copyright 2012 Xamarin, Inc (http://xamarin.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;
using System.Collections;
using System.Globalization;
namespace System.Web.Util
{
class SecureHashCodeProvider : IHashCodeProvider
{
static readonly SecureHashCodeProvider singletonInvariant = new SecureHashCodeProvider (CultureInfo.InvariantCulture);
static SecureHashCodeProvider singleton;
static readonly object sync = new object ();
static readonly int seed;
TextInfo m_text; // must match MS name for serialization
public static SecureHashCodeProvider Default {
get {
lock (sync) {
if (singleton == null) {
singleton = new SecureHashCodeProvider ();
} else if (singleton.m_text == null) {
if (!AreEqual (CultureInfo.CurrentCulture, CultureInfo.InvariantCulture))
singleton = new SecureHashCodeProvider ();
} else if (!AreEqual (singleton.m_text, CultureInfo.CurrentCulture)) {
singleton = new SecureHashCodeProvider ();
}
return singleton;
}
}
}
public static SecureHashCodeProvider DefaultInvariant {
get { return singletonInvariant; }
}
static SecureHashCodeProvider ()
{
// It should be enough to fend off the attack described in
// https://bugzilla.novell.com/show_bug.cgi?id=739119
// In order to predict value of the seed, the attacker would have to know the exact time when
// the server process started and since it's a remote attack, this is next to impossible.
// Using milliseconds instead of ticks here would make it easier for the attackers since there
// would only be as many as 1000 possible values
seed = (int)DateTime.UtcNow.Ticks;
}
// Public instance constructor
public SecureHashCodeProvider ()
{
CultureInfo culture = CultureInfo.CurrentCulture;
if (!AreEqual (culture, CultureInfo.InvariantCulture))
m_text = CultureInfo.CurrentCulture.TextInfo;
}
public SecureHashCodeProvider (CultureInfo culture)
{
if (culture == null)
throw new ArgumentNullException ("culture");
if (!AreEqual (culture, CultureInfo.InvariantCulture))
m_text = culture.TextInfo;
}
static bool AreEqual (CultureInfo a, CultureInfo b)
{
return a.LCID == b.LCID;
}
static bool AreEqual (TextInfo info, CultureInfo culture)
{
return info.LCID == culture.LCID;
}
public int GetHashCode (object obj)
{
if (obj == null)
throw new ArgumentNullException ("obj");
string str = obj as string;
if (str == null)
return obj.GetHashCode ();
int h = seed;
char c;
if ((m_text != null) && !AreEqual (m_text, CultureInfo.InvariantCulture)) {
str = m_text.ToLower (str);
for (int i = 0; i < str.Length; i++) {
c = str [i];
h = h * 31 + c;
}
} else {
for (int i = 0; i < str.Length; i++) {
c = Char.ToLower (str [i], CultureInfo.InvariantCulture);
h = h * 31 + c;
}
}
return h;
}
}
}

View File

@@ -0,0 +1,89 @@
//
// 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.
//
// Copyright <20> 2006, 2007 Nauck IT KG http://www.nauck-it.de
//
// Author:
// Daniel Nauck <d.nauck(at)nauck-it.de>
#if NET_2_0
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
namespace System.Web.Util
{
internal class SerializationHelper
{
internal string SerializeToBase64(object value)
{
return Convert.ToBase64String(SerializeToBinary(value));
}
internal object DeserializeFromBase64(string value)
{
return DeserializeFromBinary(Convert.FromBase64String(value));
}
internal string SerializeToXml(object value)
{
using (MemoryStream mStream = new MemoryStream())
{
XmlSerializer xmlFormatter = new XmlSerializer(typeof(object), "http://www.nauck-it.de/PostgreSQLProvider");
xmlFormatter.Serialize(mStream, value);
return Convert.ToBase64String(mStream.ToArray());
}
}
internal object DeserializeFromXml(string value)
{
using (MemoryStream mStream = new MemoryStream(Convert.FromBase64String(value)))
{
XmlSerializer xmlFormatter = new XmlSerializer(typeof(object), "http://www.nauck-it.de/PostgreSQLProvider");
return xmlFormatter.Deserialize(mStream);
}
}
internal byte[] SerializeToBinary(object value)
{
using (MemoryStream mStream = new MemoryStream())
{
BinaryFormatter binFormatter = new BinaryFormatter();
binFormatter.Serialize(mStream, value);
return mStream.ToArray();
}
}
internal object DeserializeFromBinary(byte[] value)
{
using (MemoryStream mStream = new MemoryStream(value))
{
BinaryFormatter binFormatter = new BinaryFormatter();
return binFormatter.Deserialize(mStream);
}
}
}
}
#endif

View File

@@ -0,0 +1,49 @@
//
// Authors:
// Marek Habersack <grendel@twistedcode.net>
//
// (C) 2011 Novell, Inc (http://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;
namespace System.Web.Util
{
sealed class SimpleWebObjectFactory : IWebObjectFactory
{
Type type;
public SimpleWebObjectFactory (Type type)
{
this.type = type;
}
public object CreateInstance ()
{
if (type == null)
return null;
return Activator.CreateInstance (type);
}
}
}

View File

@@ -0,0 +1,134 @@
//
// System.Web.Util.StrUtils
//
// Author(s):
// Gonzalo Paniagua Javier (gonzalo@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;
using System.Globalization;
using System.Text;
namespace System.Web.Util {
internal sealed class StrUtils
{
StrUtils () { }
public static bool StartsWith (string str1, string str2)
{
return StartsWith (str1, str2, false);
}
public static bool StartsWith (string str1, string str2, bool ignore_case)
{
int l2 = str2.Length;
if (l2 == 0)
return true;
int l1 = str1.Length;
if (l2 > l1)
return false;
return (0 == String.Compare (str1, 0, str2, 0, l2, ignore_case, Helpers.InvariantCulture));
}
public static bool EndsWith (string str1, string str2)
{
return EndsWith (str1, str2, false);
}
public static bool EndsWith (string str1, string str2, bool ignore_case)
{
int l2 = str2.Length;
if (l2 == 0)
return true;
int l1 = str1.Length;
if (l2 > l1)
return false;
return (0 == String.Compare (str1, l1 - l2, str2, 0, l2, ignore_case, Helpers.InvariantCulture));
}
public static string EscapeQuotesAndBackslashes (string attributeValue)
{
StringBuilder sb = null;
for (int i = 0; i < attributeValue.Length; i++) {
char ch = attributeValue [i];
if (ch == '\'' || ch == '"' || ch == '\\') {
if (sb == null) {
sb = new StringBuilder ();
sb.Append (attributeValue.Substring (0, i));
}
sb.Append ('\\');
sb.Append (ch);
}
else {
if (sb != null)
sb.Append (ch);
}
}
if (sb != null)
return sb.ToString ();
return attributeValue;
}
public static bool IsNullOrEmpty (string value)
{
#if NET_2_0
return String.IsNullOrEmpty (value);
#else
return value == null || value.Length == 0;
#endif
}
public static string [] SplitRemoveEmptyEntries (string value, char [] separator)
{
#if NET_2_0
return value.Split (separator, StringSplitOptions.RemoveEmptyEntries);
#else
string [] parts = value.Split (separator);
int delta = 0;
for (int i = 0; i < parts.Length; i++) {
if (IsNullOrEmpty (parts [i])) {
delta++;
}
else {
if (delta > 0)
parts [i - delta] = parts [i];
}
}
if (delta == 0)
return parts;
string [] parts_copy = new string [parts.Length - delta];
Array.Copy (parts, parts_copy, parts_copy.Length);
return parts_copy;
#endif
}
}
}

View File

@@ -0,0 +1,46 @@
//
// System.Web.Util.TimeUtil
//
// Author(s):
// Jackson Harper (jackson@ximian.com)
//
// (C) 2003 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;
using System.Globalization;
namespace System.Web.Util {
internal sealed class TimeUtil
{
TimeUtil () { }
internal static string ToUtcTimeString (DateTime dt)
{
return dt.ToUniversalTime ().ToString ("R", DateTimeFormatInfo.InvariantInfo);
}
}
}

Some files were not shown because too many files have changed in this diff Show More