mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 03:51:19 -10:00
Compare commits
80
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
074b47c890 | ||
|
|
ba6b10b69c | ||
|
|
41e151d8b5 | ||
|
|
de2f33f7b2 | ||
|
|
7569e1a18d | ||
|
|
933e19bca3 | ||
|
|
501f5a9ed6 | ||
|
|
1538a59191 | ||
|
|
5892cd77a0 | ||
|
|
c82a2e5074 | ||
|
|
d778fb3631 | ||
|
|
a813491664 | ||
|
|
f0c92250f1 | ||
|
|
dc0ce1d96e | ||
|
|
76cd0085cc | ||
|
|
ef27535985 | ||
|
|
18666b6e21 | ||
|
|
3016bd7f31 | ||
|
|
9331fc979b | ||
|
|
4e94779847 | ||
|
|
12fd95f950 | ||
|
|
e1edabc081 | ||
|
|
3a4aeaa649 | ||
|
|
a067aa1cc7 | ||
|
|
2d61e91f57 | ||
|
|
cba1d4ffa1 | ||
|
|
eef579fa97 | ||
|
|
be40f3f97e | ||
|
|
40a3eb5354 | ||
|
|
1b35c8b74a | ||
|
|
b92d2bd239 | ||
|
|
00d88a51af | ||
|
|
aaa6f3c3fc | ||
|
|
b75fa2b333 | ||
|
|
84068e57b7 | ||
|
|
92be1aebdb | ||
|
|
7138ab117f | ||
|
|
09d18d4f47 | ||
|
|
75b30d0fd9 | ||
|
|
b813e56737 | ||
|
|
117302400a | ||
|
|
399facb8ca | ||
|
|
2311da7b9a | ||
|
|
5b3813b1d2 | ||
|
|
2e5167402b | ||
|
|
bf54221823 | ||
|
|
f9afcf06b9 | ||
|
|
d955217874 | ||
|
|
d457bae593 | ||
|
|
6e152a16a1 | ||
|
|
a824dad5f6 | ||
|
|
55fcfb81be | ||
|
|
f8691c441b | ||
|
|
2f569721a7 | ||
|
|
f07e7d0850 | ||
|
|
a9a6e86072 | ||
|
|
219bd64946 | ||
|
|
255a8971e5 | ||
|
|
91a4a3d504 | ||
|
|
6d5c45d559 | ||
|
|
5e1afc4533 | ||
|
|
e7da99bb17 | ||
|
|
e9e611d501 | ||
|
|
cefe30a5cc | ||
|
|
928436efc6 | ||
|
|
838ec2fb6f | ||
|
|
45d8971caa | ||
|
|
cf53f2aab3 | ||
|
|
f2c520372f | ||
|
|
3bc58c925b | ||
|
|
3790413f38 | ||
|
|
ef4965a6dd | ||
|
|
7cb75c8355 | ||
|
|
90a83b65df | ||
|
|
96a5c1247e | ||
|
|
b5a5402beb | ||
|
|
9d2eec1131 | ||
|
|
a825298e9d | ||
|
|
e11a0b175d | ||
|
|
2f5ddd0210 |
No files matched your search
@@ -69,6 +69,7 @@ config.status
|
||||
config.sub
|
||||
configure
|
||||
configure.scan
|
||||
cygconfig.h
|
||||
depcomp
|
||||
install-sh
|
||||
libtool
|
||||
|
||||
@@ -25,6 +25,3 @@
|
||||
[submodule "external/ikdasm"]
|
||||
path = external/ikdasm
|
||||
url = git://github.com/mono/ikdasm.git
|
||||
[submodule "external/referencesource"]
|
||||
path = external/referencesource
|
||||
url = git://github.com/mono/referencesource
|
||||
+25
-4
@@ -1,7 +1,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#AC_PREREQ([2.62])
|
||||
|
||||
AC_INIT(mono, [3.12.1],
|
||||
AC_INIT(mono, [3.12.0],
|
||||
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
|
||||
|
||||
AC_CONFIG_SRCDIR([README.md])
|
||||
@@ -578,7 +578,6 @@ else
|
||||
fi
|
||||
CFLAGS="$CFLAGS -g $WARN"
|
||||
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -g"
|
||||
CPPFLAGS="$CPPFLAGS -g $WARN"
|
||||
|
||||
# Where's the 'mcs' source tree?
|
||||
if test -d $srcdir/mcs; then
|
||||
@@ -2460,6 +2459,8 @@ if test "x$enable_llvm" = "xyes"; then
|
||||
|
||||
# Should be something like '2.6' or '2.7svn'
|
||||
llvm_version=`$LLVM_CONFIG --version`
|
||||
major_version=`echo $llvm_version | cut -c 1`
|
||||
minor_version=`echo $llvm_version | cut -c 3`
|
||||
llvm_api_version=`$LLVM_CONFIG --mono-api-version 2>/dev/null`
|
||||
AC_MSG_CHECKING(LLVM version)
|
||||
AC_MSG_RESULT($llvm_version)
|
||||
@@ -2480,8 +2481,14 @@ if test "x$enable_llvm" = "xyes"; then
|
||||
AC_MSG_ERROR([Compiling with stock LLVM is not supported, please use the Mono LLVM repo at https://github.com/mono/llvm, with the GIT branch which matches this version of mono, i.e. 'mono-2-10' for Mono 2.10.])
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(LLVM_MAJOR_VERSION, $major_version, [Major version of LLVM libraries])
|
||||
AC_DEFINE_UNQUOTED(LLVM_MINOR_VERSION, $minor_version, [Minor version of LLVM libraries])
|
||||
AC_DEFINE_UNQUOTED(LLVM_VERSION, "$llvm_version", [Full version of LLVM libraties])
|
||||
|
||||
# Have to pass these on the command line since mini-llvm-cpp.h already includes
|
||||
# llvm's config.h
|
||||
LLVM_CXXFLAGS="$LLVM_CXXFLAGS -DLLVM_MAJOR_VERSION=$major_version -DLLVM_MINOR_VERSION=$minor_version"
|
||||
|
||||
AC_SUBST(LLVM_CFLAGS)
|
||||
AC_SUBST(LLVM_CXXFLAGS)
|
||||
AC_SUBST(LLVM_LIBS)
|
||||
@@ -2799,7 +2806,18 @@ if test "x$host" != "x$target"; then
|
||||
# in mono-compiler.h
|
||||
with_tls=pthread
|
||||
target_mach=no
|
||||
;;
|
||||
;;
|
||||
aarch64*-linux-*)
|
||||
TARGET=ARM64;
|
||||
arch_target=arm64;
|
||||
AC_DEFINE(TARGET_ARM64, 1, [...])
|
||||
AC_DEFINE(TARGET_ANDROID, 1, [...])
|
||||
CPPFLAGS="$CPPFLAGS"
|
||||
# Can't use tls, since it depends on the runtime detection of tls offsets
|
||||
# in mono-compiler.h
|
||||
with_tls=pthread
|
||||
target_mach=no
|
||||
;;
|
||||
aarch64-*)
|
||||
TARGET=ARM64
|
||||
;;
|
||||
@@ -3199,7 +3217,7 @@ case "x$libgc" in
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_WITH(profile2, [ --with-profile2=yes,no If you want to install the 2.0/3.5 FX (defaults to yes)], [], [with_profile2=no])
|
||||
AC_ARG_WITH(profile2, [ --with-profile2=yes,no If you want to install the 2.0/3.5 FX (defaults to yes)], [], [with_profile2=yes])
|
||||
AC_ARG_WITH(profile4, [ --with-profile4=yes,no If you want to install the 4.0 FX (defaults to yes)], [], [with_profile4=yes])
|
||||
AC_ARG_WITH(profile4_5,[ --with-profile4_5=yes,no If you want to install the 4.5 FX (defaults to yes)], [], [with_profile4_5=yes])
|
||||
AC_ARG_WITH(monodroid, [ --with-monodroid=yes,no If you want to build the MonoDroid assemblies (defaults to no)], [], [with_monodroid=no])
|
||||
@@ -3275,6 +3293,7 @@ dnl Consistency settings
|
||||
dnl
|
||||
if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then
|
||||
DISABLE_MCS_DOCS=yes
|
||||
with_profile2=no
|
||||
with_profile4=no
|
||||
with_profile4_5=no
|
||||
with_monodroid=no
|
||||
@@ -3298,6 +3317,7 @@ AC_SUBST(OPROFILE_LIBS)
|
||||
|
||||
libmono_ldflags="$libmono_ldflags $LIBS"
|
||||
|
||||
AM_CONDITIONAL(INSTALL_2_0, [test "x$with_profile2" = xyes])
|
||||
AM_CONDITIONAL(INSTALL_4_0, [test "x$with_profile4" = xyes])
|
||||
AM_CONDITIONAL(INSTALL_4_5, [test "x$with_profile4_5" = xyes])
|
||||
AM_CONDITIONAL(INSTALL_MONODROID, [test "x$with_monodroid" != "xno"])
|
||||
@@ -3742,6 +3762,7 @@ echo "
|
||||
LLVM Back End: $enable_llvm (dynamically loaded: $enable_loadedllvm)
|
||||
|
||||
Libraries:
|
||||
.NET 2.0/3.5: $with_profile2
|
||||
.NET 4.0: $with_profile4
|
||||
.NET 4.5: $with_profile4_5
|
||||
MonoDroid: $with_monodroid
|
||||
|
||||
+3
-3
@@ -99,14 +99,14 @@ mono-file-formats.tree: $(srcdir)/docs.make $(srcdir)/Makefile.am $(srcdir)/depl
|
||||
deploy/.stamp: convert.exe Makefile.am
|
||||
$(mkdir_p) html
|
||||
runtimedir=`cd ../runtime && pwd`; export runtimedir; \
|
||||
MONO_PATH=../mcs/class/lib/net_4_5 perl $(srcdir)/exdoc -h $(srcdir) -t . $(srcdir)/../mono/*/*.c
|
||||
MONO_PATH=../mcs/class/lib/net_2_0 perl $(srcdir)/exdoc -h $(srcdir) -t . $(srcdir)/../mono/*/*.c
|
||||
touch $@
|
||||
|
||||
extract: deploy/.stamp
|
||||
|
||||
convert.exe: convert.cs AgilityPack.dll
|
||||
$(TOOL_MAKE) PROFILE=net_4_5 convert.exe
|
||||
$(TOOL_MAKE) PROFILE=net_2_0 convert.exe
|
||||
|
||||
AgilityPack.dll:
|
||||
$(TOOL_MAKE) PROFILE=net_4_5 AgilityPack.dll
|
||||
$(TOOL_MAKE) PROFILE=net_2_0 AgilityPack.dll
|
||||
|
||||
+2
-1
@@ -135,6 +135,7 @@ AC_CHECK_SIZEOF(void *)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
AC_CHECK_SIZEOF(long long)
|
||||
AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf)
|
||||
AC_CHECK_FUNCS(getrlimit)
|
||||
|
||||
#
|
||||
# Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
|
||||
@@ -179,7 +180,7 @@ if test "x$have_iso_varargs" = "xyes"; then
|
||||
fi
|
||||
AC_SUBST(G_HAVE_ISO_VARARGS)
|
||||
|
||||
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h)
|
||||
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h sys/resource.h)
|
||||
AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
|
||||
AC_SUBST(HAVE_ALLOCA_H)
|
||||
|
||||
|
||||
@@ -176,7 +176,6 @@ typedef struct _GMemChunk GMemChunk;
|
||||
/*
|
||||
* Misc.
|
||||
*/
|
||||
#define g_atexit(func) ((void) atexit (func))
|
||||
|
||||
const gchar * g_getenv(const gchar *variable);
|
||||
gboolean g_setenv(const gchar *variable, const gchar *value, gboolean overwrite);
|
||||
|
||||
+23
-2
@@ -53,6 +53,10 @@
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#include <io.h>
|
||||
#include <winsock2.h>
|
||||
@@ -213,6 +217,23 @@ write_all (int fd, const void *vbuf, size_t n)
|
||||
return nwritten;
|
||||
}
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
static int
|
||||
g_getdtablesize (void)
|
||||
{
|
||||
#ifdef HAVE_GETRLIMIT
|
||||
struct rlimit limit;
|
||||
int res;
|
||||
|
||||
res = getrlimit (RLIMIT_NOFILE, &limit);
|
||||
g_assert (res == 0);
|
||||
return limit.rlim_cur;
|
||||
#else
|
||||
return getdtablesize ();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
g_spawn_command_line_sync (const gchar *command_line,
|
||||
gchar **standard_output,
|
||||
@@ -256,7 +277,7 @@ g_spawn_command_line_sync (const gchar *command_line,
|
||||
close (stderr_pipe [0]);
|
||||
dup2 (stderr_pipe [1], STDERR_FILENO);
|
||||
}
|
||||
for (i = getdtablesize () - 1; i >= 3; i--)
|
||||
for (i = g_getdtablesize () - 1; i >= 3; i--)
|
||||
close (i);
|
||||
|
||||
/* G_SPAWN_SEARCH_PATH is always enabled for g_spawn_command_line_sync */
|
||||
@@ -417,7 +438,7 @@ g_spawn_async_with_pipes (const gchar *working_directory,
|
||||
}
|
||||
|
||||
if ((flags & G_SPAWN_LEAVE_DESCRIPTORS_OPEN) != 0) {
|
||||
for (i = getdtablesize () - 1; i >= 3; i--)
|
||||
for (i = g_getdtablesize () - 1; i >= 3; i--)
|
||||
close (i);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
/* config.h. Generated by configure. */
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include "cygconfig.h"
|
||||
#else
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
@@ -74,3 +78,4 @@
|
||||
#define VERSION "0.1"
|
||||
|
||||
#define HAVE_STRTOK_R 1
|
||||
#endif
|
||||
Vendored
-1
Submodule external/referencesource deleted from 4e6dea7a9c.
@@ -32,7 +32,7 @@
|
||||
# define GC_LINUX_THREADS
|
||||
#endif
|
||||
#if defined(WIN32_THREADS)
|
||||
# define GC_WIN32_THREADS 1
|
||||
# define GC_WIN32_THREADS
|
||||
#endif
|
||||
#if defined(USE_LD_WRAP)
|
||||
# define GC_USE_LD_WRAP
|
||||
|
||||
+5
-3
@@ -6,16 +6,17 @@ SUBDIRS := build jay mcs class nunit24 ilasm tools tests errors docs
|
||||
|
||||
basic_SUBDIRS := build jay mcs class
|
||||
build_SUBDIRS := build class mcs class/aot-compiler tools
|
||||
net_2_0_SUBDIRS := build class nunit24 ilasm tools tests errors docs
|
||||
monodroid_SUBDIRS := build class
|
||||
monotouch_SUBDIRS := build class
|
||||
monotouch_runtime_SUBDIRS := build class
|
||||
xammac_SUBDIRS := build class
|
||||
mobile_SUBDIRS := build class
|
||||
mobile_static_SUBDIRS := build class
|
||||
net_3_5_SUBDIRS := build class tools/xbuild
|
||||
net_4_0_SUBDIRS := build class
|
||||
net_4_5_SUBDIRS := build mcs class nunit24 ilasm tools tests errors docs
|
||||
xbuild_12_SUBDIRS := build class tools/xbuild
|
||||
xbuild_14_SUBDIRS := build class tools/xbuild
|
||||
|
||||
# List of test subdirs that should pass 100%
|
||||
centum_tests := \
|
||||
@@ -86,7 +87,7 @@ dir-check:
|
||||
|
||||
# fun specialty targets
|
||||
|
||||
PROFILES = net_3_5 net_4_0 net_4_5 xbuild_12 xbuild_14
|
||||
PROFILES = net_2_0 net_3_5 net_4_0 net_4_5 xbuild_12
|
||||
|
||||
.PHONY: all-profiles $(STD_TARGETS:=-profiles)
|
||||
all-profiles $(STD_TARGETS:=-profiles): %-profiles: profiles-do--%
|
||||
@@ -105,16 +106,17 @@ profiles-do--run-test:
|
||||
|
||||
# Orchestrate the bootstrap here.
|
||||
_boot_ = all clean install
|
||||
$(_boot_:%=profile-do--xbuild_14--%): profile-do--xbuild_14--%: profile-do--net_4_5--%
|
||||
$(_boot_:%=profile-do--xbuild_12--%): profile-do--xbuild_12--%: profile-do--net_4_5--%
|
||||
$(_boot_:%=profile-do--net_4_5--%): profile-do--net_4_5--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--net_4_0--%): profile-do--net_4_0--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--net_3_5--%): profile-do--net_3_5--%: profile-do--net_2_0--%
|
||||
$(_boot_:%=profile-do--monodroid--%): profile-do--monodroid--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--monotouch--%): profile-do--monotouch--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--monotouch_runtime--%): profile-do--monotouch_runtime--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--xammac--%): profile-do--xammac--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--mobile--%): profile-do--mobile--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--mobile_static--%): profile-do--mobile_static--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--net_2_0--%): profile-do--net_2_0--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--build--%): profile-do--build--%: profile-do--basic--%
|
||||
|
||||
testcorlib:
|
||||
|
||||
+1
-2
@@ -22,8 +22,7 @@ PROFILES = \
|
||||
net_3_5 \
|
||||
net_4_0 \
|
||||
net_4_5 \
|
||||
xbuild_12 \
|
||||
xbuild_14
|
||||
xbuild_12
|
||||
|
||||
COMMON_SRCS = \
|
||||
Consts.cs.in \
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# -*- makefile -*-
|
||||
|
||||
BOOTSTRAP_PROFILE = build
|
||||
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
|
||||
MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
|
||||
|
||||
# nuttzing!
|
||||
|
||||
profile-check:
|
||||
@:
|
||||
|
||||
DEFAULT_REFERENCES = -r:mscorlib.dll
|
||||
PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
|
||||
|
||||
FRAMEWORK_VERSION = 2.0
|
||||
XBUILD_VERSION = 2.0
|
||||
@@ -0,0 +1,20 @@
|
||||
# -*- makefile -*-
|
||||
|
||||
BOOTSTRAP_PROFILE = build
|
||||
|
||||
MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
|
||||
|
||||
# nuttzing!
|
||||
|
||||
profile-check:
|
||||
@:
|
||||
|
||||
DEFAULT_REFERENCES = -r:mscorlib.dll
|
||||
PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_3_5 -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) -lib:$(topdir)/class/lib/net_2_0 $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
|
||||
|
||||
FRAMEWORK_VERSION = 3.5
|
||||
XBUILD_VERSION = 3.5
|
||||
|
||||
TEST_HARNESS = $(topdir)/class/lib/net_2_0/nunit-console.exe
|
||||
TEST_MONO_PATH = $(topdir)/class/lib/net_2_0
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
|
||||
include $(topdir)/build/profiles/net_4_5.make
|
||||
|
||||
PROFILE_MCS_FLAGS := $(PROFILE_MCS_FLAGS) -d:XBUILD_12 -d:XBUILD_14 -lib:$(topdir)/class/lib/net_4_5
|
||||
|
||||
XBUILD_VERSION = 14.0
|
||||
+3
-2
@@ -33,7 +33,6 @@ net_2_0_dirs := \
|
||||
System.EnterpriseServices \
|
||||
Mono.Data.Tds \
|
||||
System.Data \
|
||||
System.ComponentModel.DataAnnotations \
|
||||
Accessibility \
|
||||
Mono.WebBrowser \
|
||||
System.Runtime.Serialization.Formatters.Soap \
|
||||
@@ -82,6 +81,7 @@ net_2_0_dirs := \
|
||||
System.ServiceModel \
|
||||
System.Web.Extensions \
|
||||
System.Web.Extensions.Design \
|
||||
System.ComponentModel.DataAnnotations \
|
||||
System.Web.DynamicData \
|
||||
System.Web.Mvc2 \
|
||||
Mono.C5 \
|
||||
@@ -231,16 +231,17 @@ xbuild_4_0_dirs := \
|
||||
$(xbuild_2_0_dirs) \
|
||||
Microsoft.Build
|
||||
|
||||
net_2_0_SUBDIRS := $(net_2_0_dirs) $(net_2_0_only_dirs) $(xbuild_2_0_dirs) aot-compiler
|
||||
monodroid_SUBDIRS := $(monodroid_dirs)
|
||||
monotouch_SUBDIRS := $(monotouch_dirs)
|
||||
monotouch_runtime_SUBDIRS := $(monotouch_runtime_dirs)
|
||||
mobile_static_SUBDIRS := $(mobile_static_dirs)
|
||||
mobile_SUBDIRS := $(mobile_dynamic_dirs)
|
||||
xammac_SUBDIRS := $(xammac_dirs)
|
||||
net_3_5_SUBDIRS := $(xbuild_2_0_dirs)
|
||||
net_4_0_SUBDIRS := $(net_2_0_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(xbuild_4_0_dirs)
|
||||
net_4_5_SUBDIRS := $(net_2_0_dirs) $(net_4_0_dirs) $(net_4_5_dirs) $(xbuild_4_0_dirs) aot-compiler
|
||||
xbuild_12_SUBDIRS := $(xbuild_4_0_dirs)
|
||||
xbuild_14_SUBDIRS := $(xbuild_4_0_dirs)
|
||||
|
||||
include ../build/rules.make
|
||||
|
||||
|
||||
@@ -28,14 +28,9 @@
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
namespace System.Windows.Forms
|
||||
{
|
||||
/// <summary>
|
||||
/// http://msdn.microsoft.com/en-us/library/System.Windows.Forms.Help(v=vs.110).aspx
|
||||
/// </summary>
|
||||
public class Help
|
||||
{
|
||||
#region Constructor
|
||||
@@ -47,7 +42,7 @@ namespace System.Windows.Forms
|
||||
#region Public Static Methods
|
||||
public static void ShowHelp (Control parent, string url)
|
||||
{
|
||||
ShowHelp (parent, url, null);
|
||||
ShowHelp(parent, url, HelpNavigator.TableOfContents, null);
|
||||
}
|
||||
|
||||
public static void ShowHelp (Control parent, string url, HelpNavigator navigator)
|
||||
@@ -62,7 +57,9 @@ namespace System.Windows.Forms
|
||||
|
||||
public static void ShowHelp (Control parent, string url, string keyword)
|
||||
{
|
||||
ShowHelpTopic (url, keyword);
|
||||
if (keyword == null || keyword == String.Empty)
|
||||
ShowHelp (parent, url, HelpNavigator.TableOfContents, null);
|
||||
ShowHelp (parent, url, HelpNavigator.Topic, keyword);
|
||||
}
|
||||
|
||||
public static void ShowHelpIndex (Control parent, string url)
|
||||
@@ -75,55 +72,5 @@ namespace System.Windows.Forms
|
||||
{
|
||||
}
|
||||
#endregion // Public Static Methods
|
||||
|
||||
/// <summary>
|
||||
/// Show a help file and topic using a help viewer
|
||||
/// </summary>
|
||||
/// <param name="helpFile">path to a .chm help file</param>
|
||||
/// <param name="helpTopic">path to a topic in helpFile, or null</param>
|
||||
private static void ShowHelpTopic (string helpFile, string helpTopic)
|
||||
{
|
||||
if (helpFile == null)
|
||||
throw new ArgumentNullException ();
|
||||
if (helpFile == String.Empty)
|
||||
throw new ArgumentException ();
|
||||
|
||||
// Use forward slashes in helpFile path if needed
|
||||
helpFile = helpFile.Replace (@"\", Path.DirectorySeparatorChar.ToString ());
|
||||
|
||||
string helpViewer = Environment.GetEnvironmentVariable ("MONO_HELP_VIEWER") ?? "chmsee";
|
||||
string arguments = String.Format ("\"{0}\"", helpFile);
|
||||
if (!String.IsNullOrEmpty (helpTopic)) {
|
||||
if (!helpTopic.StartsWith ("/"))
|
||||
helpTopic = "/" + helpTopic;
|
||||
helpTopic = helpTopic.TrimEnd (' ');
|
||||
arguments = String.Format ("\"{0}::{1}\"", helpFile, helpTopic);
|
||||
}
|
||||
|
||||
try {
|
||||
RunNonblockingProcess (helpViewer, arguments);
|
||||
} catch (Exception e) {
|
||||
// Don't crash if the help viewer couldn't be launched. There
|
||||
// won't be an exception thrown if the help viewer can't find
|
||||
// the help file; it's up to the help viewer to display such an error.
|
||||
string message = String.Format ("The help viewer could not load. Maybe you don't have {0} installed or haven't set MONO_HELP_VIEWER. The specific error message was: {1}", helpViewer, e.Message);
|
||||
Console.Error.WriteLine (message);
|
||||
MessageBox.Show (message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// throws exception from Process.Start() if there was a problem starting
|
||||
/// </remarks>
|
||||
private static void RunNonblockingProcess (string command, string arguments)
|
||||
{
|
||||
using (Process process = new Process ()) {
|
||||
process.StartInfo.FileName = command;
|
||||
process.StartInfo.Arguments = arguments;
|
||||
process.StartInfo.UseShellExecute = false;
|
||||
|
||||
process.Start ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -492,6 +492,9 @@ namespace System.Windows.Forms
|
||||
r.X += 2;
|
||||
r.Width -= 2;
|
||||
}
|
||||
if ((flags & TextFormatFlags.WordEllipsis) == TextFormatFlags.WordEllipsis || (flags & TextFormatFlags.EndEllipsis) == TextFormatFlags.EndEllipsis || (flags & TextFormatFlags.WordBreak) == TextFormatFlags.WordBreak) {
|
||||
r.Width -= 4;
|
||||
}
|
||||
if ((flags & TextFormatFlags.VerticalCenter) == TextFormatFlags.VerticalCenter && XplatUI.RunningOnUnix) {
|
||||
r.Y -= 1;
|
||||
}
|
||||
|
||||
@@ -369,24 +369,22 @@ namespace System.Windows.Forms
|
||||
Image image = button.Image;
|
||||
string text = button.Text;
|
||||
Rectangle content_rect = button.PaddingClientRectangle;
|
||||
Size text_size = TextRenderer.MeasureTextInternal (g, text, button.Font, content_rect.Size, button.TextFormatFlags, button.UseCompatibleTextRendering);
|
||||
Size text_size = TextRenderer.MeasureTextInternal (g, text, button.Font, content_rect.Size, button.TextFormatFlags | TextFormatFlags.NoPadding, button.UseCompatibleTextRendering);
|
||||
Size image_size = image == null ? Size.Empty : image.Size;
|
||||
|
||||
textRectangle = Rectangle.Inflate (content_rect, -4, -4);
|
||||
imageRectangle = Rectangle.Empty;
|
||||
|
||||
bool displayEllipsis = (button.TextFormatFlags & (TextFormatFlags.EndEllipsis | TextFormatFlags.PathEllipsis | TextFormatFlags.WordEllipsis)) != 0;
|
||||
|
||||
switch (button.TextImageRelation) {
|
||||
case TextImageRelation.Overlay:
|
||||
// Overlay is easy, text always goes here
|
||||
|
||||
// Image is dependent on ImageAlign
|
||||
if (image == null) {
|
||||
if (button.Pressed)
|
||||
textRectangle.Offset (1, 1);
|
||||
|
||||
// Image is dependent on ImageAlign
|
||||
if (image == null)
|
||||
return;
|
||||
}
|
||||
|
||||
int image_x = 0;
|
||||
int image_y = 0;
|
||||
@@ -439,10 +437,10 @@ namespace System.Windows.Forms
|
||||
imageRectangle = new Rectangle (image_x, image_y, image_width, image_height);
|
||||
break;
|
||||
case TextImageRelation.ImageAboveText:
|
||||
LayoutTextAboveOrBelowImage (textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, displayEllipsis, out textRectangle, out imageRectangle);
|
||||
LayoutTextAboveOrBelowImage (textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
break;
|
||||
case TextImageRelation.TextAboveImage:
|
||||
LayoutTextAboveOrBelowImage (textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, displayEllipsis, out textRectangle, out imageRectangle);
|
||||
LayoutTextAboveOrBelowImage (textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
break;
|
||||
case TextImageRelation.ImageBeforeText:
|
||||
LayoutTextBeforeOrAfterImage (textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
@@ -451,8 +449,6 @@ namespace System.Windows.Forms
|
||||
LayoutTextBeforeOrAfterImage (textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
break;
|
||||
}
|
||||
if (button.Pressed)
|
||||
textRectangle.Offset (1, 1);
|
||||
}
|
||||
|
||||
private void LayoutTextBeforeOrAfterImage (Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, System.Drawing.ContentAlignment textAlign, System.Drawing.ContentAlignment imageAlign, out Rectangle textRect, out Rectangle imageRect)
|
||||
@@ -500,7 +496,7 @@ namespace System.Windows.Forms
|
||||
imageRect = final_image_rect;
|
||||
}
|
||||
|
||||
private void LayoutTextAboveOrBelowImage (Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, System.Drawing.ContentAlignment textAlign, System.Drawing.ContentAlignment imageAlign, bool displayEllipsis, out Rectangle textRect, out Rectangle imageRect)
|
||||
private void LayoutTextAboveOrBelowImage (Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, System.Drawing.ContentAlignment textAlign, System.Drawing.ContentAlignment imageAlign, out Rectangle textRect, out Rectangle imageRect)
|
||||
{
|
||||
int element_spacing = 0; // Spacing between the Text and the Image
|
||||
int total_height = textSize.Height + element_spacing + imageSize.Height;
|
||||
@@ -549,12 +545,6 @@ namespace System.Windows.Forms
|
||||
final_text_rect.Y = totalArea.Top;
|
||||
}
|
||||
|
||||
if (displayEllipsis) {
|
||||
// Don't use more space than is available otherwise ellipsis won't show
|
||||
if (final_text_rect.Height > totalArea.Bottom)
|
||||
final_text_rect.Height = totalArea.Bottom - final_text_rect.Top;
|
||||
}
|
||||
|
||||
textRect = final_text_rect;
|
||||
imageRect = final_image_rect;
|
||||
}
|
||||
@@ -1102,11 +1092,11 @@ namespace System.Windows.Forms
|
||||
break;
|
||||
case TextImageRelation.ImageAboveText:
|
||||
content_rect.Inflate (-4, -4);
|
||||
LayoutTextAboveOrBelowImage (content_rect, false, text_size, image_size, button.TextAlign, button.ImageAlign, false, out textRectangle, out imageRectangle);
|
||||
LayoutTextAboveOrBelowImage (content_rect, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
break;
|
||||
case TextImageRelation.TextAboveImage:
|
||||
content_rect.Inflate (-4, -4);
|
||||
LayoutTextAboveOrBelowImage (content_rect, true, text_size, image_size, button.TextAlign, button.ImageAlign, false, out textRectangle, out imageRectangle);
|
||||
LayoutTextAboveOrBelowImage (content_rect, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
break;
|
||||
case TextImageRelation.ImageBeforeText:
|
||||
content_rect.Inflate (-4, -4);
|
||||
|
||||
@@ -560,8 +560,11 @@ namespace Microsoft.Build.BuildEngine {
|
||||
get {
|
||||
// This is used as the fall back version if the
|
||||
// project can't find a version to use
|
||||
// Hard-coded to 2.0, so it allows even vs2005 projects
|
||||
// to build correctly, as they won't have a ToolsVersion
|
||||
// set!
|
||||
return String.IsNullOrEmpty (defaultToolsVersion)
|
||||
? "4.0"
|
||||
? "2.0"
|
||||
: defaultToolsVersion;
|
||||
}
|
||||
set {
|
||||
|
||||
@@ -39,9 +39,7 @@ public static class Consts {
|
||||
public static string BinPath {
|
||||
get {
|
||||
if (RunningOnMono ()) {
|
||||
#if XBUILD_14
|
||||
string profile = "xbuild_14";
|
||||
#elif XBUILD_12
|
||||
#if XBUILD_12
|
||||
string profile = "xbuild_12";
|
||||
#elif NET_4_5
|
||||
string profile = "net_4_5";
|
||||
@@ -56,9 +54,7 @@ public static class Consts {
|
||||
var lib = Path.GetDirectoryName (Path.GetDirectoryName (corlib));
|
||||
return Path.Combine (lib, profile);
|
||||
} else {
|
||||
#if XBUILD_14
|
||||
return ToolLocationHelper.GetPathToBuildTools ("14.0");
|
||||
#elif XBUILD_12
|
||||
#if XBUILD_12
|
||||
return ToolLocationHelper.GetPathToBuildTools ("12.0");
|
||||
#elif NET_4_5
|
||||
return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version45);
|
||||
@@ -75,9 +71,7 @@ public static class Consts {
|
||||
|
||||
public static string ToolsVersionString {
|
||||
get {
|
||||
#if XBUILD_14
|
||||
return " ToolsVersion='14.0'";
|
||||
#elif XBUILD_12
|
||||
#if XBUILD_12
|
||||
return " ToolsVersion='12.0'";
|
||||
#elif NET_4_0
|
||||
return " ToolsVersion='4.0'";
|
||||
@@ -91,9 +85,7 @@ public static class Consts {
|
||||
|
||||
public static string GetTasksAsmPath ()
|
||||
{
|
||||
#if XBUILD_14
|
||||
return Path.Combine (BinPath, "Microsoft.Build.Tasks.Core.dll");
|
||||
#elif XBUILD_12
|
||||
#if XBUILD_12
|
||||
return Path.Combine (BinPath, "Microsoft.Build.Tasks.v12.0.dll");
|
||||
#elif NET_4_0
|
||||
return Path.Combine (BinPath, "Microsoft.Build.Tasks.v4.0.dll");
|
||||
|
||||
+1
-6
@@ -53,13 +53,8 @@ namespace Microsoft.Build.Utilities
|
||||
#if XBUILD_12
|
||||
Version451,
|
||||
#endif
|
||||
#if XBUILD_14
|
||||
Version453,
|
||||
#endif
|
||||
|
||||
#if XBUILD_14
|
||||
VersionLatest = Version453
|
||||
#elif XBUILD_12
|
||||
#if XBUILD_12
|
||||
VersionLatest = Version451
|
||||
#elif NET_4_5
|
||||
VersionLatest = Version45
|
||||
|
||||
+2
-11
@@ -233,20 +233,11 @@ namespace Microsoft.Build.Utilities
|
||||
|
||||
public static string GetPathToBuildTools (string toolsVersion)
|
||||
{
|
||||
string path;
|
||||
switch (toolsVersion) {
|
||||
case "12.0":
|
||||
path = "xbuild_12";
|
||||
break;
|
||||
case "14.0":
|
||||
path = "xbuild_14";
|
||||
break;
|
||||
default:
|
||||
if (toolsVersion != "12.0")
|
||||
return null;
|
||||
}
|
||||
|
||||
if (Environment.GetEnvironmentVariable ("TESTING_MONO") != null)
|
||||
return Path.Combine (lib_mono_dir, path);
|
||||
return Path.Combine (lib_mono_dir, "xbuild_12");
|
||||
|
||||
if (runningOnDotNet) {
|
||||
//see http://msdn.microsoft.com/en-us/library/vstudio/bb397428(v=vs.120).aspx
|
||||
|
||||
@@ -263,9 +263,6 @@ namespace Microsoft.Build.Evaluation
|
||||
#endif
|
||||
#if XBUILD_12
|
||||
AddToolset (new Toolset ("12.0", ToolLocationHelper.GetPathToBuildTools ("12.0"), this, null));
|
||||
#endif
|
||||
#if XBUILD_14
|
||||
AddToolset (new Toolset ("14.0", ToolLocationHelper.GetPathToBuildTools ("14.0"), this, null));
|
||||
#endif
|
||||
default_tools_version = toolsets.First ().ToolsVersion;
|
||||
}
|
||||
|
||||
@@ -146,15 +146,6 @@ namespace MonoTests.EvaluatorTest
|
||||
Assert.IsTrue (Evaluator.Run ("x();"), "#2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CapturedLocalVariable ()
|
||||
{
|
||||
Evaluator.Run ("using System;");
|
||||
|
||||
var res = Evaluator.Evaluate("var x = 123; Action a = () => x++; a(); x;");
|
||||
Assert.AreEqual (124, res);
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Test]
|
||||
public void DynamicStatement ()
|
||||
|
||||
@@ -104,15 +104,7 @@ namespace MonoTests.EvaluatorTest
|
||||
{
|
||||
Evaluator.Run ("class A { class B { } }");
|
||||
Evaluator.Run ("var x = new A ();");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DelegateType ()
|
||||
{
|
||||
Evaluator.Run ("public delegate int D();");
|
||||
Evaluator.Run ("D d = delegate () { return 7; };");
|
||||
object res = Evaluator.Evaluate ("d();");
|
||||
Assert.AreEqual (7, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,4 +9,8 @@ LIB_MCS_FLAGS = /r:$(corlib) -keyfile:$(LIBRARY_SNK) -r:System.Core.dll -d:NET_3
|
||||
|
||||
NO_TEST = yes
|
||||
|
||||
ifneq (net_2_0, $(PROFILE))
|
||||
NO_INSTALL = yes
|
||||
endif
|
||||
|
||||
include ../../build/library.make
|
||||
@@ -195,11 +195,6 @@ namespace Mono.Unix.Native {
|
||||
return FromTimeT (time);
|
||||
}
|
||||
|
||||
public static DateTime ToDateTime (long time, long nanoTime)
|
||||
{
|
||||
return FromTimeT (time).AddMilliseconds (nanoTime / 1000);
|
||||
}
|
||||
|
||||
public static long FromDateTime (DateTime time)
|
||||
{
|
||||
return ToTimeT (time);
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace Mono.Unix {
|
||||
}
|
||||
|
||||
public DateTime LastAccessTime {
|
||||
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_atime, stat.st_atime_nsec);}
|
||||
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_atime);}
|
||||
}
|
||||
|
||||
public DateTime LastAccessTimeUtc {
|
||||
@@ -200,7 +200,7 @@ namespace Mono.Unix {
|
||||
}
|
||||
|
||||
public DateTime LastWriteTime {
|
||||
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_mtime, stat.st_mtime_nsec);}
|
||||
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_mtime);}
|
||||
}
|
||||
|
||||
public DateTime LastWriteTimeUtc {
|
||||
@@ -208,7 +208,7 @@ namespace Mono.Unix {
|
||||
}
|
||||
|
||||
public DateTime LastStatusChangeTime {
|
||||
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_ctime, stat.st_ctime_nsec);}
|
||||
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_ctime);}
|
||||
}
|
||||
|
||||
public DateTime LastStatusChangeTimeUtc {
|
||||
|
||||
@@ -669,14 +669,24 @@ namespace Mono.Security.Protocol.Tls
|
||||
|
||||
#region Send Alert Methods
|
||||
|
||||
internal void SendAlert(ref Exception ex)
|
||||
{
|
||||
var tlsEx = ex as TlsException;
|
||||
var alert = tlsEx != null ? tlsEx.Alert : new Alert(AlertDescription.InternalError);
|
||||
|
||||
try {
|
||||
SendAlert(alert);
|
||||
} catch (Exception alertEx) {
|
||||
ex = new IOException (string.Format ("Error while sending TLS Alert ({0}:{1}): {2}", alert.Level, alert.Description, ex), ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendAlert(AlertDescription description)
|
||||
{
|
||||
this.SendAlert(new Alert(description));
|
||||
}
|
||||
|
||||
public void SendAlert(
|
||||
AlertLevel level,
|
||||
AlertDescription description)
|
||||
public void SendAlert(AlertLevel level, AlertDescription description)
|
||||
{
|
||||
this.SendAlert(new Alert(level, description));
|
||||
}
|
||||
@@ -699,8 +709,13 @@ namespace Mono.Security.Protocol.Tls
|
||||
close = alert.IsCloseNotify;
|
||||
}
|
||||
|
||||
try {
|
||||
// Write record
|
||||
this.SendRecord (ContentType.Alert, new byte[2] { (byte) level, (byte) description });
|
||||
this.SendRecord (ContentType.Alert, new byte[2] { (byte) level, (byte) description });
|
||||
} catch (Exception ex) {
|
||||
throw new IOException (string.Format (
|
||||
"Exception while sending TLS Alert ({0}:{1})", level, description), ex);
|
||||
}
|
||||
|
||||
if (close) {
|
||||
this.context.SentConnectionEnd = true;
|
||||
|
||||
@@ -588,14 +588,34 @@ namespace Mono.Security.Protocol.Tls
|
||||
}
|
||||
catch (TlsException ex)
|
||||
{
|
||||
// FIXME: should the send alert also be done asynchronously here and below?
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
negotiate.SetComplete (new IOException("The authentication or decryption has failed.", ex));
|
||||
#if NET_4_0
|
||||
AggregateException aggregate;
|
||||
try {
|
||||
// FIXME: should the send alert also be done asynchronously here and below?
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
aggregate = new AggregateException ("The authentication or decryption has failed.", ex);
|
||||
} catch (Exception alertEx) {
|
||||
aggregate = new AggregateException ("The authentication or decryption has failed (error while sending Alert).", ex, alertEx);
|
||||
}
|
||||
#else
|
||||
var aggregate = new Exception ();
|
||||
#endif
|
||||
negotiate.SetComplete (aggregate);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.protocol.SendAlert(AlertDescription.InternalError);
|
||||
negotiate.SetComplete (new IOException("The authentication or decryption has failed.", ex));
|
||||
#if NET_4_0
|
||||
AggregateException aggregate;
|
||||
try {
|
||||
this.protocol.SendAlert(AlertDescription.InternalError);
|
||||
aggregate = new AggregateException ("The authentication or decryption has failed.", ex);
|
||||
} catch (Exception alertEx) {
|
||||
aggregate = new AggregateException ("The authentication or decryption has failed (error while sending Alert).", ex, alertEx);
|
||||
}
|
||||
#else
|
||||
var aggregate = new Exception ();
|
||||
#endif
|
||||
negotiate.SetComplete (aggregate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,16 +98,9 @@ namespace Mono.Security.Protocol.Tls
|
||||
{
|
||||
this.EndNegotiateHandshake(asyncResult);
|
||||
}
|
||||
catch (TlsException ex)
|
||||
{
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.protocol.SendAlert(AlertDescription.InternalError);
|
||||
|
||||
this.protocol.SendAlert(ref ex);
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
|
||||
@@ -502,17 +495,10 @@ namespace Mono.Security.Protocol.Tls
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (TlsException ex)
|
||||
{
|
||||
this.negotiationComplete.Set();
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.negotiationComplete.Set();
|
||||
this.protocol.SendAlert(AlertDescription.InternalError);
|
||||
this.protocol.SendAlert(ref ex);
|
||||
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
@@ -628,15 +614,10 @@ namespace Mono.Security.Protocol.Tls
|
||||
asyncResult.SetComplete(0);
|
||||
}
|
||||
}
|
||||
catch (TlsException ex)
|
||||
{
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new IOException("IO exception during read.", ex);
|
||||
this.protocol.SendAlert(ref ex);
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -781,17 +762,13 @@ namespace Mono.Security.Protocol.Tls
|
||||
record, 0, record.Length, new AsyncCallback(InternalWriteCallback), asyncResult);
|
||||
}
|
||||
}
|
||||
catch (TlsException ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
this.protocol.SendAlert (ref ex);
|
||||
this.Close();
|
||||
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new IOException("IO exception during Write.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void InternalWriteCallback(IAsyncResult ar)
|
||||
@@ -1121,15 +1098,11 @@ namespace Mono.Security.Protocol.Tls
|
||||
byte[] record = this.protocol.EncodeRecord (ContentType.ApplicationData, buffer, offset, count);
|
||||
this.innerStream.Write (record, 0, record.Length);
|
||||
}
|
||||
catch (TlsException ex)
|
||||
{
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
this.Close();
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new IOException("IO exception during Write.", ex);
|
||||
this.protocol.SendAlert(ref ex);
|
||||
this.Close();
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ NO_TEST = yes
|
||||
|
||||
|
||||
# This is a .NET 2.0+ only assembly
|
||||
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-Mono.Simd.dll
|
||||
NO_INSTALL = yes
|
||||
|
||||
@@ -72,22 +72,3 @@ csproj-local:
|
||||
$(MAKE) csproj-local intermediate=plaincore/
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# Android TimeZoneInfo testing....
|
||||
#
|
||||
|
||||
tzi.exe: ../corlib/System/AndroidPlatform.cs $(wildcard System/TimeZone*.cs) ../../build/common/Consts.cs ../Mono.Options/Mono.Options/Options.cs
|
||||
mcs /debug+ /out:$@ /unsafe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" $^
|
||||
|
||||
android-pull-tzdb:
|
||||
mkdir -p android/tzdb/usr/share/zoneinfo
|
||||
mkdir -p android/tzdb/misc/zoneinfo/zoneinfo
|
||||
android_root=`adb shell echo '$$ANDROID_ROOT' | tr -d "\r"` ; \
|
||||
android_data=`adb shell echo '$$ANDROID_DATA' | tr -d "\r"` ; \
|
||||
adb $(ADB_TARGET) pull $$android_root/usr/share/zoneinfo android/tzdb/usr/share/zoneinfo ; \
|
||||
adb $(ADB_TARGET) pull $$android_data/misc/zoneinfo/tzdata android/tzdb/misc/zoneinfo
|
||||
mkdir -p android/tzdb/
|
||||
|
||||
android-dump-tzdata: tzi.exe android-pull-tzdb
|
||||
__XA_OVERRIDE_TIMEZONE_ID__=America/New_York ANDROID_ROOT=`pwd` ANDROID_DATA=`pwd` mono --debug tzi.exe -o android/tzdata
|
||||
@@ -246,7 +246,6 @@ namespace System {
|
||||
tzdataPath, offset, length, r, buffer.Length));
|
||||
}
|
||||
|
||||
TimeZoneInfo.DumpTimeZoneDataToFile (id, buffer);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
@@ -539,7 +538,8 @@ namespace System {
|
||||
lock (_lock) {
|
||||
if (defaultZone != null)
|
||||
return defaultZone;
|
||||
return defaultZone = GetTimeZone ("Local", GetDefaultTimeZoneName ());
|
||||
var id = GetDefaultTimeZoneName ();
|
||||
return defaultZone = GetTimeZone (id, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -582,37 +582,21 @@ namespace System {
|
||||
* Compile:
|
||||
* mcs /debug+ /out:tzi.exe /unsafe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" ../corlib/System/AndroidPlatform.cs System/TimeZone*.cs ../../build/common/Consts.cs ../Mono.Options/Mono.Options/Options.cs
|
||||
* Prep:
|
||||
* mkdir -p android/tzdb/usr/share/zoneinfo
|
||||
* mkdir -p android/tzdb/misc/zoneinfo/zoneinfo
|
||||
* mkdir -p usr/share/zoneinfo
|
||||
* mkdir -p misc/zoneinfo/zoneinfo
|
||||
* android_root=`adb shell echo '$ANDROID_ROOT' | tr -d "\r"`
|
||||
* android_data=`adb shell echo '$ANDROID_DATA' | tr -d "\r"`
|
||||
* adb pull $android_root/usr/share/zoneinfo android/tzdb/usr/share/zoneinfo
|
||||
* adb pull $android_data/misc/zoneinfo/tzdata android/tzdb/misc/zoneinfo
|
||||
* adb pull $android_root/usr/share/zoneinfo usr/share/zoneinfo
|
||||
* adb pull $android_data/misc/zoneinfo/tzdata misc/zoneinfo
|
||||
* Run:
|
||||
* # Dump all timezone names
|
||||
* __XA_OVERRIDE_TIMEZONE_ID__=America/New_York ANDROID_ROOT=`pwd` ANDROID_DATA=`pwd` mono --debug tzi.exe --offset=1969-01-01
|
||||
*
|
||||
* # Dump TimeZone data to files under path `tzdata`
|
||||
* __XA_OVERRIDE_TIMEZONE_ID__=America/New_York ANDROID_ROOT=`pwd` ANDROID_DATA=`pwd` mono --debug tzi.exe -o android/tzdata
|
||||
*
|
||||
* # Dump TimeZone rules for specific timezone data (as dumped above)
|
||||
* mono tzi.exe --offset=2012-10-24 -i=tzdata/Asia/Amman
|
||||
*/
|
||||
static void Main (string[] args)
|
||||
{
|
||||
DateTime? offset = null;
|
||||
Func<IAndroidTimeZoneDB> c = () => GetDefaultTimeZoneDB ();
|
||||
bool dump_rules = false;
|
||||
Mono.Options.OptionSet p = null;
|
||||
p = new Mono.Options.OptionSet () {
|
||||
{ "i=",
|
||||
"TimeZone data {FILE} to parse and dump",
|
||||
v => DumpTimeZoneFile (v, offset)
|
||||
},
|
||||
{ "o=",
|
||||
"Write TimeZone data files to {PATH}",
|
||||
v => TimeZoneInfo.TimeZoneDataExportPath = v
|
||||
},
|
||||
{ "T=", "Create AndroidTzData from {PATH}.", v => {
|
||||
c = () => new AndroidTzData (v);
|
||||
} },
|
||||
@@ -623,9 +607,6 @@ namespace System {
|
||||
offset = DateTime.Parse (v);
|
||||
Console.WriteLine ("Using DateTime Offset: {0}", offset);
|
||||
} },
|
||||
{ "R|dump-rules",
|
||||
"Show timezone info offset for DateTime {OFFSET}.",
|
||||
v => dump_rules = v != null },
|
||||
{ "help", "Show this message and exit", v => {
|
||||
p.WriteOptionDescriptions (Console.Out);
|
||||
Environment.Exit (0);
|
||||
@@ -643,9 +624,6 @@ namespace System {
|
||||
if (offset.HasValue) {
|
||||
Console.Write ("From Offset: {0}", zone.GetUtcOffset (offset.Value));
|
||||
}
|
||||
if (dump_rules) {
|
||||
WriteZoneRules (zone);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Console.Write (" ERROR:null");
|
||||
@@ -657,53 +635,6 @@ namespace System {
|
||||
Console.WriteLine ();
|
||||
}
|
||||
}
|
||||
|
||||
static void WriteZoneRules (TimeZoneInfo zone)
|
||||
{
|
||||
var rules = zone.GetAdjustmentRules ();
|
||||
for (int i = 0; i < rules.Length; ++i) {
|
||||
var rule = rules [i];
|
||||
Console.WriteLine ();
|
||||
Console.Write ("\tAdjustmentRules[{0,3}]: DaylightDelta={1}; DateStart={2:yyyy-MM}; DateEnd={3:yyyy-MM}; DaylightTransitionStart={4:D2}-{5:D2}T{6}; DaylightTransitionEnd={7:D2}-{8:D2}T{9}",
|
||||
i,
|
||||
rule.DaylightDelta,
|
||||
rule.DateStart, rule.DateEnd,
|
||||
rule.DaylightTransitionStart.Month, rule.DaylightTransitionStart.Day, rule.DaylightTransitionStart.TimeOfDay.TimeOfDay,
|
||||
rule.DaylightTransitionEnd.Month, rule.DaylightTransitionEnd.Day, rule.DaylightTransitionEnd.TimeOfDay.TimeOfDay);
|
||||
}
|
||||
}
|
||||
|
||||
static void DumpTimeZoneFile (string path, DateTime? time)
|
||||
{
|
||||
var buffer = File.ReadAllBytes (path);
|
||||
var zone = ParseTZBuffer (path, buffer, buffer.Length);
|
||||
Console.Write ("Rules for: {0}", path);
|
||||
WriteZoneRules (zone);
|
||||
Console.WriteLine ();
|
||||
if (time.HasValue) {
|
||||
var offset = zone.GetUtcOffset (time.Value);
|
||||
var isDst = zone.IsDaylightSavingTime (time.Value);
|
||||
Console.WriteLine ("\tDate({0}): Offset({1}) IsDST({2})", time.Value, offset, isDst);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if SELF_TEST
|
||||
static string TimeZoneDataExportPath;
|
||||
#endif
|
||||
|
||||
internal static void DumpTimeZoneDataToFile (string id, byte[] buffer)
|
||||
{
|
||||
#if SELF_TEST
|
||||
int p = id.LastIndexOf ('/');
|
||||
var o = Path.Combine (TimeZoneDataExportPath,
|
||||
p >= 0 ? id.Substring (0, p) : id);
|
||||
if (p >= 0)
|
||||
o = Path.Combine (o, id.Substring (p+1));
|
||||
Directory.CreateDirectory (Path.GetDirectoryName (o));
|
||||
using (var f = File.OpenWrite (o))
|
||||
f.Write (buffer, 0, buffer.Length);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,12 +426,6 @@ namespace System
|
||||
return FromRegistryKey(id, key);
|
||||
}
|
||||
#endif
|
||||
#if MONODROID
|
||||
var timeZoneInfo = AndroidTimeZones.GetTimeZone (id, id);
|
||||
if (timeZoneInfo == null)
|
||||
throw new TimeZoneNotFoundException ();
|
||||
return timeZoneInfo;
|
||||
#else
|
||||
// Local requires special logic that already exists in the Local property (bug #326)
|
||||
if (id == "Local")
|
||||
return Local;
|
||||
@@ -439,12 +433,16 @@ namespace System
|
||||
using (Stream stream = GetMonoTouchData (id)) {
|
||||
return BuildFromStream (id, stream);
|
||||
}
|
||||
#elif MONODROID
|
||||
var timeZoneInfo = AndroidTimeZones.GetTimeZone (id, id);
|
||||
if (timeZoneInfo == null)
|
||||
throw new TimeZoneNotFoundException ();
|
||||
return timeZoneInfo;
|
||||
#elif LIBC
|
||||
string filepath = Path.Combine (TimeZoneDirectory, id);
|
||||
return FindSystemTimeZoneByFileName (id, filepath);
|
||||
#else
|
||||
throw new NotImplementedException ();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1179,9 +1177,9 @@ namespace System
|
||||
DateTime ttime = pair.Key;
|
||||
TimeType ttype = pair.Value;
|
||||
if (!ttype.IsDst) {
|
||||
if (standardDisplayName != ttype.Name)
|
||||
if (standardDisplayName != ttype.Name || baseUtcOffset.TotalSeconds != ttype.Offset) {
|
||||
standardDisplayName = ttype.Name;
|
||||
if (baseUtcOffset.TotalSeconds != ttype.Offset) {
|
||||
daylightDisplayName = null;
|
||||
baseUtcOffset = new TimeSpan (0, 0, ttype.Offset);
|
||||
if (adjustmentRules.Count > 0) // We ignore AdjustmentRules but store transitions.
|
||||
storeTransition = true;
|
||||
@@ -1217,11 +1215,10 @@ namespace System
|
||||
}
|
||||
dst_observed = false;
|
||||
} else {
|
||||
if (daylightDisplayName != ttype.Name)
|
||||
if (daylightDisplayName != ttype.Name || dstDelta.TotalSeconds != ttype.Offset - baseUtcOffset.TotalSeconds) {
|
||||
daylightDisplayName = ttype.Name;
|
||||
if (dstDelta.TotalSeconds != ttype.Offset - baseUtcOffset.TotalSeconds)
|
||||
dstDelta = new TimeSpan(0, 0, ttype.Offset) - baseUtcOffset;
|
||||
|
||||
}
|
||||
dst_start = ttime;
|
||||
dst_observed = true;
|
||||
}
|
||||
|
||||
@@ -401,9 +401,14 @@ namespace MonoTests.System.Threading
|
||||
{
|
||||
var v = new ReaderWriterLockSlim ();
|
||||
int local = 10;
|
||||
int ready_count = 0;
|
||||
int entered_count = 0;
|
||||
const int thread_count = 10;
|
||||
|
||||
var r = from i in Enumerable.Range (1, 10) select new Thread (() => {
|
||||
var r = from i in Enumerable.Range (1, thread_count) select new Thread (() => {
|
||||
Interlocked.Increment (ref ready_count);
|
||||
v.EnterReadLock ();
|
||||
Interlocked.Increment (ref entered_count);
|
||||
|
||||
Assert.AreEqual (11, local);
|
||||
});
|
||||
@@ -415,12 +420,16 @@ namespace MonoTests.System.Threading
|
||||
t.Start ();
|
||||
}
|
||||
|
||||
Thread.Sleep (200);
|
||||
while (ready_count != thread_count)
|
||||
Thread.Sleep (10);
|
||||
|
||||
/* Extra up to 2s of sleep to ensure all threads got the chance to enter the lock */
|
||||
for (int i = 0; i < 200 && v.WaitingReadCount != thread_count; ++i)
|
||||
Thread.Sleep (10);
|
||||
local = 11;
|
||||
|
||||
// FIXME: Don't rely on Thread.Sleep (200)
|
||||
Assert.AreEqual (0, v.WaitingWriteCount, "in waiting write");
|
||||
Assert.AreEqual (10, v.WaitingReadCount, "in waiting read");
|
||||
Assert.AreEqual (thread_count, v.WaitingReadCount, "in waiting read");
|
||||
Assert.AreEqual (0, v.WaitingUpgradeCount, "in waiting upgrade");
|
||||
v.ExitWriteLock ();
|
||||
|
||||
|
||||
@@ -12,12 +12,17 @@ LIB_MCS_FLAGS = \
|
||||
/resource:./src/DbLinq/Schema/Dbml/DbmlSchema.xsd,DbLinq.Schema.Dbml.DbmlSchema.xsd \
|
||||
/d:MONO_STRICT /d:MONO_DEPLOY -warn:1
|
||||
|
||||
ifeq (2.0, $(FRAMEWORK_VERSION))
|
||||
# This is a .NET 3.5 only assembly, but built during the 2.0 build
|
||||
LIB_MCS_FLAGS += -d:NET_3_5 -nowarn:1720
|
||||
endif
|
||||
|
||||
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
|
||||
|
||||
EXTRA_DISTFILES = src/DbLinq/Schema/Dbml/DbmlSchema.xsd
|
||||
|
||||
# This is a .NET 3.5+ assembly
|
||||
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-System.Data.Linq.dll
|
||||
NO_INSTALL = yes
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace System.Data.Common {
|
||||
readonly IDataReader reader;
|
||||
readonly bool closeReader;
|
||||
readonly SchemaInfo [] schema;
|
||||
readonly object [] values;
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
@@ -58,7 +57,6 @@ namespace System.Data.Common {
|
||||
{
|
||||
this.reader = reader;
|
||||
this.closeReader = closeReader;
|
||||
this.values = new object [reader.FieldCount];
|
||||
this.schema = LoadSchema (reader);
|
||||
}
|
||||
|
||||
@@ -67,8 +65,13 @@ namespace System.Data.Common {
|
||||
#region Properties
|
||||
|
||||
public object Current {
|
||||
get {
|
||||
get {
|
||||
// DbDataRecordImpl does not do copy of the array
|
||||
// and MoveNext would overwrite any previously filled data
|
||||
var values = new object [reader.FieldCount];
|
||||
reader.GetValues (values);
|
||||
|
||||
// TODO: Should not allocate on every property call
|
||||
return new DbDataRecordImpl (schema, values);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
|
||||
|
||||
EXTRA_DISTFILES =
|
||||
|
||||
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-System.IdentityModel.Selectors.dll
|
||||
NO_INSTALL = yes
|
||||
|
||||
@@ -26,7 +26,7 @@ EXTRA_DISTFILES = \
|
||||
Test/Resources/test.pfx \
|
||||
Test/Resources/test2.pfx
|
||||
|
||||
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-System.IdentityModel.dll
|
||||
NO_INSTALL = yes
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
<Compile Include="Assembly\AssemblyInfo.cs" />
|
||||
<Compile Include="System.IdentityModel\CookieTransform.cs" />
|
||||
<Compile Include="System.IdentityModel\OpenObject.cs" />
|
||||
<Compile Include="System.IdentityModel\SignatureVerificationFailedException.cs" />
|
||||
<Compile Include="System.IdentityModel.Claims\Claim.cs" />
|
||||
<Compile Include="System.IdentityModel.Claims\ClaimSet.cs" />
|
||||
<Compile Include="System.IdentityModel.Claims\ClaimTypes.cs" />
|
||||
@@ -148,12 +147,9 @@
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityToken.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenDescriptor.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenException.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenExpiredException.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenHandler.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenHandler.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenHandlerCollection.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenHandlerConfiguration.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenNotYetValidException.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenReplayDetectedException.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenTypes.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenValidationException.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SessionSecurityToken.cs" />
|
||||
@@ -174,8 +170,7 @@
|
||||
<Compile Include="System.IdentityModel.Tokens\X509SubjectKeyIdentifierClause.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\X509ThumbprintKeyIdentifierClause.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\X509WindowsSecurityToken.cs" />
|
||||
<Compile Include="System.Security.Claims\AuthenticationTypes.cs" />
|
||||
<Compile Include="System.ServiceModel.Security\X509CertificateValidationMode.cs" />
|
||||
<Compile Include="System.Security.Claims\AuthenticationTypes.cs" />␍ <Compile Include="System.ServiceModel.Security\X509CertificateValidationMode.cs" />
|
||||
</ItemGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
@@ -185,18 +180,18 @@
|
||||
</Target>
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
|
||||
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
|
||||
|
||||
</PreBuildEvent>
|
||||
|
||||
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
|
||||
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
|
||||
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
|
||||
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
|
||||
|
||||
</PreBuildEvent>
|
||||
|
||||
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
|
||||
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
|
||||
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
@@ -241,4 +236,4 @@
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
//
|
||||
// SecurityTokenExpiredException.cs
|
||||
//
|
||||
// Author:
|
||||
// Noesis Labs ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.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_4_5
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IdentityModel.Tokens
|
||||
{
|
||||
public class SecurityTokenExpiredException : SecurityTokenValidationException
|
||||
{
|
||||
public SecurityTokenExpiredException()
|
||||
: base("ID4181: The security token has expired.")
|
||||
{ }
|
||||
|
||||
public SecurityTokenExpiredException(string message)
|
||||
: base(message)
|
||||
{ }
|
||||
|
||||
public SecurityTokenExpiredException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{ }
|
||||
|
||||
public SecurityTokenExpiredException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
#endif
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
//
|
||||
// SecurityTokenNotYetValidException.cs
|
||||
//
|
||||
// Author:
|
||||
// Noesis Labs ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.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_4_5
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IdentityModel.Tokens
|
||||
{
|
||||
public class SecurityTokenNotYetValidException : SecurityTokenValidationException
|
||||
{
|
||||
public SecurityTokenNotYetValidException()
|
||||
: base("ID4182: The security token is not valid yet.")
|
||||
{ }
|
||||
|
||||
public SecurityTokenNotYetValidException(string message)
|
||||
: base(message)
|
||||
{ }
|
||||
|
||||
public SecurityTokenNotYetValidException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{ }
|
||||
|
||||
public SecurityTokenNotYetValidException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
#endif
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
//
|
||||
// SecurityTokenReplayDetectedException.cs
|
||||
//
|
||||
// Author:
|
||||
// Noesis Labs ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.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_4_5
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IdentityModel.Tokens
|
||||
{
|
||||
public class SecurityTokenReplayDetectedException : SecurityTokenValidationException
|
||||
{
|
||||
public SecurityTokenReplayDetectedException()
|
||||
: base("ID1070: Replay has been detected for a SecurityToken.")
|
||||
{ }
|
||||
|
||||
public SecurityTokenReplayDetectedException(string message)
|
||||
: base(message)
|
||||
{ }
|
||||
|
||||
public SecurityTokenReplayDetectedException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{ }
|
||||
|
||||
public SecurityTokenReplayDetectedException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -3,7 +3,6 @@
|
||||
Assembly/AssemblyInfo.cs
|
||||
System.IdentityModel/CookieTransform.cs
|
||||
System.IdentityModel/OpenObject.cs
|
||||
System.IdentityModel/SignatureVerificationFailedException.cs
|
||||
System.IdentityModel.Claims/Claim.cs
|
||||
System.IdentityModel.Claims/ClaimSet.cs
|
||||
System.IdentityModel.Claims/ClaimTypes.cs
|
||||
@@ -101,12 +100,9 @@ System.IdentityModel.Tokens/SecurityKeyUsage.cs
|
||||
System.IdentityModel.Tokens/SecurityToken.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenDescriptor.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenException.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenExpiredException.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenHandler.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenHandlerCollection.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenHandlerConfiguration.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenNotYetValidException.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenReplayDetectedException.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenTypes.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenValidationException.cs
|
||||
System.IdentityModel.Tokens/SessionSecurityToken.cs
|
||||
@@ -128,4 +124,4 @@ System.IdentityModel.Tokens/X509SubjectKeyIdentifierClause.cs
|
||||
System.IdentityModel.Tokens/X509ThumbprintKeyIdentifierClause.cs
|
||||
System.IdentityModel.Tokens/X509WindowsSecurityToken.cs
|
||||
System.Security.Claims/AuthenticationTypes.cs
|
||||
System.ServiceModel.Security/X509CertificateValidationMode.cs
|
||||
System.ServiceModel.Security/X509CertificateValidationMode.cs
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
//
|
||||
// SignatureVerificationFailedException.cs
|
||||
//
|
||||
// Author:
|
||||
// Noesis Labs ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.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_4_5
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IdentityModel
|
||||
{
|
||||
public class SignatureVerificationFailedException : Exception
|
||||
{
|
||||
public SignatureVerificationFailedException()
|
||||
: base("ID4038: Signature verification failed.")
|
||||
{ }
|
||||
|
||||
public SignatureVerificationFailedException(string message)
|
||||
: base(message)
|
||||
{ }
|
||||
|
||||
public SignatureVerificationFailedException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{ }
|
||||
|
||||
public SignatureVerificationFailedException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -257,6 +257,11 @@ namespace System.Net.Http.Headers
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Lexer.IsValidCharacter (ch) || ch == '*' || ch == '?' || ch == '%') {
|
||||
sb.Append (Uri.HexEscape (ch));
|
||||
continue;
|
||||
}
|
||||
|
||||
sb.Append (ch);
|
||||
}
|
||||
|
||||
|
||||
@@ -193,13 +193,18 @@ namespace System.Net.Http.Headers
|
||||
//
|
||||
for (; i < input.Length; ++i) {
|
||||
char s = input[i];
|
||||
if (s > last_token_char || !token_chars[s])
|
||||
if (!IsValidCharacter (s))
|
||||
return false;
|
||||
}
|
||||
|
||||
return i > 0;
|
||||
}
|
||||
|
||||
public static bool IsValidCharacter (char input)
|
||||
{
|
||||
return input <= last_token_char && token_chars[input];
|
||||
}
|
||||
|
||||
public void EatChar ()
|
||||
{
|
||||
++pos;
|
||||
|
||||
+4
-1
@@ -237,8 +237,11 @@ namespace MonoTests.System.Net.Http.Headers
|
||||
value.FileNameStar = "č";
|
||||
Assert.AreEqual ("č", value.FileNameStar, "#11");
|
||||
Assert.AreEqual (new NameValueHeaderValue ("filename*", "utf-8''%C4%8D"), value.Parameters.First (), "#12");
|
||||
}
|
||||
|
||||
value.FileNameStar = "@x*\\%?.txt";
|
||||
Assert.AreEqual ("@x*\\%?.txt", value.FileNameStar, "#21");
|
||||
Assert.AreEqual (new NameValueHeaderValue ("filename*", "utf-8''%40x%2A%5C%25%3F.txt"), value.Parameters.First (), "#22");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Properties_Name ()
|
||||
|
||||
@@ -12,7 +12,7 @@ LOCAL_MCS_FLAGS = -lib:$(secxml_libdir) -lib:$(bare_libdir)
|
||||
|
||||
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:168,169,183,219,414,1595
|
||||
|
||||
VALID_PROFILE := $(filter moonlight_raw net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_1_1 net_2_0 moonlight_raw net_4_0 net_4_5, $(PROFILE))
|
||||
|
||||
EXTRA_DISTFILES = \
|
||||
Test/System.Security.Cryptography.Xml/sample.pfx \
|
||||
|
||||
@@ -637,7 +637,7 @@ namespace Mono.Xml {
|
||||
else if (n2 == null)
|
||||
return 1;
|
||||
else if (n1.Prefix == n2.Prefix)
|
||||
return string.CompareOrdinal (n1.LocalName, n2.LocalName);
|
||||
return string.Compare (n1.LocalName, n2.LocalName);
|
||||
|
||||
// Attributes in the default namespace are first
|
||||
// because the default namespace is not applied to
|
||||
|
||||
@@ -213,87 +213,6 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
Assert.IsTrue (vrfy.CheckSignature (), "RSA-Compute/Verify");
|
||||
}
|
||||
|
||||
// The same as MSDNSample(), but adding a few attributes
|
||||
public SignedXml MSDNSampleMixedCaseAttributes ()
|
||||
{
|
||||
// Create example data to sign.
|
||||
XmlDocument document = new XmlDocument ();
|
||||
XmlNode node = document.CreateNode (XmlNodeType.Element, "", "MyElement", "samples");
|
||||
node.InnerText = "This is some text";
|
||||
XmlAttribute a1 = document.CreateAttribute ("Aa");
|
||||
XmlAttribute a2 = document.CreateAttribute ("Bb");
|
||||
XmlAttribute a3 = document.CreateAttribute ("aa");
|
||||
XmlAttribute a4 = document.CreateAttribute ("bb");
|
||||
a1.Value = "one";
|
||||
a2.Value = "two";
|
||||
a3.Value = "three";
|
||||
a4.Value = "four";
|
||||
node.Attributes.Append (a1);
|
||||
node.Attributes.Append (a2);
|
||||
node.Attributes.Append (a3);
|
||||
node.Attributes.Append (a4);
|
||||
document.AppendChild (node);
|
||||
|
||||
// Create the SignedXml message.
|
||||
SignedXml signedXml = new SignedXml ();
|
||||
|
||||
// Create a data object to hold the data to sign.
|
||||
DataObject dataObject = new DataObject ();
|
||||
dataObject.Data = document.ChildNodes;
|
||||
dataObject.Id = "MyObjectId";
|
||||
|
||||
// Add the data object to the signature.
|
||||
signedXml.AddObject (dataObject);
|
||||
|
||||
// Create a reference to be able to package everything into the
|
||||
// message.
|
||||
Reference reference = new Reference ();
|
||||
reference.Uri = "#MyObjectId";
|
||||
|
||||
// Add it to the message.
|
||||
signedXml.AddReference (reference);
|
||||
|
||||
return signedXml;
|
||||
}
|
||||
|
||||
public string AsymmetricRSAMixedCaseAttributes ()
|
||||
{
|
||||
SignedXml signedXml = MSDNSampleMixedCaseAttributes ();
|
||||
|
||||
RSA key = RSA.Create ();
|
||||
signedXml.SigningKey = key;
|
||||
|
||||
// Add a KeyInfo.
|
||||
KeyInfo keyInfo = new KeyInfo ();
|
||||
keyInfo.AddClause (new RSAKeyValue (key));
|
||||
signedXml.KeyInfo = keyInfo;
|
||||
|
||||
// Compute the signature.
|
||||
signedXml.ComputeSignature ();
|
||||
|
||||
// Get the XML representation of the signature.
|
||||
XmlElement xmlSignature = signedXml.GetXml ();
|
||||
|
||||
StringWriter sw = new StringWriter ();
|
||||
XmlWriter w = new XmlTextWriter (sw);
|
||||
xmlSignature.WriteTo (w);
|
||||
return sw.ToString ();
|
||||
}
|
||||
|
||||
// Example output from Windows for AsymmetricRSAMixedCaseAttributes()
|
||||
private const string AsymmetricRSAMixedCaseAttributesResult = "<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" /><Reference URI=\"#MyObjectId\"><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>0j1xLsePFtuRHfXEnVdTSLWtAm4=</DigestValue></Reference></SignedInfo><SignatureValue>hmrEBgns5Xx14aDhzqOyIh0qLNMUldtW8+fNPcvtD/2KtEhNZQGctnhs90CRa1NZ08TqzW2pUaEwmqvMAtF4v8KtWzC/zTuc1jH6nxQvQSQo0ABhuXdu7/hknZkXJ4yKBbdgbKjAsKfULwbWrP/PacLPoYfCO+wXSrt+wLMTTWU=</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>4h/rHDr54r6SZWk2IPCeHX7N+wR1za0VBLshuS6tq3RSWap4PY2BM8VdbKH2T9RzyZoiHufjng+1seUx430iMsXisOLUkPP+yGtMQOSZ3CQHAa+IYA+fplXipixI0rV1J1wJNXQm3HxXQqKWpIv5fkwBtj8o2k6CWMgPNgFCnxc=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue></KeyInfo><Object Id=\"MyObjectId\"><MyElement Aa=\"one\" Bb=\"two\" aa=\"three\" bb=\"four\" xmlns=\"samples\">This is some text</MyElement></Object></Signature>";
|
||||
|
||||
[Test]
|
||||
public void AsymmetricRSAMixedCaseAttributesVerifyWindows ()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (AsymmetricRSAMixedCaseAttributesResult);
|
||||
|
||||
SignedXml v1 = new SignedXml ();
|
||||
v1.LoadXml (doc.DocumentElement);
|
||||
Assert.IsTrue (v1.CheckSignature ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AsymmetricDSASignature ()
|
||||
{
|
||||
|
||||
-13
@@ -494,19 +494,6 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
Assert.AreEqual (new StreamReader (s, Encoding.UTF8).ReadToEnd (), expected);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OrdinalSortForAttributes ()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
string xml = "<foo Aa=\"one\" Bb=\"two\" aa=\"three\" bb=\"four\"><bar></bar></foo>";
|
||||
doc.LoadXml (xml);
|
||||
|
||||
transform.LoadInput (doc);
|
||||
Stream s = (Stream) transform.GetOutput ();
|
||||
string output = Stream2String (s);
|
||||
Assert.AreEqual (xml, output);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
[Test]
|
||||
public void PrefixlessNamespaceOutput ()
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace MonoTests.System.ServiceModel.Dispatcher
|
||||
};
|
||||
|
||||
client.GetDataAsync ();
|
||||
if (!wait.WaitOne (TimeSpan.FromSeconds (20)))
|
||||
if (!wait.WaitOne (TimeSpan.FromSeconds (10)))
|
||||
Assert.Fail ("timeout");
|
||||
} finally {
|
||||
serviceHost.Close ();
|
||||
|
||||
@@ -8,12 +8,17 @@ LIB_MCS_FLAGS = \
|
||||
/r:System.Core.dll \
|
||||
/r:System.Web.dll
|
||||
|
||||
ifeq (2.0, $(FRAMEWORK_VERSION))
|
||||
# This is a .NET 3.5 only assembly, but built during the 2.0 build
|
||||
LIB_MCS_FLAGS += -d:NET_3_5
|
||||
endif
|
||||
|
||||
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
|
||||
|
||||
EXTRA_DISTFILES =
|
||||
|
||||
# This is a .NET 3.5+ assembly
|
||||
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-System.Web.Abstractions.dll
|
||||
NO_INSTALL = yes
|
||||
|
||||
@@ -183,9 +183,10 @@ namespace System.Web
|
||||
return w.GetSection (sectionName);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override object GetService (Type serviceType)
|
||||
{
|
||||
return ((IServiceProvider)w).GetService (serviceType);
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#if NET_4_0
|
||||
public override void RemapHandler (IHttpHandler handler)
|
||||
|
||||
@@ -138,10 +138,7 @@ namespace System.Web
|
||||
|
||||
#if NET_4_5
|
||||
public virtual ReadEntityBodyMode ReadEntityBodyMode { get { NotImplemented(); return ReadEntityBodyMode.Classic; } }
|
||||
|
||||
public virtual UnvalidatedRequestValuesBase Unvalidated { get { NotImplemented (); return null; } }
|
||||
#endif
|
||||
|
||||
public virtual Uri Url { get { NotImplemented (); return null; } }
|
||||
|
||||
public virtual Uri UrlReferrer { get { NotImplemented (); return null; } }
|
||||
|
||||
@@ -208,18 +208,6 @@ namespace System.Web
|
||||
get { return w.TotalBytes; }
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
public override UnvalidatedRequestValuesBase Unvalidated {
|
||||
get { return new UnvalidatedRequestValuesWrapper (w.Unvalidated); }
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET_4_5
|
||||
public override ReadEntityBodyMode ReadEntityBodyMode {
|
||||
get { return ReadEntityBodyMode.Classic; }
|
||||
}
|
||||
#endif
|
||||
|
||||
public override Uri Url {
|
||||
get { return w.Url; }
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Web.Caching;
|
||||
using System.Threading;
|
||||
|
||||
#if NET_4_0
|
||||
using System.Web.Routing;
|
||||
@@ -70,10 +69,6 @@ namespace System.Web
|
||||
|
||||
public virtual string Charset { get { NotImplemented (); return null; } set { NotImplemented (); } }
|
||||
|
||||
#if NET_4_5
|
||||
public virtual CancellationToken ClientDisconnectedToken { get { NotImplemented (); return CancellationToken.None; } }
|
||||
#endif
|
||||
|
||||
public virtual Encoding ContentEncoding { get { NotImplemented (); return null; } set { NotImplemented (); } }
|
||||
|
||||
public virtual string ContentType { get { NotImplemented (); return null; } set { NotImplemented (); } }
|
||||
|
||||
@@ -39,7 +39,6 @@ using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Web.Caching;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.Web
|
||||
{
|
||||
@@ -83,12 +82,6 @@ namespace System.Web
|
||||
set { w.Charset = value; }
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
public override CancellationToken ClientDisconnectedToken {
|
||||
get { return CancellationToken.None; }
|
||||
}
|
||||
#endif
|
||||
|
||||
public override Encoding ContentEncoding {
|
||||
get { return w.ContentEncoding; }
|
||||
set { w.ContentEncoding = value; }
|
||||
|
||||
@@ -15,6 +15,11 @@ LIB_MCS_FLAGS = \
|
||||
/r:System.Web.Abstractions.dll \
|
||||
/r:System.Web.Routing.dll
|
||||
|
||||
ifeq (2.0, $(FRAMEWORK_VERSION))
|
||||
# This is a .NET 3.5 only assembly, but built during the 2.0 build
|
||||
LIB_MCS_FLAGS += -d:NET_3_5
|
||||
endif
|
||||
|
||||
ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
|
||||
LIB_MCS_FLAGS += -r:System.Web.ApplicationServices.dll
|
||||
endif
|
||||
@@ -181,7 +186,7 @@ endif
|
||||
EXTRA_DISTFILES = $(foreach resource,$(TEST_RESOURCE_FILES), $(shell echo $(subst \`,\\\`,$(resource)) | cut -d ',' -f 1))
|
||||
|
||||
# This is a .NET 3.5+ assembly
|
||||
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-System.Web.DynamicData.dll
|
||||
NO_INSTALL = yes
|
||||
|
||||
+1
-5
@@ -204,11 +204,7 @@ namespace System.Web.Script.Serialization
|
||||
}
|
||||
|
||||
public object Deserialize (string input, Type targetType) {
|
||||
object obj = DeserializeObjectInternal (input);
|
||||
|
||||
if (obj == null) return null;
|
||||
|
||||
return ConvertToType (obj, targetType);
|
||||
return DeserializeObjectInternal (input);
|
||||
}
|
||||
|
||||
static object Evaluate (object value) {
|
||||
|
||||
-16
@@ -415,22 +415,6 @@ namespace MonoTests.System.Web.Script.Serialization
|
||||
//object oo = ser.DeserializeObject ("{value:'Purple\\r \\n monkey\\'s:\\tdishwasher'}");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDeserializeNonGenericOverload()
|
||||
{
|
||||
JavaScriptSerializer ser = new JavaScriptSerializer();
|
||||
Assert.IsNull(ser.Deserialize("", typeof(X)));
|
||||
|
||||
X s = new X();
|
||||
s.Init();
|
||||
string x = ser.Serialize(s);
|
||||
|
||||
Assert.AreEqual("{\"z\":8,\"ch\":\"v\",\"ch_null\":null,\"str\":\"vwF59g\",\"b\":253,\"sb\":-48,\"sh\":-32740,\"ush\":65511,\"i\":-234235453,\"ui\":4294733061,\"l\":-9223372036854775780,\"ul\":18446744073709551612,\"f\":NaN,\"f1\":-Infinity,\"f2\":Infinity,\"f3\":-3.40282347E+38,\"f4\":3.40282347E+38,\"d\":NaN,\"d1\":-Infinity,\"d2\":Infinity,\"d3\":-1.7976931348623157E+308,\"d4\":1.7976931348623157E+308,\"de\":-1,\"de1\":0,\"de2\":1,\"de3\":-79228162514264337593543950335,\"de4\":79228162514264337593543950335,\"g\":\"000000ea-0002-0162-0102-030405060708\",\"nb\":null,\"dbn\":null,\"uri\":\"http://kostat@mainsoft/adfasdf/asdfasdf.aspx/asda/ads?a=b&c=d\",\"hash\":{\"mykey\":{\"BB\":10}},\"point\":{\"IsEmpty\":false,\"X\":150,\"Y\":150},\"MyEnum\":[1,10,345],\"MyEnum1\":[1,10,345],\"AA\":5,\"AA1\":[{\"BB\":10},{\"BB\":10}],\"BB\":18446744073709551610,\"YY\":[{\"BB\":10},{\"BB\":10}]}", x, "#A1");
|
||||
|
||||
X n = ser.Deserialize(x, typeof(X)) as X;
|
||||
Assert.AreEqual(s, n, "#A2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDeserializeTypeResolver ()
|
||||
{
|
||||
|
||||
@@ -9,6 +9,11 @@ LIB_MCS_FLAGS = \
|
||||
/r:System.Web.dll \
|
||||
/r:System.Web.Abstractions.dll
|
||||
|
||||
ifeq (2.0, $(FRAMEWORK_VERSION))
|
||||
# This is a .NET 3.5 only assembly, but built during the 2.0 build
|
||||
LIB_MCS_FLAGS += -d:NET_3_5 -d:SYSTEMCORE_DEP
|
||||
endif
|
||||
|
||||
ifdef DEBUG
|
||||
LIB_MCS_FLAGS += -define:DEBUG
|
||||
endif
|
||||
@@ -18,7 +23,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
|
||||
EXTRA_DISTFILES =
|
||||
|
||||
# This is a .NET 3.5+ assembly
|
||||
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-System.Web.Routing.dll
|
||||
NO_INSTALL = yes
|
||||
|
||||
@@ -255,7 +255,6 @@ LIB_MCS_FLAGS = \
|
||||
-r:System.Xml.dll \
|
||||
-r:System.EnterpriseServices.dll \
|
||||
-r:System.Runtime.Serialization.Formatters.Soap \
|
||||
-r:System.ComponentModel.DataAnnotations.dll \
|
||||
$(OTHER_LIB_MCS_FLAGS) \
|
||||
$(RESX_RES:%=/resource:%) \
|
||||
$(OTHER_RES:%=/resource:%)
|
||||
@@ -272,6 +271,10 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -doc:$(test_lib:.dll=.xml) -nowarn:219,169,159
|
||||
$(foreach file,$(NUNIT_APP_CODE_FILES),$(shell echo $(file) | sed -e 's;\(.*\)/\(.*\);/resource:\1/\2,App_Code/\2 ;g')) \
|
||||
$(foreach file,$(NUNIT_APP_GLOBALRESOURCES_FILES),$(shell echo $(file) | sed -e 's;\(.*\)/\(.*\);/resource:\1/\2,App_GlobalResources/\2 ;g'))
|
||||
|
||||
ifeq (net_2_0, $(PROFILE))
|
||||
TEST_MCS_FLAGS += -r:System.Web.Extensions.dll -d:TEST
|
||||
endif
|
||||
|
||||
EXTRA_DISTFILES = \
|
||||
$(RESOURCE_FILES_4) \
|
||||
$(RESOURCE_FILES_2) \
|
||||
@@ -444,4 +447,4 @@ ifneq ($(PROFILE),basic)
|
||||
csproj-local:
|
||||
$(MAKE) csproj-local intermediate=plainweb/
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@@ -1249,7 +1249,6 @@
|
||||
<Compile Include="System.Web\DefaultExceptionPageTemplate.cs" />
|
||||
<Compile Include="System.Web\DefaultHttpHandler.cs" />
|
||||
<Compile Include="System.Web\EndEventHandler.cs" />
|
||||
<Compile Include="System.Web\EventHandlerTaskAsyncHelper.cs" />
|
||||
<Compile Include="System.Web\ExceptionPageTemplate.cs" />
|
||||
<Compile Include="System.Web\ExceptionPageTemplateFragment.cs" />
|
||||
<Compile Include="System.Web\ExceptionPageTemplateFragmentValue.cs" />
|
||||
@@ -1295,7 +1294,6 @@
|
||||
<Compile Include="System.Web\HttpRuntime.cs" />
|
||||
<Compile Include="System.Web\HttpServerUtility.cs" />
|
||||
<Compile Include="System.Web\HttpStaticObjectsCollection.cs" />
|
||||
<Compile Include="System.Web\HttpTaskAsyncHandler.cs" />
|
||||
<Compile Include="System.Web\HttpUnhandledException.cs" />
|
||||
<Compile Include="System.Web\HttpUtility.cs" />
|
||||
<Compile Include="System.Web\HttpValidationStatus.cs" />
|
||||
@@ -1335,8 +1333,6 @@
|
||||
<Compile Include="System.Web\SiteMapResolveEventArgs.cs" />
|
||||
<Compile Include="System.Web\StaticFileHandler.cs" />
|
||||
<Compile Include="System.Web\StaticSiteMapProvider.cs" />
|
||||
<Compile Include="System.Web\TaskAsyncResult.cs" />
|
||||
<Compile Include="System.Web\TaskEventHandler.cs" />
|
||||
<Compile Include="System.Web\TempFileStream.cs" />
|
||||
<Compile Include="System.Web\TraceContext.cs" />
|
||||
<Compile Include="System.Web\TraceContextEventArgs.cs" />
|
||||
|
||||
@@ -1249,7 +1249,6 @@
|
||||
<Compile Include="System.Web\DefaultExceptionPageTemplate.cs" />
|
||||
<Compile Include="System.Web\DefaultHttpHandler.cs" />
|
||||
<Compile Include="System.Web\EndEventHandler.cs" />
|
||||
<Compile Include="System.Web\EventHandlerTaskAsyncHelper.cs" />
|
||||
<Compile Include="System.Web\ExceptionPageTemplate.cs" />
|
||||
<Compile Include="System.Web\ExceptionPageTemplateFragment.cs" />
|
||||
<Compile Include="System.Web\ExceptionPageTemplateFragmentValue.cs" />
|
||||
@@ -1295,7 +1294,6 @@
|
||||
<Compile Include="System.Web\HttpRuntime.cs" />
|
||||
<Compile Include="System.Web\HttpServerUtility.cs" />
|
||||
<Compile Include="System.Web\HttpStaticObjectsCollection.cs" />
|
||||
<Compile Include="System.Web\HttpTaskAsyncHandler.cs" />
|
||||
<Compile Include="System.Web\HttpUnhandledException.cs" />
|
||||
<Compile Include="System.Web\HttpUtility.cs" />
|
||||
<Compile Include="System.Web\HttpValidationStatus.cs" />
|
||||
@@ -1323,7 +1321,6 @@
|
||||
<Compile Include="System.Web\ProcessShutdownReason.cs" />
|
||||
<Compile Include="System.Web\ProcessStatus.cs" />
|
||||
<Compile Include="System.Web\QueueManager.cs" />
|
||||
<Compile Include="System.Web\ReadEntityBodyMode.cs" />
|
||||
<Compile Include="System.Web\RequestNotification.cs" />
|
||||
<Compile Include="System.Web\RequestNotificationStatus.cs" />
|
||||
<Compile Include="System.Web\ServerVariablesCollection.cs" />
|
||||
@@ -1335,8 +1332,6 @@
|
||||
<Compile Include="System.Web\SiteMapResolveEventArgs.cs" />
|
||||
<Compile Include="System.Web\StaticFileHandler.cs" />
|
||||
<Compile Include="System.Web\StaticSiteMapProvider.cs" />
|
||||
<Compile Include="System.Web\TaskAsyncResult.cs" />
|
||||
<Compile Include="System.Web\TaskEventHandler.cs" />
|
||||
<Compile Include="System.Web\TempFileStream.cs" />
|
||||
<Compile Include="System.Web\TraceContext.cs" />
|
||||
<Compile Include="System.Web\TraceContextEventArgs.cs" />
|
||||
|
||||
@@ -556,7 +556,6 @@
|
||||
<Compile Include="Test\System.Web.Util\UrlUtilsTest.cs" />
|
||||
<Compile Include="Test\System.Web.Util\WorkItemCas.cs" />
|
||||
<Compile Include="Test\System.Web\AppBrowsersTest.cs" />
|
||||
<Compile Include="Test\System.Web\EventHandlerTaskAsyncHelperTest.cs" />
|
||||
<Compile Include="Test\System.Web\HttpApplicationCas.cs" />
|
||||
<Compile Include="Test\System.Web\HttpApplicationStateCas.cs" />
|
||||
<Compile Include="Test\System.Web\HttpApplicationTest.cs" />
|
||||
@@ -592,7 +591,6 @@
|
||||
<Compile Include="Test\System.Web\HttpServerUtilityCas.cs" />
|
||||
<Compile Include="Test\System.Web\HttpServerUtilityTest.cs" />
|
||||
<Compile Include="Test\System.Web\HttpStaticObjectsCollectionCas.cs" />
|
||||
<Compile Include="Test\System.Web\HttpTaskAsyncHandlerTest.cs" />
|
||||
<Compile Include="Test\System.Web\HttpUnhandledExceptionCas.cs" />
|
||||
<Compile Include="Test\System.Web\HttpUtilityCas.cs" />
|
||||
<Compile Include="Test\System.Web\HttpUtilityTest.cs" />
|
||||
@@ -604,7 +602,6 @@
|
||||
<Compile Include="Test\System.Web\SiteMapNodeTest.cs" />
|
||||
<Compile Include="Test\System.Web\SiteMapProviderTest.cs" />
|
||||
<Compile Include="Test\System.Web\StaticSiteMapProviderTest.cs" />
|
||||
<Compile Include="Test\System.Web\TaskAsyncResultTest.cs" />
|
||||
<Compile Include="Test\System.Web\TraceContextCas.cs" />
|
||||
<Compile Include="Test\System.Web\TraceContextRecordTest.cs" />
|
||||
<Compile Include="Test\System.Web\VirtualPathUtilityTest.cs" />
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
//
|
||||
// System.Web.Security.MembershipPasswordAttribute
|
||||
//
|
||||
// Authors:
|
||||
// Martin Thwaites ([email protected])
|
||||
//
|
||||
// (C) 2014 Martin Thwaites
|
||||
//
|
||||
//
|
||||
// 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.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace System.Web.Security
|
||||
{
|
||||
[AttributeUsageAttribute (AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter, AllowMultiple = false)]
|
||||
public class MembershipPasswordAttribute : ValidationAttribute
|
||||
{
|
||||
public string MinNonAlphanumericCharactersError { get; set; }
|
||||
public string MinPasswordLengthError { get; set; }
|
||||
public int MinRequiredNonAlphanumericCharacters { get; set; }
|
||||
public int MinRequiredPasswordLength { get; set; }
|
||||
public string PasswordStrengthError { get; set; }
|
||||
public string PasswordStrengthRegularExpression { get; set; }
|
||||
public Type ResourceType { get; set; }
|
||||
|
||||
public MembershipPasswordAttribute ()
|
||||
{
|
||||
if (Membership.Provider != null)
|
||||
{
|
||||
MinRequiredNonAlphanumericCharacters = Membership.Provider.MinRequiredNonAlphanumericCharacters;
|
||||
MinRequiredPasswordLength = Membership.Provider.MinRequiredPasswordLength;
|
||||
PasswordStrengthRegularExpression = Membership.Provider.PasswordStrengthRegularExpression;
|
||||
}
|
||||
else
|
||||
{
|
||||
MinRequiredPasswordLength = 7;
|
||||
MinRequiredNonAlphanumericCharacters = 1;
|
||||
PasswordStrengthRegularExpression = @"(?=.{6,})(?=(.*\d){1,})(?=(.*\W){1,})";
|
||||
}
|
||||
MinNonAlphanumericCharactersError = "The '{0}' field is an invalid password. Password must have {1} or more non-alphanumeric characters.";
|
||||
MinPasswordLengthError = "The '{0}' field is an invalid password. Password must have {1} or more characters.";
|
||||
PasswordStrengthError = "The '{0}' field is an invalid password. It does not meet the password strength requirements";
|
||||
ErrorMessage = "The field {0} is invalid.";
|
||||
}
|
||||
|
||||
protected override ValidationResult IsValid (object value, ValidationContext validationContext)
|
||||
{
|
||||
var password = value as string;
|
||||
var isError = false;
|
||||
if (string.IsNullOrEmpty(password))
|
||||
return null;
|
||||
|
||||
var errorMessage = string.Empty;
|
||||
var parameter = 0;
|
||||
var pattern = new Regex (@"\W|_");
|
||||
|
||||
if (MinRequiredPasswordLength > 0 &&
|
||||
password.Length < MinRequiredPasswordLength) {
|
||||
errorMessage = MinPasswordLengthError;
|
||||
parameter = MinRequiredPasswordLength;
|
||||
isError = true;
|
||||
}
|
||||
|
||||
if (!isError && MinRequiredNonAlphanumericCharacters > 0 &&
|
||||
pattern.Matches (password).Count < MinRequiredNonAlphanumericCharacters) {
|
||||
errorMessage = MinNonAlphanumericCharactersError;
|
||||
parameter = MinRequiredNonAlphanumericCharacters;
|
||||
isError = true;
|
||||
}
|
||||
|
||||
if (!isError && !string.IsNullOrEmpty (PasswordStrengthRegularExpression) &&
|
||||
new Regex (PasswordStrengthRegularExpression).IsMatch (password)) {
|
||||
errorMessage = PasswordStrengthError;
|
||||
isError = true;
|
||||
}
|
||||
|
||||
if (isError) {
|
||||
if (validationContext == null)
|
||||
return new ValidationResult("error");
|
||||
|
||||
return new ValidationResult (
|
||||
string.Format (errorMessage, validationContext.DisplayName, parameter),
|
||||
new[] {validationContext.MemberName});
|
||||
}
|
||||
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
//
|
||||
// System.Web.EventHandlerTaskAsyncHelper.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornel Pal ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Kornel Pal
|
||||
//
|
||||
// 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.Threading.Tasks;
|
||||
|
||||
namespace System.Web
|
||||
{
|
||||
public sealed class EventHandlerTaskAsyncHelper
|
||||
{
|
||||
readonly TaskEventHandler taskEventHandler;
|
||||
readonly BeginEventHandler beginEventHandler;
|
||||
static readonly EndEventHandler endEventHandler = TaskAsyncResult.Wait;
|
||||
|
||||
public BeginEventHandler BeginEventHandler {
|
||||
get { return beginEventHandler; }
|
||||
}
|
||||
|
||||
public EndEventHandler EndEventHandler {
|
||||
get { return endEventHandler; }
|
||||
}
|
||||
|
||||
public EventHandlerTaskAsyncHelper (TaskEventHandler handler)
|
||||
{
|
||||
if (handler == null)
|
||||
throw new ArgumentNullException ("handler");
|
||||
|
||||
taskEventHandler = handler;
|
||||
beginEventHandler = GetAsyncResult;
|
||||
}
|
||||
|
||||
IAsyncResult GetAsyncResult (object sender, EventArgs e, AsyncCallback callback, object state)
|
||||
{
|
||||
Task task = taskEventHandler (sender, e);
|
||||
return TaskAsyncResult.GetAsyncResult (task, callback, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,17 +80,13 @@ namespace System.Web
|
||||
string unescaped_path;
|
||||
string original_path;
|
||||
string path_info;
|
||||
string path_info_unvalidated;
|
||||
string raw_url;
|
||||
string raw_url_unvalidated;
|
||||
WebROCollection all_params;
|
||||
NameValueCollection headers;
|
||||
WebROCollection headers_unvalidated;
|
||||
WebROCollection headers;
|
||||
Stream input_stream;
|
||||
InputFilterStream input_filter;
|
||||
Stream filter;
|
||||
HttpCookieCollection cookies;
|
||||
HttpCookieCollection cookies_unvalidated;
|
||||
string http_method;
|
||||
|
||||
WebROCollection form;
|
||||
@@ -444,25 +440,15 @@ namespace System.Web
|
||||
}
|
||||
}
|
||||
|
||||
internal HttpCookieCollection CookiesNoValidation {
|
||||
get {
|
||||
if (cookies_unvalidated == null) {
|
||||
if (worker_request == null) {
|
||||
cookies_unvalidated = new HttpCookieCollection ();
|
||||
} else {
|
||||
string cookie_hv = worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderCookie);
|
||||
cookies_unvalidated = new HttpCookieCollection (cookie_hv);
|
||||
}
|
||||
}
|
||||
|
||||
return cookies_unvalidated;
|
||||
}
|
||||
}
|
||||
|
||||
public HttpCookieCollection Cookies {
|
||||
get {
|
||||
if (cookies == null) {
|
||||
cookies = CookiesNoValidation;
|
||||
if (worker_request == null) {
|
||||
cookies = new HttpCookieCollection ();
|
||||
} else {
|
||||
string cookie_hv = worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderCookie);
|
||||
cookies = new HttpCookieCollection (cookie_hv);
|
||||
}
|
||||
}
|
||||
|
||||
#if TARGET_J2EE
|
||||
@@ -751,20 +737,10 @@ namespace System.Web
|
||||
}
|
||||
}
|
||||
|
||||
internal NameValueCollection HeadersNoValidation {
|
||||
get {
|
||||
if (headers_unvalidated == null) {
|
||||
headers_unvalidated = new HeadersCollection (this);
|
||||
}
|
||||
|
||||
return headers_unvalidated;
|
||||
}
|
||||
}
|
||||
|
||||
public NameValueCollection Headers {
|
||||
get {
|
||||
if (headers == null) {
|
||||
headers = HeadersNoValidation;
|
||||
headers = new HeadersCollection (this);
|
||||
#if NET_4_0
|
||||
if (validateRequestNewMode) {
|
||||
RequestValidator validator = RequestValidator.Current;
|
||||
@@ -1250,23 +1226,12 @@ namespace System.Web
|
||||
}
|
||||
}
|
||||
|
||||
internal string PathInfoNoValidation {
|
||||
get {
|
||||
if (path_info_unvalidated == null) {
|
||||
if (worker_request == null)
|
||||
return String.Empty;
|
||||
|
||||
path_info_unvalidated = worker_request.GetPathInfo () ?? String.Empty;
|
||||
}
|
||||
|
||||
return path_info_unvalidated;
|
||||
}
|
||||
}
|
||||
|
||||
public string PathInfo {
|
||||
get {
|
||||
if (path_info == null) {
|
||||
path_info = PathInfoNoValidation;
|
||||
if (worker_request == null)
|
||||
return String.Empty;
|
||||
path_info = worker_request.GetPathInfo () ?? String.Empty;
|
||||
#if NET_4_0
|
||||
if (validateRequestNewMode) {
|
||||
RequestValidator validator = RequestValidator.Current;
|
||||
@@ -1370,26 +1335,16 @@ namespace System.Web
|
||||
}
|
||||
}
|
||||
|
||||
internal string RawUrlUnvalidated {
|
||||
get {
|
||||
if (raw_url_unvalidated == null) {
|
||||
if (worker_request != null)
|
||||
raw_url_unvalidated = worker_request.GetRawUrl ();
|
||||
else
|
||||
raw_url_unvalidated = UrlComponents.Path + UrlComponents.Query;
|
||||
|
||||
if (raw_url_unvalidated == null)
|
||||
raw_url_unvalidated = String.Empty;
|
||||
}
|
||||
|
||||
return raw_url_unvalidated;
|
||||
}
|
||||
}
|
||||
|
||||
public string RawUrl {
|
||||
get {
|
||||
if (raw_url == null) {
|
||||
raw_url = RawUrlUnvalidated;
|
||||
if (worker_request != null)
|
||||
raw_url = worker_request.GetRawUrl ();
|
||||
else
|
||||
raw_url = UrlComponents.Path + UrlComponents.Query;
|
||||
|
||||
if (raw_url == null)
|
||||
raw_url = String.Empty;
|
||||
#if NET_4_0
|
||||
if (validateRequestNewMode) {
|
||||
RequestValidator validator = RequestValidator.Current;
|
||||
@@ -1443,26 +1398,6 @@ namespace System.Web
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
public UnvalidatedRequestValues Unvalidated {
|
||||
get {
|
||||
var vals = new UnvalidatedRequestValues ();
|
||||
|
||||
vals.Cookies = CookiesNoValidation;
|
||||
vals.Files = Files;
|
||||
vals.Form = FormUnvalidated;
|
||||
vals.Headers = HeadersNoValidation;
|
||||
vals.Path = PathNoValidation;
|
||||
vals.PathInfo = PathInfoNoValidation;
|
||||
vals.QueryString = QueryStringUnvalidated;
|
||||
vals.RawUrl = RawUrlUnvalidated;
|
||||
vals.Url = Url;
|
||||
|
||||
return vals;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public Uri Url {
|
||||
get {
|
||||
if (cached_url == null) {
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
//
|
||||
// System.Web.HttpTaskAsyncHandler.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornel Pal ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Kornel Pal
|
||||
//
|
||||
// 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.Threading.Tasks;
|
||||
|
||||
namespace System.Web
|
||||
{
|
||||
public abstract class HttpTaskAsyncHandler : IHttpAsyncHandler, IHttpHandler
|
||||
{
|
||||
public virtual bool IsReusable {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
public virtual void ProcessRequest (HttpContext context)
|
||||
{
|
||||
throw new NotSupportedException ("This handler cannot be executed synchronously.");
|
||||
}
|
||||
|
||||
public abstract Task ProcessRequestAsync (HttpContext context);
|
||||
|
||||
IAsyncResult IHttpAsyncHandler.BeginProcessRequest (HttpContext context, AsyncCallback cb, object extraData)
|
||||
{
|
||||
Task task = ProcessRequestAsync (context);
|
||||
return TaskAsyncResult.GetAsyncResult (task, cb, extraData);
|
||||
}
|
||||
|
||||
void IHttpAsyncHandler.EndProcessRequest (IAsyncResult result)
|
||||
{
|
||||
TaskAsyncResult.Wait (result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
//
|
||||
// System.Web.TaskAsyncResult.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornel Pal ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Kornel Pal
|
||||
//
|
||||
// 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.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Web
|
||||
{
|
||||
sealed class TaskAsyncResult : IAsyncResult
|
||||
{
|
||||
static readonly Action<Task, object> invokeCallback = InvokeCallback;
|
||||
readonly Task task;
|
||||
readonly AsyncCallback callback;
|
||||
|
||||
public object AsyncState {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public WaitHandle AsyncWaitHandle {
|
||||
get { return ((IAsyncResult) task).AsyncWaitHandle; }
|
||||
}
|
||||
|
||||
public bool CompletedSynchronously {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public bool IsCompleted {
|
||||
get { return task.IsCompleted; }
|
||||
}
|
||||
|
||||
TaskAsyncResult (Task task, AsyncCallback callback, object state)
|
||||
{
|
||||
this.task = task;
|
||||
this.callback = callback;
|
||||
this.AsyncState = state;
|
||||
this.CompletedSynchronously = task.IsCompleted;
|
||||
}
|
||||
|
||||
public static IAsyncResult GetAsyncResult (Task task, AsyncCallback callback, object state)
|
||||
{
|
||||
if (task == null)
|
||||
return null;
|
||||
|
||||
var result = new TaskAsyncResult (task, callback, state);
|
||||
|
||||
if (callback != null) {
|
||||
if (result.CompletedSynchronously)
|
||||
callback (result);
|
||||
else
|
||||
task.ContinueWith (invokeCallback, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void Wait (IAsyncResult result)
|
||||
{
|
||||
if (result == null)
|
||||
throw new ArgumentNullException ("result");
|
||||
|
||||
var taskAsyncResult = result as TaskAsyncResult;
|
||||
if (taskAsyncResult == null)
|
||||
throw new ArgumentException ("The provided IAsyncResult is invalid.", "result");
|
||||
|
||||
taskAsyncResult.task.GetAwaiter ().GetResult ();
|
||||
}
|
||||
|
||||
static void InvokeCallback (Task task, object state)
|
||||
{
|
||||
var result = (TaskAsyncResult) state;
|
||||
result.callback (result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
//
|
||||
// System.Web.TaskEventHandler.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornel Pal ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Kornel Pal
|
||||
//
|
||||
// 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.Threading.Tasks;
|
||||
|
||||
namespace System.Web
|
||||
{
|
||||
public delegate Task TaskEventHandler (object sender, EventArgs e);
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
//
|
||||
// System.Web.UnvalidatedRequestValues.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Morano <[email protected]>
|
||||
//
|
||||
|
||||
//
|
||||
// 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.Specialized;
|
||||
|
||||
|
||||
namespace System.Web {
|
||||
public sealed class UnvalidatedRequestValues {
|
||||
public HttpCookieCollection Cookies { get; internal set; }
|
||||
public HttpFileCollection Files { get; internal set; }
|
||||
public NameValueCollection Form { get; internal set; }
|
||||
public NameValueCollection Headers { get; internal set; }
|
||||
public string Path { get; internal set; }
|
||||
public string PathInfo { get; internal set; }
|
||||
public NameValueCollection QueryString { get; internal set; }
|
||||
public string RawUrl { get; internal set; }
|
||||
public Uri Url { get; internal set; }
|
||||
|
||||
public string this[string field] {
|
||||
get {
|
||||
if (Form != null && Form [field] != null) {
|
||||
return Form [field];
|
||||
}
|
||||
|
||||
if (Cookies != null && Cookies [field] != null) {
|
||||
return Cookies [field].Value;
|
||||
}
|
||||
|
||||
if (QueryString != null && QueryString [field] != null) {
|
||||
return QueryString [field];
|
||||
}
|
||||
|
||||
// msdn docs also suggest the ServerVariables are inspected by this indexer,
|
||||
// but that seems odd given what is available in this class
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
//
|
||||
// System.Web.UnvalidatedRequestValuesBase.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Morano <[email protected]>
|
||||
//
|
||||
|
||||
//
|
||||
// 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.Specialized;
|
||||
|
||||
|
||||
namespace System.Web {
|
||||
public abstract class UnvalidatedRequestValuesBase {
|
||||
void NotImplemented ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public virtual HttpCookieCollection Cookies
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual HttpFileCollection Files
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual NameValueCollection Form
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual NameValueCollection Headers
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual string this[string field]
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual string Path
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual string PathInfo
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual NameValueCollection QueryString
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual string RawUrl
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual Uri Url
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
//
|
||||
// System.Web.UnvalidatedRequestValuesWrapper.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Morano <[email protected]>
|
||||
//
|
||||
|
||||
//
|
||||
// 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.Specialized;
|
||||
|
||||
|
||||
namespace System.Web {
|
||||
public class UnvalidatedRequestValuesWrapper : UnvalidatedRequestValuesBase {
|
||||
UnvalidatedRequestValues rv;
|
||||
|
||||
public UnvalidatedRequestValuesWrapper (UnvalidatedRequestValues requestValues)
|
||||
{
|
||||
rv = requestValues;
|
||||
}
|
||||
|
||||
public override HttpCookieCollection Cookies
|
||||
{
|
||||
get { return rv.Cookies; }
|
||||
}
|
||||
|
||||
public override HttpFileCollection Files
|
||||
{
|
||||
get { return rv.Files; }
|
||||
}
|
||||
|
||||
public override NameValueCollection Form
|
||||
{
|
||||
get { return rv.Form; }
|
||||
}
|
||||
|
||||
public override NameValueCollection Headers
|
||||
{
|
||||
get { return rv.Headers; }
|
||||
}
|
||||
|
||||
public override string this[string field]
|
||||
{
|
||||
get { return rv[field]; }
|
||||
}
|
||||
|
||||
public override string Path
|
||||
{
|
||||
get { return rv.Path; }
|
||||
}
|
||||
|
||||
public override string PathInfo
|
||||
{
|
||||
get { return rv.PathInfo; }
|
||||
}
|
||||
|
||||
public override NameValueCollection QueryString
|
||||
{
|
||||
get { return rv.QueryString; }
|
||||
}
|
||||
|
||||
public override string RawUrl
|
||||
{
|
||||
get { return rv.RawUrl; }
|
||||
}
|
||||
|
||||
public override Uri Url
|
||||
{
|
||||
get { return rv.Url; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,6 @@ mainsoft/NunitWeb/NunitWeb/Tests/AuthorConverter.cs
|
||||
mainsoft/NunitWeb/NunitWeb/Tests/Book.cs
|
||||
mainsoft/NunitWeb/NunitWeb/Tests/BookType.cs
|
||||
System.Web/AppBrowsersTest.cs
|
||||
System.Web/EventHandlerTaskAsyncHelperTest.cs
|
||||
System.Web/HttpApplicationTest.cs
|
||||
System.Web/HttpBrowserCapabilitiesTest.cs
|
||||
System.Web/HttpCacheVaryByContentEncodingsTest.cs
|
||||
@@ -59,12 +58,10 @@ System.Web/HttpRequestTest.cs
|
||||
System.Web/HttpResponseTest.cs
|
||||
System.Web/HttpRuntimeTest.cs
|
||||
System.Web/HttpServerUtilityTest.cs
|
||||
System.Web/HttpTaskAsyncHandlerTest.cs
|
||||
System.Web/HttpUtilityTest.cs
|
||||
System.Web/SiteMapProviderTest.cs
|
||||
System.Web/SiteMapNodeTest.cs
|
||||
System.Web/StaticSiteMapProviderTest.cs
|
||||
System.Web/TaskAsyncResultTest.cs
|
||||
System.Web/TraceContextRecordTest.cs
|
||||
System.Web.Compilation/BuildManagerTest.cs
|
||||
System.Web.Compilation/ClientBuildManagerParameterTest.cs
|
||||
@@ -106,7 +103,6 @@ System.Web.Profile/ProfileInfoTest.cs
|
||||
System.Web.Security/FormsAuthenticationTest.cs
|
||||
System.Web.Security/FormsIdentityTest.cs
|
||||
System.Web.Security/MembershipTest.cs
|
||||
System.Web.Security/MembershipPasswordAttributeTest.cs
|
||||
System.Web.Security/MembershipProviderCollectionTest.cs
|
||||
System.Web.Security/MembershipProviderTest.cs
|
||||
System.Web.Security/MembershipUserCollectionTest.cs
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
#if NET_4_5
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web.Security;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.Web.Security {
|
||||
|
||||
[TestFixture]
|
||||
public class MembershipPasswordAttributeTest
|
||||
{
|
||||
private ValidationContext _validationContext;
|
||||
|
||||
public MembershipPasswordAttributeTest ()
|
||||
{
|
||||
_validationContext = new ValidationContext (new object ())
|
||||
{
|
||||
DisplayName = "testDisplay",
|
||||
MemberName = "testMember"
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsValid ()
|
||||
{
|
||||
var passwordAttribute = new MembershipPasswordAttributeTestClass ();
|
||||
Assert.IsTrue (passwordAttribute.IsValid (""), "sending an empty password password should should be treated as valid");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsValid_with_ValidationContext ()
|
||||
{
|
||||
var passwordAttribute = new MembershipPasswordAttributeTestClass ();
|
||||
var result = passwordAttribute.TestValidation ("", _validationContext);
|
||||
Assert.IsNull (result, "sending an empty password password should return a null response");
|
||||
|
||||
result = passwordAttribute.TestValidation ("a!12345", _validationContext);
|
||||
Assert.AreEqual (ValidationResult.Success, result, "Should suceed with a 7 character length and a single nonalphanumeric");
|
||||
|
||||
// test error priority
|
||||
passwordAttribute.MinRequiredPasswordLength = 4;
|
||||
passwordAttribute.MinRequiredNonAlphanumericCharacters = 2;
|
||||
result = passwordAttribute.TestValidation ("aaa", _validationContext);
|
||||
Assert.AreEqual ("The 'testDisplay' field is an invalid password. Password must have 4 or more characters.", result.ErrorMessage);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MinRequiredPasswordLength ()
|
||||
{
|
||||
var passwordAttribute = new MembershipPasswordAttributeTestClass ();
|
||||
var result = passwordAttribute.TestValidation ("a!1234", _validationContext);
|
||||
Assert.AreEqual ("The 'testDisplay' field is an invalid password. Password must have 7 or more characters.", result.ErrorMessage, "Error message not correct for lower Min characters");
|
||||
Assert.AreEqual (_validationContext.MemberName, result.MemberNames.FirstOrDefault (), "Member name not correct");
|
||||
|
||||
passwordAttribute.MinRequiredPasswordLength = 6;
|
||||
result = passwordAttribute.TestValidation ("a!1234", _validationContext);
|
||||
Assert.AreEqual (ValidationResult.Success, result, "Should suceed with a 6 character length after it's reset");
|
||||
|
||||
result = passwordAttribute.TestValidation ("a!123", _validationContext);
|
||||
Assert.AreEqual("The 'testDisplay' field is an invalid password. Password must have 6 or more characters.", result.ErrorMessage, "Error message not correct for Min characters of 6");
|
||||
|
||||
|
||||
passwordAttribute.MinRequiredPasswordLength = 1;
|
||||
result = passwordAttribute.TestValidation ("!", _validationContext);
|
||||
Assert.AreEqual(ValidationResult.Success, result, "Should suceed with a 6 character length after it's reset");
|
||||
|
||||
// Note there is no test for empty password here as it returns null and is therefore in the generic test
|
||||
|
||||
// Error Message changes
|
||||
passwordAttribute.MinRequiredPasswordLength = 5;
|
||||
passwordAttribute.MinPasswordLengthError = "There was an error";
|
||||
result = passwordAttribute.TestValidation ("a!13", _validationContext);
|
||||
Assert.AreEqual("There was an error", result.ErrorMessage, "Error Message wasn't correct without parameters.");
|
||||
|
||||
passwordAttribute.MinPasswordLengthError = "There was an error parameter1: {0}";
|
||||
result = passwordAttribute.TestValidation ("a!13", _validationContext);
|
||||
Assert.AreEqual("There was an error parameter1: testDisplay", result.ErrorMessage, "Error Message wasn't correct with 1 parameter.");
|
||||
|
||||
passwordAttribute.MinPasswordLengthError = "There was an error parameter1: {0} parameter2: {1}";
|
||||
result = passwordAttribute.TestValidation ("a!13", _validationContext);
|
||||
Assert.AreEqual ("There was an error parameter1: testDisplay parameter2: 5", result.ErrorMessage, "Error Message wasn't correct with 2 parameters.");
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MinRequiredNonAlphanumericCharacters ()
|
||||
{
|
||||
var passwordAttribute = new MembershipPasswordAttributeTestClass ();
|
||||
var result = passwordAttribute.TestValidation ("a!12345", _validationContext);
|
||||
Assert.AreEqual (ValidationResult.Success, result, "Should succeed with the default 1 non alpha numeric");
|
||||
|
||||
result = passwordAttribute.TestValidation ("a123456", _validationContext);
|
||||
Assert.AreEqual ("The 'testDisplay' field is an invalid password. Password must have 1 or more non-alphanumeric characters.", result.ErrorMessage, "Expected validation to fail without non-alphanumerics");
|
||||
|
||||
|
||||
passwordAttribute.MinRequiredNonAlphanumericCharacters = 3;
|
||||
result = passwordAttribute.TestValidation ("a!&12345", _validationContext);
|
||||
Assert.AreEqual ("The 'testDisplay' field is an invalid password. Password must have 3 or more non-alphanumeric characters.", result.ErrorMessage, "Expected validation to fail without 3 non-alphanumerics");
|
||||
|
||||
result = passwordAttribute.TestValidation ("a!?&132154", _validationContext);
|
||||
Assert.AreEqual (ValidationResult.Success, result, "Should succeed with 3 non alpha numerics");
|
||||
|
||||
passwordAttribute.MinRequiredNonAlphanumericCharacters = 0;
|
||||
result = passwordAttribute.TestValidation ("a123456", _validationContext);
|
||||
Assert.AreEqual (ValidationResult.Success, result, "Should succeed with 0 non alpha numerics");
|
||||
|
||||
// Error Message changes
|
||||
passwordAttribute.MinRequiredNonAlphanumericCharacters = 1;
|
||||
passwordAttribute.MinNonAlphanumericCharactersError = "There was an error";
|
||||
result = passwordAttribute.TestValidation ("a123456", _validationContext);
|
||||
Assert.AreEqual ("There was an error", result.ErrorMessage, "Error Message wasn't correct without parameters.");
|
||||
|
||||
passwordAttribute.MinNonAlphanumericCharactersError = "There was an error parameter1: {0}";
|
||||
result = passwordAttribute.TestValidation ("a123456", _validationContext);
|
||||
Assert.AreEqual("There was an error parameter1: testDisplay", result.ErrorMessage, "Error Message wasn't correct with 1 parameter.");
|
||||
|
||||
passwordAttribute.MinNonAlphanumericCharactersError = "There was an error parameter1: {0} parameter2: {1}";
|
||||
result = passwordAttribute.TestValidation ("a123456", _validationContext);
|
||||
Assert.AreEqual ("There was an error parameter1: testDisplay parameter2: 1", result.ErrorMessage, "Error Message wasn't correct with 2 parameters.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FormatErrorMessage ()
|
||||
{
|
||||
var passwordAttribute = new MembershipPasswordAttribute ();
|
||||
Assert.AreEqual ("The field testDisplay2 is invalid.", passwordAttribute.FormatErrorMessage ("testDisplay2"));
|
||||
}
|
||||
|
||||
internal class MembershipPasswordAttributeTestClass : MembershipPasswordAttribute
|
||||
{
|
||||
public ValidationResult TestValidation (object val, ValidationContext context)
|
||||
{
|
||||
return IsValid (val, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,118 +0,0 @@
|
||||
//
|
||||
// MonoTests.System.Web.EventHandlerTaskAsyncHelperTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornel Pal ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Kornel Pal
|
||||
//
|
||||
// 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_4_5
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.Web
|
||||
{
|
||||
[TestFixture]
|
||||
public sealed class EventHandlerTaskAsyncHelperTest : TaskAsyncResultTest
|
||||
{
|
||||
EventHandlerTaskAsyncHelper helper;
|
||||
object expectedSender;
|
||||
EventArgs expectedEventArgs;
|
||||
|
||||
static Task DummyTaskEventHandler (object sender, EventArgs e)
|
||||
{
|
||||
throw new AssertionException ("Should not be called.");
|
||||
}
|
||||
|
||||
protected override void SetNullArguments ()
|
||||
{
|
||||
expectedSender = null;
|
||||
expectedEventArgs = null;
|
||||
}
|
||||
|
||||
protected override IAsyncResult GetAsyncResult (Func<Task> taskFactory, AsyncCallback callback, object state)
|
||||
{
|
||||
Assert.IsNull (helper, "GetAsyncResult#A01");
|
||||
|
||||
TaskEventHandler handler = (sender, e) => {
|
||||
Assert.AreSame (expectedSender, sender, "GetAsyncResult#A02");
|
||||
Assert.AreSame (expectedEventArgs, e, "GetAsyncResult#A03");
|
||||
|
||||
return taskFactory ();
|
||||
};
|
||||
|
||||
helper = new EventHandlerTaskAsyncHelper (handler);
|
||||
return helper.BeginEventHandler (expectedSender, expectedEventArgs, callback, state);
|
||||
}
|
||||
|
||||
protected override void Wait (IAsyncResult result)
|
||||
{
|
||||
Assert.IsNotNull (helper, "Wait#A01");
|
||||
|
||||
helper.EndEventHandler (result);
|
||||
}
|
||||
|
||||
protected override void TestSetUp ()
|
||||
{
|
||||
base.TestSetUp ();
|
||||
|
||||
helper = null;
|
||||
expectedSender = new object ();
|
||||
expectedEventArgs = new EventArgs ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Constructor ()
|
||||
{
|
||||
var helper = new EventHandlerTaskAsyncHelper (DummyTaskEventHandler);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void Constructor_NullHandler ()
|
||||
{
|
||||
var helper = new EventHandlerTaskAsyncHelper (null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BeginEventHandler ()
|
||||
{
|
||||
var helper = new EventHandlerTaskAsyncHelper (DummyTaskEventHandler);
|
||||
|
||||
Assert.IsNotNull (helper.BeginEventHandler, "#A01");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EndEventHandler ()
|
||||
{
|
||||
var helper = new EventHandlerTaskAsyncHelper (DummyTaskEventHandler);
|
||||
|
||||
Assert.IsNotNull (helper.EndEventHandler, "#A01");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,132 +0,0 @@
|
||||
//
|
||||
// MonoTests.System.Web.HttpTaskAsyncHandlerTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornel Pal ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Kornel Pal
|
||||
//
|
||||
// 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_4_5
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.Web
|
||||
{
|
||||
[TestFixture]
|
||||
public sealed class HttpTaskAsyncHandlerTest : TaskAsyncResultTest
|
||||
{
|
||||
sealed class DummyHttpTaskAsyncHandler : HttpTaskAsyncHandler
|
||||
{
|
||||
public DummyHttpTaskAsyncHandler ()
|
||||
{
|
||||
}
|
||||
|
||||
public override Task ProcessRequestAsync (HttpContext context)
|
||||
{
|
||||
throw new AssertionException ("Should not be called.");
|
||||
}
|
||||
}
|
||||
|
||||
sealed class TestHttpTaskAsyncHandler : HttpTaskAsyncHandler
|
||||
{
|
||||
readonly Func<Task> taskFactory;
|
||||
readonly HttpContext expectedContext;
|
||||
|
||||
public TestHttpTaskAsyncHandler (Func<Task> taskFactory, HttpContext expectedContext)
|
||||
{
|
||||
this.taskFactory = taskFactory;
|
||||
this.expectedContext = expectedContext;
|
||||
}
|
||||
|
||||
public override Task ProcessRequestAsync (HttpContext context)
|
||||
{
|
||||
Assert.AreSame (expectedContext, context, "TestHttpTaskAsyncHandler#A01");
|
||||
|
||||
return taskFactory ();
|
||||
}
|
||||
}
|
||||
|
||||
IHttpAsyncHandler handler;
|
||||
HttpContext expectedContext;
|
||||
|
||||
protected override void SetNullArguments ()
|
||||
{
|
||||
expectedContext = null;
|
||||
}
|
||||
|
||||
protected override IAsyncResult GetAsyncResult (Func<Task> taskFactory, AsyncCallback callback, object state)
|
||||
{
|
||||
Assert.IsNull (handler, "GetAsyncResult#A01");
|
||||
|
||||
handler = new TestHttpTaskAsyncHandler (taskFactory, expectedContext);
|
||||
return handler.BeginProcessRequest (expectedContext, callback, state);
|
||||
}
|
||||
|
||||
protected override void Wait (IAsyncResult result)
|
||||
{
|
||||
Assert.IsNotNull (handler, "Wait#A01");
|
||||
|
||||
handler.EndProcessRequest (result);
|
||||
}
|
||||
|
||||
protected override void TestSetUp ()
|
||||
{
|
||||
base.TestSetUp ();
|
||||
|
||||
handler = null;
|
||||
|
||||
var request = new HttpRequest (string.Empty, "http://localhost/", string.Empty);
|
||||
var response = new HttpResponse (TextWriter.Null);
|
||||
expectedContext = new HttpContext (request, response);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsReusable ()
|
||||
{
|
||||
var handler = new DummyHttpTaskAsyncHandler ();
|
||||
Assert.IsFalse (handler.IsReusable, "#A01");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (NotSupportedException))]
|
||||
public void ProcessRequest ()
|
||||
{
|
||||
var handler = new DummyHttpTaskAsyncHandler ();
|
||||
handler.ProcessRequest (expectedContext);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (NotSupportedException))]
|
||||
public void ProcessRequest_NullContext ()
|
||||
{
|
||||
var handler = new DummyHttpTaskAsyncHandler ();
|
||||
handler.ProcessRequest (null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,334 +0,0 @@
|
||||
//
|
||||
// MonoTests.System.Web.TaskAsyncResultTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornel Pal ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Kornel Pal
|
||||
//
|
||||
// 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_4_5
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.Web
|
||||
{
|
||||
public abstract class TaskAsyncResultTest
|
||||
{
|
||||
sealed class TestException : Exception
|
||||
{
|
||||
public TestException ()
|
||||
: base ("Test exception")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
sealed class DummyAsyncResult : IAsyncResult
|
||||
{
|
||||
public object AsyncState {
|
||||
get { throw new AssertionException ("Should not be called."); }
|
||||
}
|
||||
|
||||
public WaitHandle AsyncWaitHandle {
|
||||
get { throw new AssertionException ("Should not be called."); }
|
||||
}
|
||||
|
||||
public bool CompletedSynchronously {
|
||||
get { throw new AssertionException ("Should not be called."); }
|
||||
}
|
||||
|
||||
public bool IsCompleted {
|
||||
get { throw new AssertionException ("Should not be called."); }
|
||||
}
|
||||
}
|
||||
|
||||
int testThreadId;
|
||||
int factoryCount;
|
||||
int callbackCount;
|
||||
object expectedState;
|
||||
Exception expectedException;
|
||||
TaskCompletionSource<object> taskCompletion;
|
||||
TaskCompletionSource<object> callbackCompletion;
|
||||
IAsyncResult taskAsyncResult;
|
||||
|
||||
static Task NullTaskFatory ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
static Task CompletedTaskFatory ()
|
||||
{
|
||||
return Task.FromResult<object> (null);
|
||||
}
|
||||
|
||||
static Task FailingTaskFatory ()
|
||||
{
|
||||
throw new TestException ();
|
||||
}
|
||||
|
||||
void DummyCallback (IAsyncResult result)
|
||||
{
|
||||
Interlocked.Increment (ref callbackCount);
|
||||
|
||||
Assert.Fail ("Should not be called.");
|
||||
}
|
||||
|
||||
void FailingCallback (IAsyncResult result)
|
||||
{
|
||||
Interlocked.Increment (ref callbackCount);
|
||||
|
||||
throw new TestException ();
|
||||
}
|
||||
|
||||
protected abstract void SetNullArguments ();
|
||||
protected abstract IAsyncResult GetAsyncResult (Func<Task> taskFactory, AsyncCallback callback, object state);
|
||||
protected abstract void Wait (IAsyncResult result);
|
||||
|
||||
[SetUp]
|
||||
protected virtual void TestSetUp ()
|
||||
{
|
||||
testThreadId = Thread.CurrentThread.ManagedThreadId;
|
||||
factoryCount = 0;
|
||||
callbackCount = 0;
|
||||
expectedState = new object ();
|
||||
expectedException = null;
|
||||
taskCompletion = new TaskCompletionSource<object> ();
|
||||
callbackCompletion = new TaskCompletionSource<object> ();
|
||||
taskAsyncResult = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Invoke_NullArguments ()
|
||||
{
|
||||
SetNullArguments ();
|
||||
|
||||
IAsyncResult result = GetAsyncResult (CompletedTaskFatory, null, null);
|
||||
Wait (result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Invoke_NullTask ()
|
||||
{
|
||||
IAsyncResult result = GetAsyncResult (NullTaskFatory, DummyCallback, null);
|
||||
|
||||
Assert.AreEqual (0, callbackCount, "#A01");
|
||||
Assert.IsNull (result, "#A02");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (TestException))]
|
||||
public void Invoke_TaskFatoryException ()
|
||||
{
|
||||
try {
|
||||
GetAsyncResult (FailingTaskFatory, DummyCallback, expectedState);
|
||||
} finally {
|
||||
Assert.AreEqual (0, callbackCount, "#A01");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (TestException))]
|
||||
public void Invoke_CallbackException ()
|
||||
{
|
||||
try {
|
||||
GetAsyncResult (CompletedTaskFatory, FailingCallback, expectedState);
|
||||
} finally {
|
||||
Assert.AreEqual (1, callbackCount, "#A01");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void Invoke_NullResult ()
|
||||
{
|
||||
GetAsyncResult (NullTaskFatory, DummyCallback, null);
|
||||
Wait (null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void Invoke_InvalidResult ()
|
||||
{
|
||||
GetAsyncResult (NullTaskFatory, DummyCallback, null);
|
||||
Wait (new DummyAsyncResult ());
|
||||
}
|
||||
|
||||
void SetTaskResult ()
|
||||
{
|
||||
if (expectedException == null)
|
||||
taskCompletion.SetResult (null);
|
||||
else
|
||||
taskCompletion.SetException (expectedException);
|
||||
}
|
||||
|
||||
void WaitTaskResult ()
|
||||
{
|
||||
if (expectedException == null) {
|
||||
Wait (taskAsyncResult);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Wait (taskAsyncResult);
|
||||
|
||||
Assert.Fail ("Expected exception was not thrown.");
|
||||
} catch (AssertionException) {
|
||||
throw;
|
||||
} catch (Exception ex) {
|
||||
Assert.AreSame (expectedException, ex, "WaitTaskResult#A01");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InvokeSync ()
|
||||
{
|
||||
InvokeSyncCore ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InvokeSync_Failed ()
|
||||
{
|
||||
expectedException = new TestException ();
|
||||
|
||||
InvokeSyncCore ();
|
||||
}
|
||||
|
||||
void InvokeSyncCore ()
|
||||
{
|
||||
IAsyncResult result = GetAsyncResult (SyncTaskFatory, SyncCallback, expectedState);
|
||||
|
||||
Assert.IsNotNull (result, "InvokeSyncCore#A01");
|
||||
Assert.AreSame (taskAsyncResult, result, "InvokeSyncCore#A02");
|
||||
|
||||
WaitTaskResult ();
|
||||
|
||||
Assert.AreEqual (1, factoryCount, "InvokeSyncCore#A03");
|
||||
Assert.AreEqual (1, callbackCount, "InvokeSyncCore#A04");
|
||||
}
|
||||
|
||||
Task SyncTaskFatory ()
|
||||
{
|
||||
Interlocked.Increment (ref factoryCount);
|
||||
|
||||
Assert.AreEqual (testThreadId, Thread.CurrentThread.ManagedThreadId, "SyncTaskFatory#A01");
|
||||
|
||||
SetTaskResult ();
|
||||
|
||||
return taskCompletion.Task;
|
||||
}
|
||||
|
||||
void SyncCallback (IAsyncResult result)
|
||||
{
|
||||
Interlocked.Increment (ref callbackCount);
|
||||
|
||||
Assert.AreEqual (testThreadId, Thread.CurrentThread.ManagedThreadId, "SyncCallback#A01");
|
||||
|
||||
Assert.IsNotNull (result, "SyncCallback#A02");
|
||||
Assert.AreSame (expectedState, result.AsyncState, "SyncCallback#A03");
|
||||
Assert.IsTrue (result.IsCompleted, "SyncCallback#A04");
|
||||
Assert.IsTrue (result.CompletedSynchronously, "SyncCallback#A05");
|
||||
Assert.IsNotNull (result.AsyncWaitHandle, "SyncCallback#A06");
|
||||
Assert.IsTrue (result.AsyncWaitHandle.WaitOne (0), "SyncCallback#A07");
|
||||
|
||||
taskAsyncResult = result;
|
||||
|
||||
Assert.AreEqual (1, factoryCount, "SyncCallback#A08");
|
||||
Assert.AreEqual (1, callbackCount, "SyncCallback#A09");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InvokeAsync ()
|
||||
{
|
||||
InvokeAsyncCore ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InvokeAsync_Failed ()
|
||||
{
|
||||
expectedException = new TestException ();
|
||||
|
||||
InvokeAsyncCore ();
|
||||
}
|
||||
|
||||
void InvokeAsyncCore ()
|
||||
{
|
||||
IAsyncResult result = GetAsyncResult (AsyncTaskFatory, AsyncCallback, expectedState);
|
||||
|
||||
Assert.IsNotNull (result, "InvokeAsyncCore#A01");
|
||||
Assert.AreSame (expectedState, result.AsyncState, "InvokeAsyncCore#A02");
|
||||
Assert.IsFalse (result.IsCompleted, "InvokeAsyncCore#A03");
|
||||
Assert.IsFalse (result.CompletedSynchronously, "InvokeAsyncCore#A04");
|
||||
Assert.IsNotNull (result.AsyncWaitHandle, "InvokeAsyncCore#A05");
|
||||
Assert.IsFalse (result.AsyncWaitHandle.WaitOne (0), "InvokeAsyncCore#A06");
|
||||
|
||||
Assert.AreEqual (1, factoryCount, "InvokeAsyncCore#A07");
|
||||
Assert.AreEqual (0, callbackCount, "InvokeAsyncCore#A08");
|
||||
|
||||
taskAsyncResult = result;
|
||||
|
||||
SetTaskResult ();
|
||||
|
||||
callbackCompletion.Task.GetAwaiter ().GetResult ();
|
||||
|
||||
Assert.AreEqual (1, factoryCount, "InvokeAsyncCore#A09");
|
||||
Assert.AreEqual (1, callbackCount, "InvokeAsyncCore#A10");
|
||||
}
|
||||
|
||||
Task AsyncTaskFatory ()
|
||||
{
|
||||
Interlocked.Increment (ref factoryCount);
|
||||
|
||||
Assert.AreEqual (testThreadId, Thread.CurrentThread.ManagedThreadId, "AsyncTaskFatory#A01");
|
||||
|
||||
return taskCompletion.Task;
|
||||
}
|
||||
|
||||
void AsyncCallback (IAsyncResult result)
|
||||
{
|
||||
try {
|
||||
Interlocked.Increment (ref callbackCount);
|
||||
|
||||
Assert.AreNotEqual (testThreadId, Thread.CurrentThread.ManagedThreadId, "AsyncCallback#A01");
|
||||
|
||||
Assert.IsNotNull (result, "AsyncCallback#A02");
|
||||
Assert.AreSame (expectedState, result.AsyncState, "AsyncCallback#A03");
|
||||
Assert.IsTrue (result.IsCompleted, "AsyncCallback#A04");
|
||||
Assert.IsFalse (result.CompletedSynchronously, "AsyncCallback#A05");
|
||||
Assert.IsNotNull (result.AsyncWaitHandle, "AsyncCallback#A06");
|
||||
Assert.IsTrue (result.AsyncWaitHandle.WaitOne (0), "AsyncCallback#A07");
|
||||
|
||||
Assert.AreSame (taskAsyncResult, result, "AsyncCallback#A08");
|
||||
|
||||
WaitTaskResult ();
|
||||
|
||||
callbackCompletion.TrySetResult (null);
|
||||
} catch (Exception ex) {
|
||||
callbackCompletion.TrySetException (ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,12 +1,5 @@
|
||||
#include net_4_0_System.Web.dll.sources
|
||||
|
||||
System.Web/EventHandlerTaskAsyncHelper.cs
|
||||
System.Web/HttpTaskAsyncHandler.cs
|
||||
System.Web/MimeMapping.cs
|
||||
System.Web/ReadEntityBodyMode.cs
|
||||
System.Web/UnvalidatedRequestValues.cs
|
||||
System.Web/UnvalidatedRequestValuesBase.cs
|
||||
System.Web/UnvalidatedRequestValuesWrapper.cs
|
||||
System.Web/TaskAsyncResult.cs
|
||||
System.Web/TaskEventHandler.cs
|
||||
System.Web.Security/MembershipPasswordAttribute.cs
|
||||
|
||||
@@ -858,7 +858,20 @@ namespace System.Xml
|
||||
[PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
|
||||
public virtual XmlNode ReadNode (XmlReader reader)
|
||||
{
|
||||
return ReadNodeCore (reader);
|
||||
if (PreserveWhitespace)
|
||||
return ReadNodeCore (reader);
|
||||
XmlTextReader xtr = reader as XmlTextReader;
|
||||
if (xtr != null && xtr.WhitespaceHandling ==
|
||||
WhitespaceHandling.All) {
|
||||
try {
|
||||
xtr.WhitespaceHandling = WhitespaceHandling.Significant;
|
||||
return ReadNodeCore (reader);
|
||||
} finally {
|
||||
xtr.WhitespaceHandling = WhitespaceHandling.All;
|
||||
}
|
||||
}
|
||||
else
|
||||
return ReadNodeCore (reader);
|
||||
}
|
||||
|
||||
XmlNode ReadNodeCore (XmlReader reader)
|
||||
|
||||
@@ -152,17 +152,11 @@ namespace System.Xml
|
||||
XmlTextReader xmlReader = new XmlTextReader (value, XmlNodeType.Element, ctx);
|
||||
xmlReader.XmlResolver = OwnerDocument.Resolver;
|
||||
|
||||
bool pw = OwnerDocument.PreserveWhitespace;
|
||||
OwnerDocument.PreserveWhitespace = true;
|
||||
try {
|
||||
do {
|
||||
XmlNode n = OwnerDocument.ReadNode (xmlReader);
|
||||
if(n == null) break;
|
||||
AppendChild (n);
|
||||
} while (true);
|
||||
} finally {
|
||||
OwnerDocument.PreserveWhitespace = pw;
|
||||
}
|
||||
do {
|
||||
XmlNode n = OwnerDocument.ReadNode (xmlReader);
|
||||
if(n == null) break;
|
||||
AppendChild (n);
|
||||
} while (true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1433,43 +1433,5 @@ namespace MonoTests.System.Xml
|
||||
Assert.IsFalse (reader.ReadAttributeValue(), "#4");
|
||||
Assert.AreEqual (XmlNodeType.Text, reader.NodeType, "#5");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Whitespaces ()
|
||||
{
|
||||
const string xml = "<?xml version=\"1.0\"?><test> <foo name=\"Hello\"> <value>World</value> </foo> <foo name=\"Foo\"><value>Bar</value></foo></test>";
|
||||
var reader = new XmlTextReader (new StringReader (xml));
|
||||
//reader.WhitespaceHandling = WhitespaceHandling.All;
|
||||
|
||||
reader.Read ();
|
||||
Assert.AreEqual (XmlNodeType.XmlDeclaration, reader.NodeType, "#1a");
|
||||
reader.Read ();
|
||||
Assert.AreEqual (XmlNodeType.Element, reader.NodeType, "#1b");
|
||||
Assert.AreEqual ("test", reader.Name, "#1c");
|
||||
|
||||
reader.Read ();
|
||||
if (reader.NodeType == XmlNodeType.Whitespace)
|
||||
reader.Read ();
|
||||
|
||||
Assert.AreEqual (XmlNodeType.Element, reader.NodeType, "#2a");
|
||||
Assert.AreEqual ("foo", reader.Name, "#2b");
|
||||
|
||||
var doc = new XmlDocument ();
|
||||
//doc.PreserveWhitespace = true;
|
||||
doc.ReadNode (reader);
|
||||
|
||||
Assert.AreEqual (XmlNodeType.Whitespace, reader.NodeType, "#3");
|
||||
|
||||
reader.Read ();
|
||||
if (reader.NodeType == XmlNodeType.Whitespace)
|
||||
reader.Read ();
|
||||
|
||||
Assert.AreEqual (XmlNodeType.Element, reader.NodeType, "#4");
|
||||
Assert.AreEqual ("foo", reader.Name, "#4b");
|
||||
|
||||
doc.ReadNode (reader);
|
||||
|
||||
Assert.AreEqual (XmlNodeType.EndElement, reader.NodeType, "#5");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -346,21 +346,23 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
[Obsolete ("Use PagedMemorySize64")]
|
||||
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
|
||||
[MonitoringDescription ("The number of bytes that are paged.")]
|
||||
public int PagedMemorySize {
|
||||
get {
|
||||
return(int)PagedMemorySize64;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
[Obsolete ("Use PagedSystemMemorySize64")]
|
||||
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
|
||||
[MonitoringDescription ("The amount of paged system memory in bytes.")]
|
||||
public int PagedSystemMemorySize {
|
||||
get {
|
||||
return(int)PagedMemorySize64;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,22 +406,23 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
|
||||
[MonitoringDescription ("The number of bytes that are paged.")]
|
||||
[ComVisible (false)]
|
||||
public long PagedMemorySize64 {
|
||||
get {
|
||||
int error;
|
||||
return GetProcessData (pid, 12, out error);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
|
||||
[MonitoringDescription ("The amount of paged system memory in bytes.")]
|
||||
[ComVisible (false)]
|
||||
public long PagedSystemMemorySize64 {
|
||||
get {
|
||||
return PagedMemorySize64;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace System.Net.NetworkInformation {
|
||||
#else
|
||||
if (runningOnUnix) {
|
||||
try {
|
||||
if (Platform.IsMacOS || Platform.IsFreeBSD)
|
||||
if (Platform.IsMacOS)
|
||||
return MacOsNetworkInterface.ImplGetAllNetworkInterfaces ();
|
||||
else
|
||||
return LinuxNetworkInterface.ImplGetAllNetworkInterfaces ();
|
||||
|
||||
@@ -318,7 +318,7 @@ namespace System.Net.WebSockets
|
||||
var opCode = MessageTypeToWire (type);
|
||||
var length = buffer.Count;
|
||||
|
||||
headerBuffer[0] = (byte)(opCode | (endOfMessage ? 0x80 : 0));
|
||||
headerBuffer[0] = (byte)(opCode | (endOfMessage ? 0 : 0x80));
|
||||
if (length < 126) {
|
||||
headerBuffer[1] = (byte)length;
|
||||
} else if (length <= ushort.MaxValue) {
|
||||
|
||||
@@ -329,9 +329,6 @@ namespace System.Net {
|
||||
return false;
|
||||
if (InputStream.EndRead (ares) <= 0)
|
||||
return true;
|
||||
} catch (ObjectDisposedException e) {
|
||||
input_stream = null;
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -28,56 +28,36 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace System {
|
||||
internal static class Platform {
|
||||
static bool checkedOS;
|
||||
static bool isMacOS;
|
||||
static bool isFreeBSD;
|
||||
|
||||
#if MONOTOUCH || XAMMAC
|
||||
private static void CheckOS() {
|
||||
isMacOS = true;
|
||||
checkedOS = true;
|
||||
public static bool IsMacOS {
|
||||
get { return true; }
|
||||
}
|
||||
#else
|
||||
[DllImport ("libc")]
|
||||
static extern int uname (IntPtr buf);
|
||||
|
||||
private static void CheckOS() {
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix) {
|
||||
checkedOS = true;
|
||||
return;
|
||||
}
|
||||
|
||||
IntPtr buf = Marshal.AllocHGlobal (8192);
|
||||
if (uname (buf) == 0) {
|
||||
string os = Marshal.PtrToStringAnsi (buf);
|
||||
switch (os) {
|
||||
case "Darwin":
|
||||
isMacOS = true;
|
||||
break;
|
||||
case "FreeBSD":
|
||||
isFreeBSD = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Marshal.FreeHGlobal (buf);
|
||||
checkedOS = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static bool checkedIsMacOS;
|
||||
static bool isMacOS;
|
||||
|
||||
public static bool IsMacOS {
|
||||
get {
|
||||
if (!checkedOS)
|
||||
CheckOS();
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
return false;
|
||||
|
||||
if (!checkedIsMacOS) {
|
||||
IntPtr buf = Marshal.AllocHGlobal (8192);
|
||||
if (uname (buf) == 0) {
|
||||
string os = Marshal.PtrToStringAnsi (buf);
|
||||
if (os == "Darwin")
|
||||
isMacOS = true;
|
||||
}
|
||||
Marshal.FreeHGlobal (buf);
|
||||
checkedIsMacOS = true;
|
||||
}
|
||||
|
||||
return isMacOS;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsFreeBSD {
|
||||
get {
|
||||
if (!checkedOS)
|
||||
CheckOS();
|
||||
return isFreeBSD;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -269,6 +269,15 @@ namespace System {
|
||||
return state.remaining.Length > 0;
|
||||
}
|
||||
|
||||
if (state.elements.scheme == Uri.UriSchemeFile) {
|
||||
// under Windows all file:// URI are considered UNC, which is not the case other MacOS (e.g. Silverlight)
|
||||
#if BOOTSTRAP_BASIC
|
||||
state.elements.isUnc = (Path.DirectorySeparatorChar == '\\');
|
||||
#else
|
||||
state.elements.isUnc = Environment.IsRunningOnWindows;
|
||||
#endif
|
||||
}
|
||||
|
||||
return ParseDelimiter (state);
|
||||
}
|
||||
|
||||
@@ -421,17 +430,7 @@ namespace System {
|
||||
state.elements.host = state.elements.host.ToLowerInvariant ();
|
||||
|
||||
state.remaining = part.Substring (state.elements.host.Length);
|
||||
|
||||
if (state.elements.scheme == Uri.UriSchemeFile &&
|
||||
state.elements.host != "") {
|
||||
// under Windows all file://host URI are considered UNC, which is not the case other MacOS (e.g. Silverlight)
|
||||
#if BOOTSTRAP_BASIC
|
||||
state.elements.isUnc = (Path.DirectorySeparatorChar == '\\');
|
||||
#else
|
||||
state.elements.isUnc = Environment.IsRunningOnWindows;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
return state.remaining.Length > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -220,45 +220,6 @@ namespace MonoTests.System.Net.WebSockets
|
||||
Assert.Fail ("Should have thrown");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")] // FIXME: test relies on unimplemented HttpListenerContext.AcceptWebSocketAsync (), reenable it when the method is implemented
|
||||
public void SendAsyncEndOfMessageTest ()
|
||||
{
|
||||
var cancellationToken = new CancellationTokenSource (TimeSpan.FromSeconds (30)).Token;
|
||||
SendAsyncEndOfMessageTest (false, WebSocketMessageType.Text, cancellationToken).Wait (5000);
|
||||
SendAsyncEndOfMessageTest (true, WebSocketMessageType.Text, cancellationToken).Wait (5000);
|
||||
SendAsyncEndOfMessageTest (false, WebSocketMessageType.Binary, cancellationToken).Wait (5000);
|
||||
SendAsyncEndOfMessageTest (true, WebSocketMessageType.Binary, cancellationToken).Wait (5000);
|
||||
}
|
||||
|
||||
public async Task SendAsyncEndOfMessageTest (bool expectedEndOfMessage, WebSocketMessageType webSocketMessageType, CancellationToken cancellationToken)
|
||||
{
|
||||
using (var client = new ClientWebSocket ()) {
|
||||
// Configure the listener.
|
||||
var serverReceive = HandleHttpWebSocketRequestAsync<WebSocketReceiveResult> (async socket => await socket.ReceiveAsync (new ArraySegment<byte> (new byte[32]), cancellationToken), cancellationToken);
|
||||
|
||||
// Connect to the listener and make the request.
|
||||
await client.ConnectAsync (new Uri ("ws://localhost:" + Port + "/"), cancellationToken);
|
||||
await client.SendAsync (new ArraySegment<byte> (Encoding.UTF8.GetBytes ("test")), webSocketMessageType, expectedEndOfMessage, cancellationToken);
|
||||
|
||||
// Wait for the listener to handle the request and return its result.
|
||||
var result = await serverReceive;
|
||||
|
||||
// Cleanup and check results.
|
||||
await client.CloseAsync (WebSocketCloseStatus.NormalClosure, "Finished", cancellationToken);
|
||||
Assert.AreEqual (expectedEndOfMessage, result.EndOfMessage, "EndOfMessage should be " + expectedEndOfMessage);
|
||||
}
|
||||
}
|
||||
|
||||
async Task<T> HandleHttpWebSocketRequestAsync<T> (Func<WebSocket, Task<T>> action, CancellationToken cancellationToken)
|
||||
{
|
||||
var ctx = await this.listener.GetContextAsync ();
|
||||
var wsContext = await ctx.AcceptWebSocketAsync (null);
|
||||
var result = await action (wsContext.WebSocket);
|
||||
await wsContext.WebSocket.CloseOutputAsync (WebSocketCloseStatus.NormalClosure, "Finished", cancellationToken);
|
||||
return result;
|
||||
}
|
||||
|
||||
async Task HandleHttpRequestAsync (Action<HttpListenerRequest, HttpListenerResponse> handler)
|
||||
{
|
||||
var ctx = await listener.GetContextAsync ();
|
||||
|
||||
@@ -474,57 +474,6 @@ namespace MonoTests.System.Net {
|
||||
Event.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ConnectionReuse ()
|
||||
{
|
||||
var uri = "http://localhost:1338/";
|
||||
|
||||
HttpListener listener = new HttpListener ();
|
||||
listener.Prefixes.Add (uri);
|
||||
listener.Start ();
|
||||
|
||||
IPEndPoint expectedIpEndPoint = CreateListenerRequest (listener, uri);
|
||||
|
||||
Assert.AreEqual (expectedIpEndPoint, CreateListenerRequest (listener, uri), "reuse1");
|
||||
Assert.AreEqual (expectedIpEndPoint, CreateListenerRequest (listener, uri), "reuse2");
|
||||
}
|
||||
|
||||
public IPEndPoint CreateListenerRequest (HttpListener listener, string uri)
|
||||
{
|
||||
IPEndPoint ipEndPoint = null;
|
||||
listener.BeginGetContext ((result) => ipEndPoint = ListenerCallback (result), listener);
|
||||
|
||||
var request = (HttpWebRequest) WebRequest.Create (uri);
|
||||
request.Method = "POST";
|
||||
|
||||
// We need to write something
|
||||
request.GetRequestStream ().Write (new byte [] {(byte)'a'}, 0, 1);
|
||||
request.GetRequestStream ().Dispose ();
|
||||
|
||||
// Send request, socket is created or reused.
|
||||
var response = request.GetResponse ();
|
||||
|
||||
// Close response so socket can be reused.
|
||||
response.Close ();
|
||||
|
||||
return ipEndPoint;
|
||||
}
|
||||
|
||||
public static IPEndPoint ListenerCallback (IAsyncResult result)
|
||||
{
|
||||
var listener = (HttpListener) result.AsyncState;
|
||||
var context = listener.EndGetContext (result);
|
||||
var clientEndPoint = context.Request.RemoteEndPoint;
|
||||
|
||||
// Disposing InputStream should not avoid socket reuse
|
||||
context.Request.InputStream.Dispose ();
|
||||
|
||||
// Close OutputStream to send response
|
||||
context.Response.OutputStream.Close ();
|
||||
|
||||
return clientEndPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -919,102 +919,6 @@ TextWriter sw = Console.Out;
|
||||
Assert.AreEqual ("/%3C%3E%25%22%7B%7D%7C/%5E%60;/:@&=+$,%5B%5D%3F", uri.AbsolutePath, "Special");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LocalFile ()
|
||||
{
|
||||
Uri uri = new Uri ("file:///c:/subdir/file");
|
||||
|
||||
Assert.AreEqual ("c:/subdir/file", uri.AbsolutePath, "AbsolutePath");
|
||||
Assert.AreEqual ("file:///c:/subdir/file", uri.AbsoluteUri, "AbsoluteUri");
|
||||
Assert.AreEqual ("c:\\subdir\\file", uri.LocalPath, "LocalPath");
|
||||
Assert.AreEqual ("c:/subdir/file", uri.PathAndQuery, "PathAndQuery");
|
||||
Assert.AreEqual (String.Empty, uri.Query, "Query");
|
||||
Assert.AreEqual ("file", uri.Segments [3], "Segments [3]");
|
||||
|
||||
Assert.AreEqual (String.Empty, uri.Authority, "Authority");
|
||||
Assert.AreEqual (String.Empty, uri.DnsSafeHost, "DnsSafeHost");
|
||||
Assert.AreEqual (String.Empty, uri.Fragment, "Fragment");
|
||||
Assert.AreEqual (String.Empty, uri.Host, "Host");
|
||||
Assert.AreEqual (UriHostNameType.Basic, uri.HostNameType, "HostNameType");
|
||||
Assert.IsTrue (uri.IsAbsoluteUri, "IsAbsoluteUri");
|
||||
Assert.IsTrue (uri.IsDefaultPort, "IsDefaultPort");
|
||||
Assert.IsTrue (uri.IsFile, "IsFile");
|
||||
Assert.IsTrue (uri.IsLoopback, "IsLoopback");
|
||||
Assert.IsFalse (uri.IsUnc, "IsUnc");
|
||||
Assert.AreEqual ("file:///c:/subdir/file", uri.OriginalString, "OriginalString");
|
||||
Assert.AreEqual (-1, uri.Port, "Port");
|
||||
Assert.AreEqual ("file", uri.Scheme, "Scheme");
|
||||
Assert.AreEqual ("/", uri.Segments [0], "Segments [0]");
|
||||
Assert.AreEqual ("c:/", uri.Segments [1], "Segments [1]");
|
||||
Assert.AreEqual ("subdir/", uri.Segments [2], "Segments [2]");
|
||||
Assert.IsFalse (uri.UserEscaped, "UserEscaped");
|
||||
Assert.AreEqual (String.Empty, uri.UserInfo, "UserInfo");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LocalhostWinFile ()
|
||||
{
|
||||
Uri uri = new Uri ("file://localhost/c:/subdir/file");
|
||||
|
||||
Assert.AreEqual ("/c:/subdir/file", uri.AbsolutePath, "AbsolutePath");
|
||||
Assert.AreEqual ("file://localhost/c:/subdir/file", uri.AbsoluteUri, "AbsoluteUri");
|
||||
Assert.AreEqual (isWin32 ? "\\\\localhost\\c:\\subdir\\file" : "/c:/subdir/file", uri.LocalPath, "LocalPath");
|
||||
Assert.AreEqual ("/c:/subdir/file", uri.PathAndQuery, "PathAndQuery");
|
||||
Assert.AreEqual (String.Empty, uri.Query, "Query");
|
||||
Assert.AreEqual ("file", uri.Segments [3], "Segments [3]");
|
||||
|
||||
Assert.AreEqual ("localhost", uri.Authority, "Authority");
|
||||
Assert.AreEqual ("localhost", uri.DnsSafeHost, "DnsSafeHost");
|
||||
Assert.AreEqual (String.Empty, uri.Fragment, "Fragment");
|
||||
Assert.AreEqual ("localhost", uri.Host, "Host");
|
||||
Assert.AreEqual (UriHostNameType.Dns, uri.HostNameType, "HostNameType");
|
||||
Assert.IsTrue (uri.IsAbsoluteUri, "IsAbsoluteUri");
|
||||
Assert.IsTrue (uri.IsDefaultPort, "IsDefaultPort");
|
||||
Assert.IsTrue (uri.IsFile, "IsFile");
|
||||
Assert.IsTrue (uri.IsLoopback, "IsLoopback");
|
||||
Assert.AreEqual (isWin32, uri.IsUnc, "IsUnc");
|
||||
Assert.AreEqual ("file://localhost/c:/subdir/file", uri.OriginalString, "OriginalString");
|
||||
Assert.AreEqual (-1, uri.Port, "Port");
|
||||
Assert.AreEqual ("file", uri.Scheme, "Scheme");
|
||||
Assert.AreEqual ("/", uri.Segments [0], "Segments [0]");
|
||||
Assert.AreEqual ("c:/", uri.Segments [1], "Segments [1]");
|
||||
Assert.AreEqual ("subdir/", uri.Segments [2], "Segments [2]");
|
||||
Assert.IsFalse (uri.UserEscaped, "UserEscaped");
|
||||
Assert.AreEqual (String.Empty, uri.UserInfo, "UserInfo");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LocalhostFile ()
|
||||
{
|
||||
Uri uri = new Uri ("file://localhost/dir/subdir/file");
|
||||
|
||||
Assert.AreEqual ("/dir/subdir/file", uri.AbsolutePath, "AbsolutePath");
|
||||
Assert.AreEqual ("file://localhost/dir/subdir/file", uri.AbsoluteUri, "AbsoluteUri");
|
||||
Assert.AreEqual (isWin32 ? "\\\\localhost\\dir\\subdir\\file" : "/dir/subdir/file", uri.LocalPath, "LocalPath");
|
||||
Assert.AreEqual ("/dir/subdir/file", uri.PathAndQuery, "PathAndQuery");
|
||||
Assert.AreEqual (String.Empty, uri.Query, "Query");
|
||||
Assert.AreEqual ("file", uri.Segments [3], "Segments [3]");
|
||||
|
||||
Assert.AreEqual ("localhost", uri.Authority, "Authority");
|
||||
Assert.AreEqual ("localhost", uri.DnsSafeHost, "DnsSafeHost");
|
||||
Assert.AreEqual (String.Empty, uri.Fragment, "Fragment");
|
||||
Assert.AreEqual ("localhost", uri.Host, "Host");
|
||||
Assert.AreEqual (UriHostNameType.Dns, uri.HostNameType, "HostNameType");
|
||||
Assert.IsTrue (uri.IsAbsoluteUri, "IsAbsoluteUri");
|
||||
Assert.IsTrue (uri.IsDefaultPort, "IsDefaultPort");
|
||||
Assert.IsTrue (uri.IsFile, "IsFile");
|
||||
Assert.IsTrue (uri.IsLoopback, "IsLoopback");
|
||||
Assert.AreEqual (isWin32, uri.IsUnc, "IsUnc");
|
||||
Assert.AreEqual ("file://localhost/dir/subdir/file", uri.OriginalString, "OriginalString");
|
||||
Assert.AreEqual (-1, uri.Port, "Port");
|
||||
Assert.AreEqual ("file", uri.Scheme, "Scheme");
|
||||
Assert.AreEqual ("/", uri.Segments [0], "Segments [0]");
|
||||
Assert.AreEqual ("dir/", uri.Segments [1], "Segments [1]");
|
||||
Assert.AreEqual ("subdir/", uri.Segments [2], "Segments [2]");
|
||||
Assert.IsFalse (uri.UserEscaped, "UserEscaped");
|
||||
Assert.AreEqual (String.Empty, uri.UserInfo, "UserInfo");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PathReduction_2e ()
|
||||
{
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
CSHARP=$SCRIPT_PATH/../lib/net_4_5/csharp.exe
|
||||
MONO=$SCRIPT_PATH/../../../mono/mini/mono
|
||||
|
||||
export MONO_PATH=${MONO_PATH:-$SCRIPT_PATH/../lib/net_4_5}
|
||||
export MONO_PATH=${MONO_PATH:-$SCRIPT_PATH/../lib/net_4_5/}
|
||||
|
||||
TZ_FAILS=0
|
||||
TZ_COUNT=0
|
||||
@@ -13,7 +10,7 @@ FORMAT="%a %b %d %T %Y"
|
||||
for tz in $(cd /usr/share/zoneinfo/; find * -type f -print); do
|
||||
TZ_COUNT=$(expr $TZ_COUNT + 1)
|
||||
SYS_DATETIME=$(date -ju -f "$FORMAT" "$(TZ=$tz date "+$FORMAT")" "+%s")
|
||||
CS_DATETIME=$(TZ=$tz $MONO $CSHARP -e '(int)(DateTime.Now - new DateTime(1970, 1, 1)).TotalSeconds;')
|
||||
CS_DATETIME=$(TZ=$tz csharp -e '(int)(DateTime.Now - new DateTime(1970, 1, 1)).TotalSeconds;')
|
||||
DIFF=$(expr $SYS_DATETIME - $CS_DATETIME)
|
||||
if [ "$DIFF" -gt "5" ] || [ "$DIFF" -lt "-5" ]; then
|
||||
TZ_FAILS=$(expr $TZ_FAILS + 1)
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace System.Collections.Concurrent
|
||||
{
|
||||
Node node = new Node ();
|
||||
node.Value = item;
|
||||
|
||||
|
||||
Node oldTail = null;
|
||||
Node oldNext = null;
|
||||
|
||||
@@ -71,8 +71,6 @@ namespace System.Collections.Concurrent
|
||||
while (!update) {
|
||||
oldTail = tail;
|
||||
oldNext = oldTail.Next;
|
||||
|
||||
Thread.MemoryBarrier ();
|
||||
|
||||
// Did tail was already updated ?
|
||||
if (tail == oldTail) {
|
||||
@@ -106,8 +104,6 @@ namespace System.Collections.Concurrent
|
||||
Node oldHead = head;
|
||||
Node oldTail = tail;
|
||||
oldNext = oldHead.Next;
|
||||
|
||||
Thread.MemoryBarrier ();
|
||||
|
||||
if (oldHead == head) {
|
||||
// Empty case ?
|
||||
@@ -150,8 +146,6 @@ namespace System.Collections.Concurrent
|
||||
}
|
||||
|
||||
result = oldNext.Value;
|
||||
|
||||
Thread.MemoryBarrier ();
|
||||
|
||||
//check if head has been updated
|
||||
update = head != oldHead;
|
||||
|
||||
@@ -670,7 +670,7 @@ namespace System.Globalization
|
||||
//
|
||||
// Be careful not to cause recursive CultureInfo initialization
|
||||
//
|
||||
var msg = string.Format (InvariantCulture, "Culture ID {0} (0x{1}) is not a supported culture.", culture.ToString (InvariantCulture), culture.ToString ("X4", InvariantCulture));
|
||||
var msg = string.Format (InvariantCulture, "Culture ID {0} (0x{0:X4}) is not a supported culture.", culture.ToString (InvariantCulture));
|
||||
#if NET_4_0
|
||||
throw new CultureNotFoundException ("culture", msg);
|
||||
#else
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
// IErrorInfo interface
|
||||
//
|
||||
// Eberhard Beilharz ([email protected])
|
||||
//
|
||||
// Copyright (C) 2011 SIL International
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security;
|
||||
|
||||
namespace System.Runtime.InteropServices
|
||||
{
|
||||
[ComImport]
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[Guid ("1CF2B120-547D-101B-8E65-08002B2BD119")]
|
||||
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IErrorInfo
|
||||
{
|
||||
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
int GetGUID (out Guid pGuid);
|
||||
|
||||
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
int GetSource ([MarshalAs (UnmanagedType.BStr)] out string pBstrSource);
|
||||
|
||||
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
int GetDescription ([MarshalAs (UnmanagedType.BStr)] out string pbstrDescription);
|
||||
|
||||
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
int GetHelpFile ([MarshalAs (UnmanagedType.BStr)] out string pBstrHelpFile);
|
||||
|
||||
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
int GetHelpContext (out uint pdwHelpContext);
|
||||
}
|
||||
}
|
||||
Loaded 100 of 335 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user