mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 11:21:08 -10:00
Compare commits
169
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18ef7d9a0b | ||
|
|
619f48b58b | ||
|
|
65afb9f640 | ||
|
|
35043d00e4 | ||
|
|
f4d981cf03 | ||
|
|
fcdc920ddc | ||
|
|
78ca023824 | ||
|
|
2026a0b408 | ||
|
|
ed2eeebef1 | ||
|
|
17fda960fe | ||
|
|
b473fbf965 | ||
|
|
9f44a62acf | ||
|
|
19f5183be3 | ||
|
|
7f965e8220 | ||
|
|
e34fe7182c | ||
|
|
21cd9994e7 | ||
|
|
d220cbd99b | ||
|
|
8c6f3ca593 | ||
|
|
664c608478 | ||
|
|
ba95f00ec5 | ||
|
|
3cde89c4da | ||
|
|
5905ff2618 | ||
|
|
90e2692d69 | ||
|
|
1fb554d7ed | ||
|
|
a02ad3af61 | ||
|
|
8205e22ba8 | ||
|
|
198028586b | ||
|
|
024241f424 | ||
|
|
d979cff046 | ||
|
|
f1cfd85041 | ||
|
|
f774f96e05 | ||
|
|
c4a03267f4 | ||
|
|
f48bb4bfb5 | ||
|
|
b564c16226 | ||
|
|
9b0491d2b3 | ||
|
|
b5a3a169df | ||
|
|
c0a692eb5c | ||
|
|
fbb984af9b | ||
|
|
bf3cd4557d | ||
|
|
f0298e5a2c | ||
|
|
6f89034001 | ||
|
|
82822106d8 | ||
|
|
2612ccb64d | ||
|
|
40dffe542e | ||
|
|
bf6cd183cc | ||
|
|
b248963021 | ||
|
|
2b81318351 | ||
|
|
730b4c7fde | ||
|
|
162dd58515 | ||
|
|
44b9eff431 | ||
|
|
01603cf37b | ||
|
|
627772db1c | ||
|
|
736c747fdf | ||
|
|
7a150f7c84 | ||
|
|
a900ef987b | ||
|
|
cc10f1a009 | ||
|
|
9dd8285992 | ||
|
|
0df254ddae | ||
|
|
272336b6a3 | ||
|
|
20d7b6a558 | ||
|
|
02f59bac0c | ||
|
|
b11dfd2aff | ||
|
|
f379b7df51 | ||
|
|
3e9f79184b | ||
|
|
84c32c0c67 | ||
|
|
eb89783365 | ||
|
|
b25f5d16ce | ||
|
|
053f1415ba | ||
|
|
fd213a6d19 | ||
|
|
6e927b4ce3 | ||
|
|
77fa9812f0 | ||
|
|
db654d24db | ||
|
|
db847470a0 | ||
|
|
1f3421e78d | ||
|
|
04ac046007 | ||
|
|
98f0a7b39a | ||
|
|
6723b79e3c | ||
|
|
03f2ff096a | ||
|
|
6e819dea67 | ||
|
|
cec0f68cb8 | ||
|
|
b6a4dad872 | ||
|
|
373031252e | ||
|
|
5defe6f35c | ||
|
|
ef9543e288 | ||
|
|
5260e942a3 | ||
|
|
8d19114895 | ||
|
|
dc60579386 | ||
|
|
dc89b23ded | ||
|
|
dc3a252a52 | ||
|
|
0fce7d666b | ||
|
|
0884bca59e | ||
|
|
a201572042 | ||
|
|
fad223adb8 | ||
|
|
382dd87b48 | ||
|
|
b700aeb026 | ||
|
|
3aa52dca53 | ||
|
|
f9eae9f4bc | ||
|
|
50343d3d2e | ||
|
|
2d707b5dc1 | ||
|
|
216b11bd8d | ||
|
|
091f2cade1 | ||
|
|
edf70859d7 | ||
|
|
35a840a78c | ||
|
|
2a3ec28bff | ||
|
|
f87e37159d | ||
|
|
822ee730f3 | ||
|
|
1585459e2e | ||
|
|
89baf6d449 | ||
|
|
37bae7f34a | ||
|
|
47cc449895 | ||
|
|
ae0dad98ae | ||
|
|
87e93a0d58 | ||
|
|
b44b21ccf9 | ||
|
|
a727206659 | ||
|
|
c90e3b760f | ||
|
|
19ef659344 | ||
|
|
2ea7decb7b | ||
|
|
08198a547b | ||
|
|
76078f9670 | ||
|
|
bf134e25ff | ||
|
|
af3310bbd3 | ||
|
|
ccbe5f6a68 | ||
|
|
ad8807f137 | ||
|
|
d80a218532 | ||
|
|
adef97107b | ||
|
|
6ed62014fd | ||
|
|
79e6db69e0 | ||
|
|
80efb7ab7a | ||
|
|
3e2a9e30af | ||
|
|
d1d6b05324 | ||
|
|
292ee11f1f | ||
|
|
027c82b32c | ||
|
|
a356639122 | ||
|
|
f06366e31d | ||
|
|
18668a1fa4 | ||
|
|
c3145582fc | ||
|
|
ec5ef1e9c2 | ||
|
|
14f32d68f1 | ||
|
|
1cd2c3fa5a | ||
|
|
20482680ae | ||
|
|
09c26bf8c7 | ||
|
|
ebc5130e31 | ||
|
|
ed3e121299 | ||
|
|
46f7140123 | ||
|
|
a49236e879 | ||
|
|
e4426cbcdb | ||
|
|
59b84d7a76 | ||
|
|
572ab4dcbb | ||
|
|
bd5b3ca14b | ||
|
|
74de7595ac | ||
|
|
bd4c8b9074 | ||
|
|
9186521479 | ||
|
|
fded4957dd | ||
|
|
e0b65ae93d | ||
|
|
f85fd107c7 | ||
|
|
61c088a932 | ||
|
|
37ad1431c9 | ||
|
|
88fce13184 | ||
|
|
4e0ae8c578 | ||
|
|
5499b3ecc6 | ||
|
|
6f92ae31be | ||
|
|
92a593c17d | ||
|
|
8bb9bb703b | ||
|
|
39389be976 | ||
|
|
6f50c368f1 | ||
|
|
9d96fb5a76 | ||
|
|
1a77ad3fa7 | ||
|
|
1ba53e055a | ||
|
|
83e015740a |
No files matched your search
@@ -750,6 +750,8 @@ mono_thread_current
|
||||
mono_thread_detach
|
||||
mono_thread_exit
|
||||
mono_thread_get_main
|
||||
mono_thread_get_managed_id
|
||||
mono_thread_get_name_utf8
|
||||
mono_thread_get_undeniable_exception
|
||||
mono_thread_hazardous_free_or_queue
|
||||
mono_thread_hazardous_try_free_all
|
||||
|
||||
Vendored
+1
-1
Submodule external/binary-reference-assemblies updated: f4f5f2f4cd...fcb3074202.
Vendored
+1
-1
Submodule external/referencesource updated: e12162bb0f...b945d0b0a8.
-436
@@ -1,436 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
# Copyright 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <[email protected]>.
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
# `libtool' can also be set to `yes' or `no'.
|
||||
|
||||
if test -z "$depfile"; then
|
||||
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
|
||||
dir=`echo "$object" | sed 's,/.*$,/,'`
|
||||
if test "$dir" = "$object"; then
|
||||
dir=
|
||||
fi
|
||||
# FIXME: should be _deps on DOS.
|
||||
depfile="$dir.deps/$base"
|
||||
fi
|
||||
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> $depfile
|
||||
echo >> $depfile
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> $depfile
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. This file always lives in the current directory.
|
||||
# Also, the AIX compiler puts `$object:' at the start of each line;
|
||||
# $object doesn't have directory information.
|
||||
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
|
||||
tmpdepfile="$stripped.u"
|
||||
outname="$stripped.o"
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
"$@" -M
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
|
||||
base=`echo "$object" | sed -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
tmpdepfile1="$base.o.d"
|
||||
tmpdepfile2="$base.d"
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile1"; then
|
||||
tmpdepfile="$tmpdepfile1"
|
||||
else
|
||||
tmpdepfile="$tmpdepfile2"
|
||||
fi
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a space and a tab in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
( IFS=" "
|
||||
case " $* " in
|
||||
*" --mode=compile "*) # this is libtool, let us make it quiet
|
||||
for arg
|
||||
do # cycle over the arguments
|
||||
case "$arg" in
|
||||
"--mode=compile")
|
||||
# insert --quiet before "--mode=compile"
|
||||
set fnord "$@" --quiet
|
||||
shift # fnord
|
||||
;;
|
||||
esac
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # "$arg"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
"$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
# X makedepend
|
||||
(
|
||||
shift
|
||||
cleared=no
|
||||
for arg in "$@"; do
|
||||
case $cleared in no)
|
||||
set ""; shift
|
||||
cleared=yes
|
||||
esac
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift;;
|
||||
-*)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift;;
|
||||
esac
|
||||
done
|
||||
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
( IFS=" "
|
||||
case " $* " in
|
||||
*" --mode=compile "*)
|
||||
for arg
|
||||
do # cycle over the arguments
|
||||
case $arg in
|
||||
"--mode=compile")
|
||||
# insert --quiet before "--mode=compile"
|
||||
set fnord "$@" --quiet
|
||||
shift # fnord
|
||||
;;
|
||||
esac
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # "$arg"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
"$@" -E |
|
||||
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
( IFS=" "
|
||||
case " $* " in
|
||||
*" --mode=compile "*)
|
||||
for arg
|
||||
do # cycle over the arguments
|
||||
case $arg in
|
||||
"--mode=compile")
|
||||
# insert --quiet before "--mode=compile"
|
||||
set fnord "$@" --quiet
|
||||
shift # fnord
|
||||
;;
|
||||
esac
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # "$arg"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||
) &
|
||||
proc=$!
|
||||
"$@"
|
||||
stat=$?
|
||||
wait "$proc"
|
||||
if test "$stat" != 0; then exit $stat; fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
-336
@@ -1,336 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <[email protected]>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case "$1" in
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing 0.4 - GNU automake"
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aclocal*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case "$f" in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1Help2man' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
|
||||
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f y.tab.h ]; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if [ ! -f y.tab.c ]; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f lex.yy.c ]; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
|
||||
fi
|
||||
if [ -f "$file" ]; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
|
||||
# We have makeinfo, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||
fi
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar)
|
||||
shift
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar ${1+"$@"} && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar ${1+"$@"} && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case "$firstarg" in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" ${1+"$@"} && exit 0
|
||||
;;
|
||||
esac
|
||||
case "$firstarg" in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" ${1+"$@"} && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequirements for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
+3
-1
@@ -889,7 +889,9 @@ environment variable to limit the extent of the messages you get:
|
||||
If set, the log mask is changed to the set value. Possible values are
|
||||
"asm" (assembly loader), "type", "dll" (native library loader), "gc"
|
||||
(garbage collector), "cfg" (config file loader), "aot" (precompiler),
|
||||
"security" (e.g. Moonlight CoreCLR support) and "all".
|
||||
"security" (e.g. Moonlight CoreCLR support), "threadpool" (thread pool generic),
|
||||
"io-threadpool" (thread pool I/O), "io-layer" (I/O layer - sockets, handles, shared memory etc)
|
||||
and "all".
|
||||
The default value is "all". Changing the mask value allows you to display only
|
||||
messages for a certain component. You can use multiple masks by comma
|
||||
separating them. For example to see config file messages and assembly loader
|
||||
|
||||
@@ -44,17 +44,21 @@ static class Consts
|
||||
public const string FxVersion = "2.0.5.0";
|
||||
public const string VsVersion = "9.0.0.0"; // unused, but needed for compilation
|
||||
public const string FxFileVersion = "4.0.50524.0";
|
||||
public const string EnvironmentVersion = FxFileVersion;
|
||||
|
||||
public const string VsFileVersion = "9.0.50727.42"; // unused, but needed for compilation
|
||||
#elif NET_4_6
|
||||
public const string FxVersion = "4.0.0.0";
|
||||
public const string FxFileVersion = "4.6.57.0";
|
||||
|
||||
public const string EnvironmentVersion = "4.0.30319.42000";
|
||||
|
||||
public const string VsVersion = "0.0.0.0"; // Useless ?
|
||||
public const string VsFileVersion = "11.0.0.0"; // TODO:
|
||||
#elif NET_4_5
|
||||
public const string FxVersion = "4.0.0.0";
|
||||
public const string FxFileVersion = "4.0.30319.17020";
|
||||
|
||||
public const string EnvironmentVersion = FxFileVersion;
|
||||
|
||||
public const string VsVersion = "0.0.0.0"; // Useless ?
|
||||
public const string VsFileVersion = "11.0.0.0"; // TODO:
|
||||
#elif NET_4_0
|
||||
|
||||
@@ -27,6 +27,7 @@ PROFILE_MCS_FLAGS = \
|
||||
-d:MONOTOUCH \
|
||||
-d:DISABLE_REMOTING \
|
||||
-d:DISABLE_COM \
|
||||
-d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK \
|
||||
-nowarn:1699 \
|
||||
-nostdlib \
|
||||
-lib:$(topdir)/class/lib/$(PROFILE) \
|
||||
|
||||
@@ -23,6 +23,7 @@ PROFILE_MCS_FLAGS = \
|
||||
-d:MOBILE \
|
||||
-d:MOBILE_DYNAMIC \
|
||||
-d:XAMMAC \
|
||||
-d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK \
|
||||
-nowarn:1699 \
|
||||
-nostdlib \
|
||||
-lib:$(topdir)/class/lib/$(PROFILE) \
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
include $(topdir)/build/profiles/net_4_x.make
|
||||
PROFILE_MCS_FLAGS += -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5
|
||||
PROFILE_MCS_FLAGS += \
|
||||
-d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK \
|
||||
-d:NO_SYSTEM_DRAWING_DEPENDENCY \
|
||||
-d:NO_WINFORMS_DEPENDENCY \
|
||||
-d:NO_SYSTEM_WEB_DEPENDENCY \
|
||||
-d:XAMMAC_4_5
|
||||
XAMMAC_4_5=1
|
||||
NO_WINDOWS_BASE=1
|
||||
NO_SYSTEM_WEB_DEPENDENCY=1
|
||||
|
||||
+7
-4
@@ -53,8 +53,8 @@ mobile_common_dirs := \
|
||||
Mono.CSharp \
|
||||
Microsoft.CSharp \
|
||||
Mono.Security.Providers.DotNet \
|
||||
Mono.Security.Providers.OldTls \
|
||||
Mono.Security.Providers.NewSystemSource
|
||||
Mono.Security.Providers.NewSystemSource \
|
||||
Mono.Security.Providers.NewTls
|
||||
|
||||
mobile_static_dirs := \
|
||||
$(mobile_common_dirs) \
|
||||
@@ -133,6 +133,7 @@ xammac_4_5_dirs := \
|
||||
Mono.Security.Providers.DotNet \
|
||||
Mono.Security.Providers.OldTls \
|
||||
Mono.Security.Providers.NewSystemSource \
|
||||
Mono.Security.Providers.NewTls \
|
||||
$(pcl_facade_dirs)
|
||||
|
||||
net_4_x_dirs := \
|
||||
@@ -217,7 +218,9 @@ net_4_x_dirs := \
|
||||
System.Net.Http.Formatting \
|
||||
System.Web.Http \
|
||||
System.Web.Http.SelfHost \
|
||||
System.Web.Http.WebHost
|
||||
System.Web.Http.WebHost \
|
||||
Mono.Security.Providers.NewSystemSource \
|
||||
Mono.Security.Providers.NewTls
|
||||
|
||||
# These are the subdirs which depends on libs in net_4_x_dirs
|
||||
# or have proper dependencies between each other
|
||||
@@ -262,7 +265,6 @@ net_4_x_parallel_dirs := \
|
||||
System.Xml.Serialization \
|
||||
Mono.Security.Providers.DotNet \
|
||||
Mono.Security.Providers.OldTls \
|
||||
Mono.Security.Providers.NewSystemSource \
|
||||
System.DirectoryServices.Protocols \
|
||||
RabbitMQ.Client \
|
||||
Microsoft.VisualC \
|
||||
@@ -324,6 +326,7 @@ DISTFILES = \
|
||||
notes/BitVecto32.txt \
|
||||
MicrosoftAjaxLibrary/License.htm \
|
||||
test-helpers/NetworkHelpers.cs \
|
||||
test-helpers/SocketResponder.cs \
|
||||
$(monolite_files)
|
||||
|
||||
.PHONY: all-local $(STD_TARGETS:=-local)
|
||||
|
||||
+2
-2
@@ -62,7 +62,7 @@ namespace Mono.Security.Providers.DotNet
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool SupportsTlsContext {
|
||||
internal override bool SupportsTlsContext {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Mono.Security.Providers.DotNet
|
||||
return new DotNetSslStreamImpl (innerStream, leaveInnerStreamOpen, this, validation_callback, selection_callback);
|
||||
}
|
||||
|
||||
public override IMonoTlsContext CreateTlsContext (
|
||||
internal override IMonoTlsContext CreateTlsContext (
|
||||
string hostname, bool serverMode, TlsProtocols protocolFlags,
|
||||
X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
|
||||
bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy,
|
||||
|
||||
+1
@@ -30,3 +30,4 @@
|
||||
../System/Mono.Net.Security/IMonoTlsProvider.cs
|
||||
../System/Mono.Net.Security/MonoTlsProviderFactory.cs
|
||||
../System/Mono.Net.Security/MonoTlsProviderWrapper.cs
|
||||
|
||||
@@ -45,3 +45,4 @@ using System.Runtime.InteropServices;
|
||||
[assembly: NeutralResourcesLanguage ("en-US")]
|
||||
|
||||
[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000003336d6aed41624ca156ab579881fe90a576f1dfec48378fc94e4e440f4556776224e2d70c18996d91f36227f539fdb44340e07651f1455a489b29a7e6219a8f85e52b0f8588b4f8a857746a8468d37b556223d1452f3fcbaf0f269cdf1900ceb68f69485dc5887750d19571030c732331e00387d9b813a9ad52891087301793")]
|
||||
[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
|
||||
@@ -0,0 +1,12 @@
|
||||
thisdir = class/Mono.Security.Providers.NewTls
|
||||
SUBDIRS =
|
||||
include ../../build/rules.make
|
||||
|
||||
LIBRARY = Mono.Security.Providers.NewTls.dll
|
||||
LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -r:System.dll \
|
||||
-r:NewSystemSource=Mono.Security.Providers.NewSystemSource.dll -r:Mono.Security.dll
|
||||
|
||||
include ../../build/library.make
|
||||
|
||||
$(the_lib): ../Mono.Security/Makefile
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
./Properties/AssemblyInfo.cs
|
||||
../../build/common/SR.cs
|
||||
../../build/common/Consts.cs
|
||||
../../build/common/Locale.cs
|
||||
|
||||
./Mono.Security.Providers.NewTls/ITlsConfiguration.cs
|
||||
./Mono.Security.Providers.NewTls/ITlsContext.cs
|
||||
|
||||
./Mono.Security.Providers.NewTls/MonoNewTlsStream.cs
|
||||
./Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs
|
||||
./Mono.Security.Providers.NewTls/NewTlsProvider.cs
|
||||
./Mono.Security.Providers.NewTls/TlsContextWrapper.cs
|
||||
./Mono.Security.Providers.NewTls/TlsProviderFactory.cs
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// ITlsContext.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2015-2016 Xamarin, Inc.
|
||||
//
|
||||
// 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.Security.Cryptography;
|
||||
|
||||
using Mono.Security.Interface;
|
||||
using MX = Mono.Security.X509;
|
||||
|
||||
namespace Mono.Security.Providers.NewTls
|
||||
{
|
||||
interface ITlsConfiguration
|
||||
{
|
||||
bool HasCredentials {
|
||||
get;
|
||||
}
|
||||
|
||||
void SetCertificate (MX.X509Certificate certificate, AsymmetricAlgorithm privateKey);
|
||||
|
||||
bool? AskForClientCertificate {
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// ITlsContext.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2015-2016 Xamarin, Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
extern alias NewSystemSource;
|
||||
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
using Mono.Security.Interface;
|
||||
using MX = Mono.Security.X509;
|
||||
|
||||
namespace Mono.Security.Providers.NewTls
|
||||
{
|
||||
interface ITlsContext : IDisposable
|
||||
{
|
||||
bool IsValid {
|
||||
get;
|
||||
}
|
||||
|
||||
TlsException LastError {
|
||||
get;
|
||||
}
|
||||
|
||||
bool ReceivedCloseNotify {
|
||||
get;
|
||||
}
|
||||
|
||||
MonoTlsConnectionInfo ConnectionInfo {
|
||||
get;
|
||||
}
|
||||
|
||||
MX.X509Certificate GetRemoteCertificate (out MX.X509CertificateCollection remoteCertificateStore);
|
||||
|
||||
bool VerifyRemoteCertificate ();
|
||||
|
||||
int GenerateNextToken (TlsBuffer incoming, TlsMultiBuffer outgoing);
|
||||
|
||||
int DecryptMessage (ref TlsBuffer incoming);
|
||||
|
||||
int EncryptMessage (ref TlsBuffer incoming);
|
||||
|
||||
byte[] CreateAlert (Alert alert);
|
||||
|
||||
byte[] CreateHelloRequest ();
|
||||
}
|
||||
}
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// MonoNewTlsStream.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2015 Xamarin, Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
extern alias NewSystemSource;
|
||||
|
||||
using EncryptionPolicy = NewSystemSource::System.Net.Security.EncryptionPolicy;
|
||||
using LocalCertificateSelectionCallback = NewSystemSource::System.Net.Security.LocalCertificateSelectionCallback;
|
||||
using RemoteCertificateValidationCallback = NewSystemSource::System.Net.Security.RemoteCertificateValidationCallback;
|
||||
using SslStream = NewSystemSource::System.Net.Security.SslStream;
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using MSI = Mono.Security.Interface;
|
||||
|
||||
using XAuthenticatedStream = System.Net.Security.AuthenticatedStream;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
namespace Mono.Security.Providers.NewTls
|
||||
{
|
||||
public class MonoNewTlsStream : SslStream, MSI.IMonoSslStream
|
||||
{
|
||||
MSI.MonoTlsProvider provider;
|
||||
|
||||
internal MonoNewTlsStream (Stream innerStream, MSI.MonoTlsProvider provider, MSI.MonoTlsSettings settings)
|
||||
: this (innerStream, false, provider, settings)
|
||||
{
|
||||
}
|
||||
|
||||
internal MonoNewTlsStream (Stream innerStream, bool leaveOpen, MSI.MonoTlsProvider provider, MSI.MonoTlsSettings settings)
|
||||
: base (innerStream, leaveOpen, EncryptionPolicy.RequireEncryption, provider, settings)
|
||||
{
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
public MSI.MonoTlsProvider Provider {
|
||||
get { return provider; }
|
||||
}
|
||||
|
||||
new public bool IsClosed {
|
||||
get { return base.IsClosed; }
|
||||
}
|
||||
|
||||
public MSI.MonoTlsConnectionInfo GetConnectionInfo ()
|
||||
{
|
||||
return GetMonoConnectionInfo ();
|
||||
}
|
||||
|
||||
public Task Shutdown ()
|
||||
{
|
||||
return Task.Factory.FromAsync ((state, result) => BeginShutdown (state, result), EndShutdown, null);
|
||||
}
|
||||
|
||||
public Task RequestRenegotiation ()
|
||||
{
|
||||
return Task.Factory.FromAsync ((state, result) => BeginRenegotiate (state, result), EndRenegotiate, null);
|
||||
}
|
||||
|
||||
X509Certificate MSI.IMonoSslStream.InternalLocalCertificate {
|
||||
get { return InternalLocalCertificate; }
|
||||
}
|
||||
|
||||
XAuthenticatedStream MSI.IMonoSslStream.AuthenticatedStream {
|
||||
get { return this; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
//
|
||||
// MonoNewTlsStreamFactory.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2015 Xamarin, Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
extern alias NewSystemSource;
|
||||
|
||||
using XEncryptionPolicy = NewSystemSource::System.Net.Security.EncryptionPolicy;
|
||||
using XSslPolicyErrors = NewSystemSource::System.Net.Security.SslPolicyErrors;
|
||||
using XLocalCertificateSelectionCallback = NewSystemSource::System.Net.Security.LocalCertificateSelectionCallback;
|
||||
using XRemoteCertificateValidationCallback = NewSystemSource::System.Net.Security.RemoteCertificateValidationCallback;
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Security;
|
||||
using System.Security.Authentication;
|
||||
|
||||
using Mono.Security.Interface;
|
||||
|
||||
using PSSCX = System.Security.Cryptography.X509Certificates;
|
||||
using SSCX = System.Security.Cryptography.X509Certificates;
|
||||
|
||||
namespace Mono.Security.Providers.NewTls
|
||||
{
|
||||
public static class MonoNewTlsStreamFactory
|
||||
{
|
||||
internal static IMonoSslStream CreateSslStream (
|
||||
Stream innerStream, bool leaveInnerStreamOpen,
|
||||
MonoTlsProvider provider, MonoTlsSettings settings = null)
|
||||
{
|
||||
return new MonoNewTlsStream (innerStream, leaveInnerStreamOpen, provider, settings);
|
||||
}
|
||||
|
||||
public static MonoNewTlsStream CreateServer (
|
||||
Stream innerStream, bool leaveOpen, MonoTlsProvider provider, MonoTlsSettings settings,
|
||||
SSCX.X509Certificate serverCertificate, bool clientCertificateRequired,
|
||||
SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
|
||||
{
|
||||
var stream = new MonoNewTlsStream (innerStream, leaveOpen, provider, settings);
|
||||
|
||||
try {
|
||||
stream.AuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
|
||||
} catch (Exception ex) {
|
||||
var tlsEx = stream.LastError;
|
||||
if (tlsEx != null)
|
||||
throw new AggregateException (ex, tlsEx);
|
||||
throw;
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
public static MonoNewTlsStream CreateClient (
|
||||
Stream innerStream, bool leaveOpen, MonoTlsProvider provider, MonoTlsSettings settings,
|
||||
string targetHost, PSSCX.X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
|
||||
{
|
||||
var stream = new MonoNewTlsStream (innerStream, leaveOpen, provider, settings);
|
||||
|
||||
try {
|
||||
stream.AuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
|
||||
} catch (Exception ex) {
|
||||
var tlsEx = stream.LastError;
|
||||
if (tlsEx != null)
|
||||
throw new AggregateException (ex, tlsEx);
|
||||
throw;
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
//
|
||||
// NewTlsProvider.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2015 Xamarin, Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
extern alias NewSystemSource;
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Security;
|
||||
using System.Security.Authentication;
|
||||
|
||||
using MSI = Mono.Security.Interface;
|
||||
using MX = Mono.Security.X509;
|
||||
|
||||
using PSSCX = System.Security.Cryptography.X509Certificates;
|
||||
using SSCX = System.Security.Cryptography.X509Certificates;
|
||||
|
||||
namespace Mono.Security.Providers.NewTls
|
||||
{
|
||||
public class NewTlsProvider : MSI.MonoTlsProvider
|
||||
{
|
||||
static readonly Guid id = new Guid ("e5ff34f1-8b7a-4aa6-aff9-24719d709693");
|
||||
|
||||
public override Guid ID {
|
||||
get { return id; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return "newtls"; }
|
||||
}
|
||||
|
||||
public override bool SupportsSslStream {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool SupportsConnectionInfo {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool SupportsMonoExtensions {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
internal override bool SupportsTlsContext {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override SslProtocols SupportedProtocols {
|
||||
get { return SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; }
|
||||
}
|
||||
|
||||
public override MSI.IMonoSslStream CreateSslStream (
|
||||
Stream innerStream, bool leaveInnerStreamOpen,
|
||||
MSI.MonoTlsSettings settings = null)
|
||||
{
|
||||
return MonoNewTlsStreamFactory.CreateSslStream (innerStream, leaveInnerStreamOpen, this, settings);
|
||||
}
|
||||
|
||||
internal override MSI.IMonoTlsContext CreateTlsContext (
|
||||
string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
|
||||
SSCX.X509Certificate serverCertificate, PSSCX.X509CertificateCollection clientCertificates,
|
||||
bool remoteCertRequired, MSI.MonoEncryptionPolicy encryptionPolicy,
|
||||
MSI.MonoTlsSettings settings)
|
||||
{
|
||||
var config = TlsProviderFactory.CreateTlsConfiguration (
|
||||
hostname, serverMode, protocolFlags, serverCertificate,
|
||||
remoteCertRequired, settings);
|
||||
return new TlsContextWrapper (config, serverMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+221
@@ -0,0 +1,221 @@
|
||||
//
|
||||
// TlsContextWrapper.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2015 Xamarin, Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
extern alias NewSystemSource;
|
||||
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
using SSCX = System.Security.Cryptography.X509Certificates;
|
||||
using PSSCX = System.Security.Cryptography.X509Certificates;
|
||||
|
||||
using MSI = Mono.Security.Interface;
|
||||
using MX = Mono.Security.X509;
|
||||
|
||||
namespace Mono.Security.Providers.NewTls
|
||||
{
|
||||
class TlsContextWrapper : IDisposable, MSI.IMonoTlsContext
|
||||
{
|
||||
ITlsConfiguration config;
|
||||
ITlsContext context;
|
||||
bool serverMode;
|
||||
|
||||
public TlsContextWrapper (ITlsConfiguration config, bool serverMode)
|
||||
{
|
||||
this.config = config;
|
||||
this.serverMode = serverMode;
|
||||
}
|
||||
|
||||
public bool IsServer {
|
||||
get { return serverMode; }
|
||||
}
|
||||
|
||||
public bool IsValid {
|
||||
get { return context != null && context.IsValid; }
|
||||
}
|
||||
|
||||
public void Initialize (MSI.IMonoTlsEventSink eventSink)
|
||||
{
|
||||
if (context != null)
|
||||
throw new InvalidOperationException ();
|
||||
context = TlsProviderFactory.CreateTlsContext (config, serverMode, eventSink);
|
||||
}
|
||||
|
||||
void Clear ()
|
||||
{
|
||||
if (context != null) {
|
||||
context.Dispose ();
|
||||
context = null;
|
||||
}
|
||||
}
|
||||
|
||||
public ITlsConfiguration Configuration {
|
||||
get {
|
||||
if (config == null)
|
||||
throw new ObjectDisposedException ("TlsConfiguration");
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
public ITlsContext Context {
|
||||
get {
|
||||
if (!IsValid)
|
||||
throw new ObjectDisposedException ("TlsContext");
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasCredentials {
|
||||
get { return Configuration.HasCredentials; }
|
||||
}
|
||||
|
||||
public void SetCertificate (SSCX.X509Certificate certificate, AsymmetricAlgorithm privateKey)
|
||||
{
|
||||
var monoCert = new MX.X509Certificate (certificate.GetRawCertData ());
|
||||
Configuration.SetCertificate (monoCert, privateKey);
|
||||
}
|
||||
|
||||
public int GenerateNextToken (MSI.IBufferOffsetSize incoming, out MSI.IBufferOffsetSize outgoing)
|
||||
{
|
||||
var input = incoming != null ? new MSI.TlsBuffer (BOSWrapper.Wrap (incoming)) : null;
|
||||
var output = new MSI.TlsMultiBuffer ();
|
||||
var retval = Context.GenerateNextToken (input, output);
|
||||
if (output.IsEmpty)
|
||||
outgoing = null;
|
||||
outgoing = BOSWrapper.Wrap (output.StealBuffer ());
|
||||
return (int)retval;
|
||||
}
|
||||
|
||||
public int EncryptMessage (ref MSI.IBufferOffsetSize incoming)
|
||||
{
|
||||
var buffer = new MSI.TlsBuffer (BOSWrapper.Wrap (incoming));
|
||||
var retval = Context.EncryptMessage (ref buffer);
|
||||
incoming = BOSWrapper.Wrap (buffer.GetRemaining ());
|
||||
return (int)retval;
|
||||
}
|
||||
|
||||
public int DecryptMessage (ref MSI.IBufferOffsetSize incoming)
|
||||
{
|
||||
var buffer = new MSI.TlsBuffer (BOSWrapper.Wrap (incoming));
|
||||
var retval = Context.DecryptMessage (ref buffer);
|
||||
incoming = buffer != null ? BOSWrapper.Wrap (buffer.GetRemaining ()) : null;
|
||||
return (int)retval;
|
||||
}
|
||||
|
||||
class BOSWrapper : MSI.IBufferOffsetSize
|
||||
{
|
||||
public byte[] Buffer {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public int Offset {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public int Size {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
BOSWrapper (byte[] buffer, int offset, int size)
|
||||
{
|
||||
Buffer = buffer;
|
||||
Offset = offset;
|
||||
Size = size;
|
||||
}
|
||||
|
||||
public static BOSWrapper Wrap (MSI.IBufferOffsetSize bos)
|
||||
{
|
||||
return bos != null ? new BOSWrapper (bos.Buffer, bos.Offset, bos.Size) : null;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] CreateCloseNotify ()
|
||||
{
|
||||
return Context.CreateAlert (new MSI.Alert (MSI.AlertLevel.Warning, MSI.AlertDescription.CloseNotify));
|
||||
}
|
||||
|
||||
public byte[] CreateHelloRequest ()
|
||||
{
|
||||
return Context.CreateHelloRequest ();
|
||||
}
|
||||
|
||||
public SSCX.X509Certificate GetRemoteCertificate (out PSSCX.X509CertificateCollection remoteCertificateStore)
|
||||
{
|
||||
MX.X509CertificateCollection monoCollection;
|
||||
var remoteCert = Context.GetRemoteCertificate (out monoCollection);
|
||||
if (remoteCert == null) {
|
||||
remoteCertificateStore = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
remoteCertificateStore = new PSSCX.X509CertificateCollection ();
|
||||
foreach (var cert in monoCollection) {
|
||||
remoteCertificateStore.Add (new PSSCX.X509Certificate2 (cert.RawData));
|
||||
}
|
||||
return new PSSCX.X509Certificate2 (remoteCert.RawData);
|
||||
|
||||
}
|
||||
|
||||
public bool VerifyRemoteCertificate ()
|
||||
{
|
||||
return Context.VerifyRemoteCertificate ();
|
||||
}
|
||||
|
||||
public Exception LastError {
|
||||
get {
|
||||
if (context != null)
|
||||
return context.LastError;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReceivedCloseNotify {
|
||||
get {
|
||||
return Context.ReceivedCloseNotify;
|
||||
}
|
||||
}
|
||||
|
||||
public MSI.MonoTlsConnectionInfo GetConnectionInfo ()
|
||||
{
|
||||
return Context.ConnectionInfo;
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
Dispose (true);
|
||||
GC.SuppressFinalize (this);
|
||||
}
|
||||
|
||||
void Dispose (bool disposing)
|
||||
{
|
||||
Clear ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// TlsProviderFactory.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2015-2016 Xamarin, Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
extern alias NewSystemSource;
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using System.Net;
|
||||
using System.Net.Security;
|
||||
using System.Security.Authentication;
|
||||
|
||||
using MSI = Mono.Security.Interface;
|
||||
using MX = Mono.Security.X509;
|
||||
|
||||
using PSSCX = System.Security.Cryptography.X509Certificates;
|
||||
using SSCX = System.Security.Cryptography.X509Certificates;
|
||||
|
||||
namespace Mono.Security.Providers.NewTls
|
||||
{
|
||||
static class TlsProviderFactory
|
||||
{
|
||||
const string assemblyName = "Mono.Security.NewTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=84e3aee7225169c2";
|
||||
const string tlsConfigTypeName = "Mono.Security.NewTls.TlsConfiguration";
|
||||
const string tlsContextTypeName = "Mono.Security.NewTls.TlsContext";
|
||||
|
||||
static object CreateInstance (string typeName, object[] args)
|
||||
{
|
||||
var type = Type.GetType (typeName + ", " + assemblyName);
|
||||
return Activator.CreateInstance (type, args);
|
||||
}
|
||||
|
||||
internal static ITlsConfiguration CreateTlsConfiguration (
|
||||
string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
|
||||
SSCX.X509Certificate serverCertificate, bool remoteCertRequired,
|
||||
MSI.MonoTlsSettings settings)
|
||||
{
|
||||
object[] args;
|
||||
ITlsConfiguration config;
|
||||
if (serverMode) {
|
||||
var cert = (PSSCX.X509Certificate2)serverCertificate;
|
||||
var monoCert = new MX.X509Certificate (cert.RawData);
|
||||
args = new object[] {
|
||||
(MSI.TlsProtocols)protocolFlags,
|
||||
(MSI.MonoTlsSettings)settings,
|
||||
monoCert,
|
||||
cert.PrivateKey
|
||||
};
|
||||
} else {
|
||||
args = new object[] {
|
||||
(MSI.TlsProtocols)protocolFlags,
|
||||
(MSI.MonoTlsSettings)settings,
|
||||
hostname
|
||||
};
|
||||
}
|
||||
|
||||
config = (ITlsConfiguration)CreateInstance (tlsConfigTypeName, args);
|
||||
|
||||
if (serverMode && remoteCertRequired)
|
||||
config.AskForClientCertificate = true;
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
internal static ITlsContext CreateTlsContext (
|
||||
ITlsConfiguration config, bool serverMode,
|
||||
MSI.IMonoTlsEventSink eventSink)
|
||||
{
|
||||
return (ITlsContext)CreateInstance (
|
||||
tlsContextTypeName,
|
||||
new object[] { config, serverMode, eventSink });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// AssemblyInfo.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2015 Xamarin, Inc.
|
||||
//
|
||||
// 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.Reflection;
|
||||
using System.Resources;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about the system assembly
|
||||
|
||||
[assembly: AssemblyVersion (Consts.FxVersion)]
|
||||
|
||||
[assembly: AssemblyCompany ("Xamarin")]
|
||||
[assembly: AssemblyCopyright ("(c) 2015 Xamarin")]
|
||||
[assembly: AssemblyDescription ("Mono.Security.Providers.NewTls.dll")]
|
||||
[assembly: AssemblyProduct ("MONO CLI")]
|
||||
[assembly: AssemblyTitle ("Mono.Security.Providers.NewTls.dll")]
|
||||
[assembly: CLSCompliant (false)]
|
||||
[assembly: ComVisible (false)]
|
||||
[assembly: NeutralResourcesLanguage ("en-US")]
|
||||
|
||||
[assembly: InternalsVisibleTo ("Mono.Security.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000003336d6aed41624ca156ab579881fe90a576f1dfec48378fc94e4e440f4556776224e2d70c18996d91f36227f539fdb44340e07651f1455a489b29a7e6219a8f85e52b0f8588b4f8a857746a8468d37b556223d1452f3fcbaf0f269cdf1900ceb68f69485dc5887750d19571030c732331e00387d9b813a9ad52891087301793")]
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Properties/AssemblyInfo.cs
|
||||
|
||||
Mono.Security.Providers.NewTls/ITlsConfiguration.cs
|
||||
Mono.Security.Providers.NewTls/ITlsContext.cs
|
||||
|
||||
Mono.Security.Providers.NewTls/MonoNewTlsStream.cs
|
||||
Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs
|
||||
+1
@@ -0,0 +1 @@
|
||||
#include mobile_Mono.Security.Providers.NewTls.dll.sources
|
||||
+2
-2
@@ -58,7 +58,7 @@ namespace Mono.Security.Providers.OldTls
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool SupportsTlsContext {
|
||||
internal override bool SupportsTlsContext {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Mono.Security.Providers.OldTls
|
||||
return new MNS.Private.MonoSslStreamImpl (impl);
|
||||
}
|
||||
|
||||
public override IMonoTlsContext CreateTlsContext (
|
||||
internal override IMonoTlsContext CreateTlsContext (
|
||||
string hostname, bool serverMode, TlsProtocols protocolFlags,
|
||||
X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
|
||||
bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy,
|
||||
|
||||
@@ -60,6 +60,13 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyDelaySign (true)]
|
||||
[assembly: AssemblyKeyFile ("../mono.pub")]
|
||||
|
||||
#if MOBILE
|
||||
#if NET_2_1
|
||||
[assembly: InternalsVisibleTo ("System, PublicKey=00240000048000009400000006020000002400005253413100040000010001008D56C76F9E8649383049F383C44BE0EC204181822A6C31CF5EB7EF486944D032188EA1D3920763712CCB12D75FB77E9811149E6148E5D32FBAAB37611C1878DDC19E20EF135D0CB2CFF2BFEC3D115810C3D9069638FE4BE215DBF795861920E5AB6F7DB2E2CEEF136AC23D5DD2BF031700AEC232F6C6B1C785B4305C123B37AB")]
|
||||
#else
|
||||
[assembly: InternalsVisibleTo ("System, PublicKey=00000000000000000400000000000000")]
|
||||
#endif
|
||||
|
||||
[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
|
||||
[assembly: InternalsVisibleTo ("Mono.Security.Providers.OldTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
|
||||
[assembly: InternalsVisibleTo ("Mono.Security.Providers.DotNet, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
|
||||
[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewSystemSource, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
|
||||
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// BufferOffsetSize.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
|
||||
namespace Mono.Security.Interface
|
||||
{
|
||||
public class BufferOffsetSize : SecretParameters, IBufferOffsetSize
|
||||
{
|
||||
public byte[] Buffer {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public int Offset {
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public int Size {
|
||||
get { return EndOffset - Offset; }
|
||||
}
|
||||
|
||||
public int EndOffset {
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public BufferOffsetSize (byte[] buffer, int offset, int size)
|
||||
{
|
||||
Buffer = buffer;
|
||||
Offset = offset;
|
||||
EndOffset = offset + size;
|
||||
}
|
||||
|
||||
public BufferOffsetSize (byte[] buffer)
|
||||
: this (buffer, 0, buffer.Length)
|
||||
{
|
||||
}
|
||||
|
||||
public BufferOffsetSize (int size)
|
||||
: this (new byte [size])
|
||||
{
|
||||
}
|
||||
|
||||
public byte[] GetBuffer ()
|
||||
{
|
||||
var copy = new byte [Size];
|
||||
Array.Copy (Buffer, Offset, copy, 0, Size);
|
||||
return copy;
|
||||
}
|
||||
|
||||
public void TruncateTo (int newSize)
|
||||
{
|
||||
if (newSize > Size)
|
||||
throw new ArgumentException ("newSize");
|
||||
EndOffset = Offset + newSize;
|
||||
}
|
||||
|
||||
protected void SetBuffer (byte[] buffer, int offset, int size)
|
||||
{
|
||||
Buffer = buffer;
|
||||
Offset = offset;
|
||||
EndOffset = offset + size;
|
||||
}
|
||||
|
||||
protected override void Clear ()
|
||||
{
|
||||
Buffer = null;
|
||||
Offset = EndOffset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
namespace Mono.Security.Interface
|
||||
{
|
||||
public interface IMonoTlsContext : IDisposable
|
||||
interface IMonoTlsContext : IDisposable
|
||||
{
|
||||
bool IsServer {
|
||||
get;
|
||||
|
||||
@@ -72,6 +72,10 @@ namespace Mono.Security.Interface
|
||||
|
||||
public abstract class MonoTlsProvider
|
||||
{
|
||||
internal MonoTlsProvider ()
|
||||
{
|
||||
}
|
||||
|
||||
public abstract Guid ID {
|
||||
get;
|
||||
}
|
||||
@@ -155,11 +159,11 @@ namespace Mono.Security.Interface
|
||||
* The managed SSPI implementation from the new TLS code.
|
||||
*/
|
||||
|
||||
public abstract bool SupportsTlsContext {
|
||||
internal abstract bool SupportsTlsContext {
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract IMonoTlsContext CreateTlsContext (
|
||||
internal abstract IMonoTlsContext CreateTlsContext (
|
||||
string hostname, bool serverMode, TlsProtocols protocolFlags,
|
||||
X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
|
||||
bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy,
|
||||
|
||||
@@ -72,14 +72,19 @@ namespace Mono.Security.Interface
|
||||
}
|
||||
|
||||
/*
|
||||
* Installs a custom TLS Provider.
|
||||
* Selects the default TLS Provider.
|
||||
*
|
||||
* May only be called at application startup and will throw
|
||||
* @InvalidOperationException if a provider has already been installed.
|
||||
*/
|
||||
public static void InstallProvider (MonoTlsProvider provider)
|
||||
public static void SetDefaultProvider (string name)
|
||||
{
|
||||
NoReflectionHelper.InstallProvider (provider);
|
||||
NoReflectionHelper.SetDefaultProvider (name);
|
||||
}
|
||||
|
||||
public static MonoTlsProvider GetProvider (string name)
|
||||
{
|
||||
return (MonoTlsProvider)NoReflectionHelper.GetProvider (name);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -82,6 +82,10 @@ namespace Mono.Security.Interface
|
||||
get; set;
|
||||
}
|
||||
|
||||
public CipherSuiteCode[] EnabledCiphers {
|
||||
get; set;
|
||||
}
|
||||
|
||||
bool cloned = false;
|
||||
bool checkCertName = true;
|
||||
bool checkCertRevocationStatus = false;
|
||||
@@ -155,6 +159,7 @@ namespace Mono.Security.Interface
|
||||
callbackNeedsChain = other.callbackNeedsChain;
|
||||
UserSettings = other.UserSettings;
|
||||
EnabledProtocols = other.EnabledProtocols;
|
||||
EnabledCiphers = other.EnabledCiphers;
|
||||
TrustAnchors = other.TrustAnchors;
|
||||
cloned = true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// SecretParameters.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
|
||||
namespace Mono.Security.Interface
|
||||
{
|
||||
public abstract class SecretParameters : IDisposable
|
||||
{
|
||||
protected abstract void Clear ();
|
||||
|
||||
bool disposed;
|
||||
|
||||
protected void CheckDisposed ()
|
||||
{
|
||||
if (disposed)
|
||||
throw new ObjectDisposedException (GetType ().Name);
|
||||
}
|
||||
|
||||
protected static void Clear (byte[] array)
|
||||
{
|
||||
Array.Clear (array, 0, array.Length);
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
Dispose (true);
|
||||
GC.SuppressFinalize (this);
|
||||
}
|
||||
|
||||
void Dispose (bool disposing)
|
||||
{
|
||||
if (!disposed) {
|
||||
disposed = true;
|
||||
Clear ();
|
||||
}
|
||||
}
|
||||
|
||||
~SecretParameters ()
|
||||
{
|
||||
Dispose (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// SecureBuffer.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
|
||||
namespace Mono.Security.Interface
|
||||
{
|
||||
public class SecureBuffer : SecretParameters, IBufferOffsetSize
|
||||
{
|
||||
byte[] buffer;
|
||||
|
||||
public byte[] Buffer {
|
||||
get {
|
||||
CheckDisposed ();
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
||||
public int Size {
|
||||
get {
|
||||
CheckDisposed ();
|
||||
return buffer != null ? buffer.Length : 0;
|
||||
}
|
||||
}
|
||||
|
||||
int IBufferOffsetSize.Offset {
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public SecureBuffer (int size)
|
||||
{
|
||||
buffer = new byte [size];
|
||||
}
|
||||
|
||||
public SecureBuffer (byte[] buffer)
|
||||
{
|
||||
this.buffer = buffer;
|
||||
}
|
||||
|
||||
public byte[] StealBuffer ()
|
||||
{
|
||||
CheckDisposed ();
|
||||
var retval = this.buffer;
|
||||
this.buffer = null;
|
||||
return retval;
|
||||
}
|
||||
|
||||
public static SecureBuffer CreateCopy (byte[] buffer)
|
||||
{
|
||||
var copy = new byte [buffer.Length];
|
||||
Array.Copy (buffer, copy, buffer.Length);
|
||||
return new SecureBuffer (copy);
|
||||
}
|
||||
|
||||
protected override void Clear ()
|
||||
{
|
||||
if (buffer != null) {
|
||||
Array.Clear (buffer, 0, buffer.Length);
|
||||
buffer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,334 @@
|
||||
//
|
||||
// TlsBuffer.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
|
||||
namespace Mono.Security.Interface
|
||||
{
|
||||
public class TlsBuffer : SecretParameters
|
||||
{
|
||||
public int Position {
|
||||
get; set;
|
||||
}
|
||||
|
||||
public int Remaining {
|
||||
get { return Size - (Position - Offset); }
|
||||
}
|
||||
|
||||
public byte[] Buffer {
|
||||
get { return innerBuffer.Buffer; }
|
||||
}
|
||||
|
||||
public int Offset {
|
||||
get { return innerBuffer.Offset; }
|
||||
}
|
||||
|
||||
public int Size {
|
||||
get { return innerBuffer.Size; }
|
||||
}
|
||||
|
||||
public int EndOffset {
|
||||
get { return Offset + Size; }
|
||||
}
|
||||
|
||||
IBufferOffsetSize innerBuffer;
|
||||
|
||||
protected TlsBuffer ()
|
||||
: this (null, 0, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public TlsBuffer (IBufferOffsetSize bos)
|
||||
{
|
||||
innerBuffer = bos;
|
||||
Position = bos.Offset;
|
||||
}
|
||||
|
||||
public TlsBuffer (byte[] buffer, int offset, int size)
|
||||
: this (new BufferOffsetSize (buffer, offset, size))
|
||||
{
|
||||
}
|
||||
|
||||
public TlsBuffer (byte[] buffer)
|
||||
: this (buffer, 0, buffer.Length)
|
||||
{
|
||||
}
|
||||
|
||||
public TlsBuffer (int size)
|
||||
: this (new byte [size], 0, size)
|
||||
{
|
||||
}
|
||||
|
||||
public byte ReadByte ()
|
||||
{
|
||||
if (Position >= EndOffset)
|
||||
throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
|
||||
return Buffer [Position++];
|
||||
}
|
||||
|
||||
public short ReadInt16 ()
|
||||
{
|
||||
if (Position + 1 >= EndOffset)
|
||||
throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
|
||||
var retval = (short)(Buffer [Position] << 8 | Buffer [Position + 1]);
|
||||
Position += 2;
|
||||
return retval;
|
||||
}
|
||||
|
||||
public int ReadInt24 ()
|
||||
{
|
||||
if (Position + 2 >= EndOffset)
|
||||
throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
|
||||
var retval = ((Buffer [Position] << 16) | (Buffer [Position+1] << 8) | Buffer [Position+2]);
|
||||
Position += 3;
|
||||
return retval;
|
||||
}
|
||||
|
||||
public int ReadInt32 ()
|
||||
{
|
||||
if (Position + 3 >= EndOffset)
|
||||
throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
|
||||
var retval = ((Buffer [Position] << 24) | (Buffer [Position+1] << 16) | (Buffer [Position+2] << 8) | Buffer [Position+3]);
|
||||
Position += 4;
|
||||
return retval;
|
||||
}
|
||||
|
||||
public TlsBuffer ReadBuffer (int length)
|
||||
{
|
||||
if (Position + length > EndOffset)
|
||||
throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
|
||||
var retval = new TlsBuffer (Buffer, Position, length);
|
||||
Position += length;
|
||||
return retval;
|
||||
}
|
||||
|
||||
public IBufferOffsetSize GetRemaining ()
|
||||
{
|
||||
return new BufferOffsetSize (Buffer, Position, Remaining);
|
||||
}
|
||||
|
||||
protected virtual void MakeRoomInternal (int size)
|
||||
{
|
||||
if (Position + size > EndOffset)
|
||||
throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
|
||||
}
|
||||
|
||||
public void Write (byte value)
|
||||
{
|
||||
MakeRoomInternal (1);
|
||||
Buffer [Position++] = value;
|
||||
}
|
||||
|
||||
public void Write (short value)
|
||||
{
|
||||
MakeRoomInternal (2);
|
||||
WriteInt16 (Buffer, Position, value);
|
||||
Position += 2;
|
||||
}
|
||||
|
||||
public static void WriteInt16 (byte[] buffer, int offset, short value)
|
||||
{
|
||||
buffer[offset] = ((byte)(value >> 8));
|
||||
buffer[offset+1] = ((byte)value);
|
||||
}
|
||||
|
||||
public void Write (int value)
|
||||
{
|
||||
MakeRoomInternal (4);
|
||||
WriteInt32 (Buffer, Position, value);
|
||||
Position += 4;
|
||||
}
|
||||
|
||||
public void WriteInt24 (int value)
|
||||
{
|
||||
MakeRoomInternal (3);
|
||||
WriteInt24 (Buffer, Position, value);
|
||||
Position += 3;
|
||||
}
|
||||
|
||||
#pragma warning disable 3001
|
||||
public void Write (ulong value)
|
||||
#pragma warning restore 3001
|
||||
{
|
||||
MakeRoomInternal (8);
|
||||
WriteInt64 (Buffer, Position, value);
|
||||
Position += 8;
|
||||
}
|
||||
|
||||
public static void WriteInt24 (byte[] buffer, int offset, int value)
|
||||
{
|
||||
buffer[offset] = ((byte)(value >> 16));
|
||||
buffer[offset+1] = ((byte)(value >> 8));
|
||||
buffer[offset+2] = ((byte)value);
|
||||
}
|
||||
|
||||
public static void WriteInt32 (byte[] buffer, int offset, int value)
|
||||
{
|
||||
buffer[offset] = ((byte)(value >> 24));
|
||||
buffer[offset+1] = ((byte)(value >> 16));
|
||||
buffer[offset+2] = ((byte)(value >> 8));
|
||||
buffer[offset+3] = ((byte)value);
|
||||
}
|
||||
|
||||
#pragma warning disable 3001
|
||||
public static void WriteInt64 (byte[] buffer, int offset, ulong value)
|
||||
#pragma warning restore 3001
|
||||
{
|
||||
buffer[offset] = (byte) (value >> 56);
|
||||
buffer[offset+1] = (byte) (value >> 48);
|
||||
buffer[offset+2] = (byte) (value >> 40);
|
||||
buffer[offset+3] = (byte) (value >> 32);
|
||||
buffer[offset+4] = (byte) (value >> 24);
|
||||
buffer[offset+5] = (byte) (value >> 16);
|
||||
buffer[offset+6] = (byte) (value >> 8);
|
||||
buffer[offset+7] = (byte) value;
|
||||
}
|
||||
|
||||
public void Write (byte[] buffer)
|
||||
{
|
||||
Write (buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
public void Write (byte[] buffer, int offset, int size)
|
||||
{
|
||||
MakeRoomInternal (size);
|
||||
Array.Copy (buffer, offset, Buffer, Position, size);
|
||||
Position += size;
|
||||
}
|
||||
|
||||
public void Write (IBufferOffsetSize buffer)
|
||||
{
|
||||
Write (buffer.Buffer, buffer.Offset, buffer.Size);
|
||||
}
|
||||
|
||||
public SecureBuffer ReadSecureBuffer (int count)
|
||||
{
|
||||
return new SecureBuffer (ReadBytes (count));
|
||||
}
|
||||
|
||||
public byte[] ReadBytes (int count)
|
||||
{
|
||||
if (Position + count > EndOffset)
|
||||
throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
|
||||
var retval = new byte [count];
|
||||
Array.Copy (Buffer, Position, retval, 0, count);
|
||||
Position += count;
|
||||
return retval;
|
||||
}
|
||||
|
||||
internal static bool Compare (SecureBuffer buffer1, SecureBuffer buffer2)
|
||||
{
|
||||
if (buffer1 == null || buffer2 == null)
|
||||
return false;
|
||||
|
||||
if (buffer1.Size != buffer2.Size)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < buffer1.Size; i++) {
|
||||
if (buffer1.Buffer [i] != buffer2.Buffer [i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Compare (IBufferOffsetSize buffer1, IBufferOffsetSize buffer2)
|
||||
{
|
||||
if (buffer1 == null || buffer2 == null)
|
||||
return false;
|
||||
|
||||
if (buffer1.Size != buffer2.Size)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < buffer1.Size; i++) {
|
||||
if (buffer1.Buffer [buffer1.Offset + i] != buffer2.Buffer [buffer2.Offset + i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Compare (byte[] buffer1, byte[] buffer2)
|
||||
{
|
||||
if (buffer1 == null || buffer2 == null)
|
||||
return false;
|
||||
|
||||
return Compare (buffer1, 0, buffer1.Length, buffer2, 0, buffer2.Length);
|
||||
}
|
||||
|
||||
public static bool Compare (byte[] buffer1, int offset1, int size1, byte[] buffer2, int offset2, int size2)
|
||||
{
|
||||
if (buffer1 == null || buffer2 == null)
|
||||
return false;
|
||||
|
||||
if (size1 != size2)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < size1; i++) {
|
||||
if (buffer1 [offset1 + i] != buffer2 [offset2 + i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public static int ConstantTimeCompare (byte[] buffer1, int offset1, int size1, byte[] buffer2, int offset2, int size2)
|
||||
{
|
||||
int status = 0;
|
||||
int effectiveSize;
|
||||
if (size1 < size2) {
|
||||
status--;
|
||||
effectiveSize = size1;
|
||||
} else if (size2 < size1) {
|
||||
status--;
|
||||
effectiveSize = size2;
|
||||
} else {
|
||||
effectiveSize = size1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < effectiveSize; i++) {
|
||||
if (buffer1 [offset1 + i] != buffer2 [offset2 + i])
|
||||
status--;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
protected void SetBuffer (byte[] buffer, int offset, int size)
|
||||
{
|
||||
innerBuffer = new BufferOffsetSize (buffer, offset, size);
|
||||
}
|
||||
|
||||
protected override void Clear ()
|
||||
{
|
||||
var disposable = innerBuffer as IDisposable;
|
||||
if (disposable != null)
|
||||
disposable.Dispose ();
|
||||
innerBuffer = null;
|
||||
Position = 0;
|
||||
}
|
||||
|
||||
public static readonly byte[] EmptyArray = new byte [0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
//
|
||||
// TlsMultiBuffer.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
|
||||
namespace Mono.Security.Interface
|
||||
{
|
||||
public class TlsMultiBuffer
|
||||
{
|
||||
MemoryChunk first, last;
|
||||
|
||||
private class MemoryChunk : BufferOffsetSize
|
||||
{
|
||||
public MemoryChunk next;
|
||||
|
||||
public MemoryChunk (byte[] buffer, int offset, int size)
|
||||
: base (buffer, offset, size)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEmpty {
|
||||
get { return first == null; }
|
||||
}
|
||||
|
||||
public bool IsSingle {
|
||||
get { return first != null && first.next == null; }
|
||||
}
|
||||
|
||||
public void Add (TlsBuffer buffer)
|
||||
{
|
||||
Add (buffer.Buffer, buffer.Offset, buffer.Size);
|
||||
}
|
||||
|
||||
public void Add (byte[] buffer)
|
||||
{
|
||||
Add (buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
public void Add (byte[] buffer, int offset, int size)
|
||||
{
|
||||
var chunk = new MemoryChunk (buffer, offset, size);
|
||||
if (last == null)
|
||||
first = last = chunk;
|
||||
else {
|
||||
last.next = chunk;
|
||||
last = chunk;
|
||||
}
|
||||
}
|
||||
|
||||
public BufferOffsetSize[] GetBufferArray ()
|
||||
{
|
||||
int count = 0;
|
||||
for (var ptr = first; ptr != null; ptr = ptr.next)
|
||||
count++;
|
||||
var array = new BufferOffsetSize [count];
|
||||
count = 0;
|
||||
for (var ptr = first; ptr != null; ptr = ptr.next)
|
||||
array [count++] = ptr;
|
||||
return array;
|
||||
}
|
||||
|
||||
public void Clear ()
|
||||
{
|
||||
for (var ptr = first; ptr != null; ptr = ptr.next)
|
||||
ptr.Dispose ();
|
||||
first = last = null;
|
||||
}
|
||||
|
||||
public BufferOffsetSize GetBuffer ()
|
||||
{
|
||||
int totalSize = 0;
|
||||
for (var ptr = first; ptr != null; ptr = ptr.next)
|
||||
totalSize += ptr.Size;
|
||||
|
||||
var outBuffer = new BufferOffsetSize (new byte [totalSize]);
|
||||
int offset = 0;
|
||||
for (var ptr = first; ptr != null; ptr = ptr.next) {
|
||||
Buffer.BlockCopy (ptr.Buffer, ptr.Offset, outBuffer.Buffer, offset, ptr.Size);
|
||||
offset += ptr.Size;
|
||||
}
|
||||
return outBuffer;
|
||||
}
|
||||
|
||||
public BufferOffsetSize StealBuffer ()
|
||||
{
|
||||
if (IsSingle) {
|
||||
var retval = first;
|
||||
first = last = null;
|
||||
return retval;
|
||||
}
|
||||
|
||||
return GetBuffer ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,12 +46,7 @@ using Mono.Security.Cryptography;
|
||||
namespace Mono.Security.Protocol.Ntlm {
|
||||
|
||||
[Obsolete (Type3Message.LegacyAPIWarning)]
|
||||
#if INSIDE_SYSTEM
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
class ChallengeResponse : IDisposable {
|
||||
public class ChallengeResponse : IDisposable {
|
||||
|
||||
static private byte[] magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };
|
||||
|
||||
|
||||
@@ -49,12 +49,7 @@ using Mono.Security.Cryptography;
|
||||
|
||||
namespace Mono.Security.Protocol.Ntlm {
|
||||
|
||||
#if INSIDE_SYSTEM
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
static class ChallengeResponse2 {
|
||||
public static class ChallengeResponse2 {
|
||||
|
||||
static private byte[] magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };
|
||||
|
||||
|
||||
@@ -39,12 +39,7 @@ using System.Globalization;
|
||||
|
||||
namespace Mono.Security.Protocol.Ntlm {
|
||||
|
||||
#if INSIDE_SYSTEM
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
abstract class MessageBase {
|
||||
public abstract class MessageBase {
|
||||
|
||||
static private byte[] header = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00 };
|
||||
|
||||
|
||||
@@ -36,12 +36,7 @@ namespace Mono.Security.Protocol.Ntlm {
|
||||
* is LM_and_NTLM_and_try_NTLMv2_Session.
|
||||
*/
|
||||
|
||||
#if INSIDE_SYSTEM
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
enum NtlmAuthLevel {
|
||||
public enum NtlmAuthLevel {
|
||||
/* Use LM and NTLM, never use NTLMv2 session security. */
|
||||
LM_and_NTLM,
|
||||
|
||||
|
||||
@@ -40,12 +40,7 @@ using System;
|
||||
namespace Mono.Security.Protocol.Ntlm {
|
||||
|
||||
[Flags]
|
||||
#if INSIDE_SYSTEM
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
enum NtlmFlags : int {
|
||||
public enum NtlmFlags : int {
|
||||
// The client sets this flag to indicate that it supports Unicode strings.
|
||||
NegotiateUnicode = 0x00000001,
|
||||
// This is set to indicate that the client supports OEM strings.
|
||||
|
||||
@@ -38,48 +38,13 @@ namespace Mono.Security.Protocol.Ntlm {
|
||||
* is LM_and_NTLM_and_try_NTLMv2_Session.
|
||||
*/
|
||||
|
||||
#if INSIDE_SYSTEM
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
static class NtlmSettings {
|
||||
public static class NtlmSettings {
|
||||
|
||||
static NtlmAuthLevel defaultAuthLevel = NtlmAuthLevel.LM_and_NTLM_and_try_NTLMv2_Session;
|
||||
|
||||
static FieldInfo GetDefaultAuthLevelField ()
|
||||
{
|
||||
#if INSIDE_SYSTEM
|
||||
return null;
|
||||
#else
|
||||
var type = typeof (HttpWebRequest).Assembly.GetType ("Mono.Security.Protocol.Ntlm.NtlmSettings", false);
|
||||
if (type == null)
|
||||
return null;
|
||||
return type.GetField ("defaultAuthLevel", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if INSIDE_SYSTEM
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
static NtlmAuthLevel DefaultAuthLevel {
|
||||
get {
|
||||
var field = GetDefaultAuthLevelField ();
|
||||
if (field != null)
|
||||
return (NtlmAuthLevel)field.GetValue (null);
|
||||
else
|
||||
return defaultAuthLevel;
|
||||
}
|
||||
|
||||
set {
|
||||
var field = GetDefaultAuthLevelField ();
|
||||
if (field != null)
|
||||
field.SetValue (null, value);
|
||||
else
|
||||
defaultAuthLevel = value;
|
||||
}
|
||||
public static NtlmAuthLevel DefaultAuthLevel {
|
||||
get { return defaultAuthLevel; }
|
||||
set { defaultAuthLevel = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,12 +39,7 @@ using System.Text;
|
||||
|
||||
namespace Mono.Security.Protocol.Ntlm {
|
||||
|
||||
#if INSIDE_SYSTEM
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
class Type1Message : MessageBase {
|
||||
public class Type1Message : MessageBase {
|
||||
|
||||
private string _host;
|
||||
private string _domain;
|
||||
|
||||
@@ -39,12 +39,7 @@ using System.Security.Cryptography;
|
||||
|
||||
namespace Mono.Security.Protocol.Ntlm {
|
||||
|
||||
#if INSIDE_SYSTEM
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
class Type2Message : MessageBase {
|
||||
public class Type2Message : MessageBase {
|
||||
|
||||
private byte[] _nonce;
|
||||
private string _targetName;
|
||||
|
||||
@@ -39,12 +39,7 @@ using System.Text;
|
||||
|
||||
namespace Mono.Security.Protocol.Ntlm {
|
||||
|
||||
#if INSIDE_SYSTEM
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
class Type3Message : MessageBase {
|
||||
public class Type3Message : MessageBase {
|
||||
|
||||
private NtlmAuthLevel _level;
|
||||
private byte[] _challenge;
|
||||
|
||||
@@ -152,3 +152,9 @@
|
||||
./Mono.Security.Interface/TlsException.cs
|
||||
./Mono.Security.Interface/TlsProtocolCode.cs
|
||||
./Mono.Security.Interface/TlsProtocols.cs
|
||||
|
||||
./Mono.Security.Interface/BufferOffsetSize.cs
|
||||
./Mono.Security.Interface/SecretParameters.cs
|
||||
./Mono.Security.Interface/SecureBuffer.cs
|
||||
./Mono.Security.Interface/TlsBuffer.cs
|
||||
./Mono.Security.Interface/TlsMultiBuffer.cs
|
||||
@@ -61,15 +61,6 @@
|
||||
./Mono.Security.X509.Extensions/SubjectKeyIdentifierExtension.cs
|
||||
./Mono.Security.Cryptography/TlsHMAC.cs
|
||||
./Mono.Security.Cryptography/MD5SHA1.cs
|
||||
./Mono.Security.Protocol.Ntlm/ChallengeResponse.cs
|
||||
./Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs
|
||||
./Mono.Security.Protocol.Ntlm/MessageBase.cs
|
||||
./Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs
|
||||
./Mono.Security.Protocol.Ntlm/NtlmFlags.cs
|
||||
./Mono.Security.Protocol.Ntlm/NtlmSettings.cs
|
||||
./Mono.Security.Protocol.Ntlm/Type1Message.cs
|
||||
./Mono.Security.Protocol.Ntlm/Type2Message.cs
|
||||
./Mono.Security.Protocol.Ntlm/Type3Message.cs
|
||||
./Mono.Security.Protocol.Tls/Alert.cs
|
||||
./Mono.Security.Protocol.Tls/CipherAlgorithmType.cs
|
||||
./Mono.Security.Protocol.Tls/CipherSuite.cs
|
||||
@@ -130,3 +121,9 @@
|
||||
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs
|
||||
./Mono.Xml/MiniParser.cs
|
||||
./Mono.Xml/SecurityParser.cs
|
||||
|
||||
./Mono.Security.Interface/BufferOffsetSize.cs
|
||||
./Mono.Security.Interface/SecretParameters.cs
|
||||
./Mono.Security.Interface/SecureBuffer.cs
|
||||
./Mono.Security.Interface/TlsBuffer.cs
|
||||
./Mono.Security.Interface/TlsMultiBuffer.cs
|
||||
@@ -277,6 +277,10 @@ namespace MonoTests.System.Linq.Expressions
|
||||
[Test]
|
||||
public void NegateDecimal ()
|
||||
{
|
||||
// Make sure the negate method is not linked away
|
||||
decimal d1 = 1;
|
||||
decimal d2 = -d1;
|
||||
|
||||
var d = Expression.Parameter (typeof (decimal), "l");
|
||||
|
||||
var meth = typeof (decimal).GetMethod ("op_UnaryNegation", new [] { typeof (decimal) });
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace System.Net.Http
|
||||
|
||||
public string ReasonPhrase {
|
||||
get {
|
||||
return reasonPhrase ?? HttpListenerResponse.GetStatusDescription ((int) statusCode);
|
||||
return reasonPhrase ?? HttpListenerResponseHelper.GetStatusDescription ((int) statusCode);
|
||||
}
|
||||
set {
|
||||
reasonPhrase = value;
|
||||
|
||||
@@ -19,6 +19,10 @@ else
|
||||
LIB_MCS_FLAGS += /d:NO_CONFIGURATION /d:NO_SECURITY_ATTRIBUTES /d:NO_CODEDOM /d:NO_DESKTOP_SECURITY
|
||||
endif
|
||||
|
||||
ifdef XAMMAC_4_5
|
||||
LIB_MCS_FLAGS += /d:NO_CONFIGURATION
|
||||
endif
|
||||
|
||||
TEST_RESOURCE_FILES = \
|
||||
Test/Resources/WSDL/collections.wsdl \
|
||||
Test/Resources/WSDL/custom-collections.wsdl
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
#include monotouch_System.ServiceModel.Internals.dll.sources
|
||||
@@ -31,6 +31,6 @@ System.Web.Services.Description/WebReferenceOptionsTest.cs
|
||||
System.Web.Services.Description/WebServicesInteroperabilityTest.cs
|
||||
System.Web.Services.Protocols/LogicalMethodInfoTest.cs
|
||||
System.Web.Services.Protocols/SoapHttpClientProtocolTest.cs
|
||||
System.Web.Services.Protocols/SocketResponder.cs
|
||||
System.Web.Services.Protocols/WebClientProtocolTest.cs
|
||||
System.Web.Services.Protocols/SoapServerTypeTest.cs
|
||||
../../test-helpers/SocketResponder.cs
|
||||
+5
-15
@@ -39,6 +39,8 @@ using System.Xml.Serialization;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Web.Services.Protocols
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -49,9 +51,7 @@ namespace MonoTests.System.Web.Services.Protocols
|
||||
public void OutParametersTest ()
|
||||
{
|
||||
IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 5000);
|
||||
using (SocketResponder sr = new SocketResponder (localEP, new SocketRequestHandler (OutParametersResponse))) {
|
||||
sr.Start ();
|
||||
|
||||
using (SocketResponder sr = new SocketResponder (localEP, s => OutParametersResponse (s))) {
|
||||
FooService service = new FooService ();
|
||||
service.Url = "http://" + IPAddress.Loopback.ToString () + ":5000/";
|
||||
|
||||
@@ -62,8 +62,6 @@ namespace MonoTests.System.Web.Services.Protocols
|
||||
Assert.AreEqual (0, a, "#A2");
|
||||
Assert.IsFalse (b, "#A3");
|
||||
service.Dispose ();
|
||||
|
||||
sr.Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,9 +70,7 @@ namespace MonoTests.System.Web.Services.Protocols
|
||||
public void FaultTest ()
|
||||
{
|
||||
IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 5000);
|
||||
using (SocketResponder sr = new SocketResponder (localEP, new SocketRequestHandler (FaultResponse_Qualified))) {
|
||||
sr.Start ();
|
||||
|
||||
using (SocketResponder sr = new SocketResponder (localEP, s => FaultResponse_Qualified (s))) {
|
||||
FooService service = new FooService ();
|
||||
service.Url = "http://" + IPAddress.Loopback.ToString () + ":5000/";
|
||||
try {
|
||||
@@ -97,13 +93,9 @@ namespace MonoTests.System.Web.Services.Protocols
|
||||
Assert.AreEqual ("Failure processing request.", ex.Message, "#A9");
|
||||
}
|
||||
service.Dispose ();
|
||||
|
||||
sr.Stop ();
|
||||
}
|
||||
|
||||
using (SocketResponder sr = new SocketResponder (localEP, new SocketRequestHandler (FaultResponse_Unqualified))) {
|
||||
sr.Start ();
|
||||
|
||||
using (SocketResponder sr = new SocketResponder (localEP, s => FaultResponse_Unqualified (s))) {
|
||||
FooService service = new FooService ();
|
||||
service.Url = "http://" + IPAddress.Loopback.ToString () + ":5000/";
|
||||
try {
|
||||
@@ -126,8 +118,6 @@ namespace MonoTests.System.Web.Services.Protocols
|
||||
Assert.AreEqual ("Failure processing request.", ex.Message, "#B9");
|
||||
}
|
||||
service.Dispose ();
|
||||
|
||||
sr.Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
//
|
||||
// SocketResponder.cs - Utility class for tests that require a listener
|
||||
//
|
||||
// Author:
|
||||
// Gert Driesen ([email protected])
|
||||
//
|
||||
// Copyright (C) 2007 Gert Driesen
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace MonoTests.System.Web.Services.Protocols
|
||||
{
|
||||
public delegate byte [] SocketRequestHandler (Socket socket);
|
||||
|
||||
public class SocketResponder : IDisposable
|
||||
{
|
||||
private TcpListener tcpListener;
|
||||
private readonly IPEndPoint _localEndPoint;
|
||||
private Thread listenThread;
|
||||
private SocketRequestHandler _requestHandler;
|
||||
private bool _stopped = true;
|
||||
private readonly object _syncRoot = new object ();
|
||||
|
||||
private const int SOCKET_CLOSED = 10004;
|
||||
|
||||
public SocketResponder (IPEndPoint localEP, SocketRequestHandler requestHandler)
|
||||
{
|
||||
_localEndPoint = localEP;
|
||||
_requestHandler = requestHandler;
|
||||
}
|
||||
|
||||
public IPEndPoint LocalEndPoint
|
||||
{
|
||||
get { return _localEndPoint; }
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
Stop ();
|
||||
}
|
||||
|
||||
public bool IsStopped
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_syncRoot) {
|
||||
return _stopped;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Start ()
|
||||
{
|
||||
lock (_syncRoot) {
|
||||
if (!_stopped)
|
||||
return;
|
||||
_stopped = false;
|
||||
listenThread = new Thread (new ThreadStart (Listen));
|
||||
listenThread.Start ();
|
||||
Thread.Sleep (20); // allow listener to start
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop ()
|
||||
{
|
||||
lock (_syncRoot) {
|
||||
if (_stopped)
|
||||
return;
|
||||
_stopped = true;
|
||||
if (tcpListener != null) {
|
||||
tcpListener.Stop ();
|
||||
tcpListener = null;
|
||||
#if MONO_FEATURE_THREAD_ABORT
|
||||
listenThread.Abort ();
|
||||
#else
|
||||
listenThread.Interrupt ();
|
||||
#endif
|
||||
listenThread.Join ();
|
||||
listenThread = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Listen ()
|
||||
{
|
||||
tcpListener = new TcpListener (LocalEndPoint);
|
||||
tcpListener.Start ();
|
||||
try {
|
||||
Socket socket = tcpListener.AcceptSocket ();
|
||||
socket.Send (_requestHandler (socket));
|
||||
socket.Close ();
|
||||
} catch (SocketException ex) {
|
||||
// ignore interruption of blocking call
|
||||
if (ex.ErrorCode != SOCKET_CLOSED)
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,30 @@ namespace System.Web
|
||||
{
|
||||
}
|
||||
|
||||
public override void Add (string name, string value)
|
||||
{
|
||||
if (IsReadOnly)
|
||||
throw new PlatformNotSupportedException ();
|
||||
|
||||
base.Set (name, value);
|
||||
}
|
||||
|
||||
public override void Set (string name, string value)
|
||||
{
|
||||
if (IsReadOnly)
|
||||
throw new PlatformNotSupportedException ();
|
||||
|
||||
base.Set (name, value);
|
||||
}
|
||||
|
||||
public override void Remove (string name)
|
||||
{
|
||||
if (IsReadOnly)
|
||||
throw new PlatformNotSupportedException ();
|
||||
|
||||
base.Remove (name);
|
||||
}
|
||||
|
||||
protected override void InsertInfo()
|
||||
{
|
||||
HttpWorkerRequest worker_request = _request.WorkerRequest;
|
||||
|
||||
@@ -254,6 +254,30 @@ namespace MonoTests.System.Web {
|
||||
{
|
||||
HttpContext.Current.Request.MapPath ("Web.config", "something", false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
public void ReadOnlyHeadersAdd ()
|
||||
{
|
||||
var r = new HttpRequest ("file", "http://www.gnome.org", "key=value&key2=value%32second");
|
||||
r.Headers.Add ("a","a");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
public void ReadOnlyHeadersSet ()
|
||||
{
|
||||
var r = new HttpRequest ("file", "http://www.gnome.org", "key=value&key2=value%32second");
|
||||
r.Headers.Set ("a","a");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
public void ReadOnlyHeadersRemove ()
|
||||
{
|
||||
var r = new HttpRequest ("file", "http://www.gnome.org", "key=value&key2=value%32second");
|
||||
r.Headers.Remove ("a");
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace System.Windows.Forms {
|
||||
public object [] Args;
|
||||
public AsyncMethodResult Result;
|
||||
public ExecutionContext Context;
|
||||
public SynchronizationContext SyncContext;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -468,11 +468,10 @@ namespace System.Windows.Forms {
|
||||
#endregion // XplatUI Driver Methods
|
||||
}
|
||||
|
||||
internal class XplatUIDriverSupport {
|
||||
static class XplatUIDriverSupport {
|
||||
#region XplatUI Driver Support Methods
|
||||
internal static void ExecutionCallback (object state)
|
||||
internal static void ExecutionCallback (AsyncMethodData data)
|
||||
{
|
||||
AsyncMethodData data = (AsyncMethodData) state;
|
||||
AsyncMethodResult result = data.Result;
|
||||
|
||||
object ret;
|
||||
@@ -492,6 +491,25 @@ namespace System.Windows.Forms {
|
||||
}
|
||||
}
|
||||
|
||||
static void ExecutionCallbackInContext (object state)
|
||||
{
|
||||
AsyncMethodData data = (AsyncMethodData) state;
|
||||
|
||||
if (data.SyncContext == null) {
|
||||
ExecutionCallback (data);
|
||||
return;
|
||||
}
|
||||
|
||||
var oldContext = SynchronizationContext.Current;
|
||||
SynchronizationContext.SetSynchronizationContext (data.SyncContext);
|
||||
|
||||
try {
|
||||
ExecutionCallback (data);
|
||||
} finally {
|
||||
SynchronizationContext.SetSynchronizationContext (oldContext);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void ExecuteClientMessage (GCHandle gchandle)
|
||||
{
|
||||
AsyncMethodData data = (AsyncMethodData) gchandle.Target;
|
||||
@@ -499,7 +517,8 @@ namespace System.Windows.Forms {
|
||||
if (data.Context == null) {
|
||||
ExecutionCallback (data);
|
||||
} else {
|
||||
ExecutionContext.Run (data.Context, new ContextCallback (ExecutionCallback), data);
|
||||
data.SyncContext = SynchronizationContext.Current;
|
||||
ExecutionContext.Run (data.Context, new ContextCallback (ExecutionCallbackInContext), data);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
||||
@@ -646,8 +646,15 @@ namespace System.Xml.Serialization
|
||||
{
|
||||
if (memberValue == null) return null;
|
||||
Type type = memberValue.GetType();
|
||||
foreach (XmlTypeMapElementInfo elem in _itemInfo)
|
||||
if (elem.TypeData.Type == type) return elem;
|
||||
XmlTypeMapElementInfo bestMatch = null;
|
||||
foreach (XmlTypeMapElementInfo elem in _itemInfo) {
|
||||
if (elem.TypeData.Type == type)
|
||||
return elem;
|
||||
if (elem.TypeData.Type.IsAssignableFrom (type) &&
|
||||
(bestMatch == null || elem.TypeData.Type.IsAssignableFrom (bestMatch.TypeData.Type)))
|
||||
bestMatch = elem;
|
||||
}
|
||||
return bestMatch;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -711,6 +711,13 @@ namespace MonoTests.System.Xml.TestClasses
|
||||
public object data;
|
||||
}
|
||||
|
||||
public class SubclassTestList
|
||||
{
|
||||
[XmlElement ("a", typeof (SimpleClass))]
|
||||
[XmlElement ("b", typeof (SubclassTestBase))]
|
||||
public List<object> Items;
|
||||
}
|
||||
|
||||
public class DictionaryWithIndexer : DictionaryBase
|
||||
{
|
||||
public TimeSpan this[int index]
|
||||
|
||||
@@ -1939,6 +1939,17 @@ namespace MonoTests.System.XmlSerialization
|
||||
Assert.AreEqual (Infoset (res), WriterText);
|
||||
}
|
||||
|
||||
[Test] // Covers #36829
|
||||
public void TestSubclassElementList ()
|
||||
{
|
||||
var o = new SubclassTestList () { Items = new List<object> () { new SubclassTestSub () } };
|
||||
Serialize (o);
|
||||
|
||||
string res = "<SubclassTestList xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
|
||||
res += "<b xsi:type=\"SubclassTestSub\"/></SubclassTestList>";
|
||||
Assert.AreEqual (Infoset (res), WriterText);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (InvalidOperationException))]
|
||||
public void TestArrayAttributeWithWrongDataType ()
|
||||
|
||||
@@ -80,4 +80,6 @@ using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewSystemSource, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
|
||||
[assembly: InternalsVisibleTo ("Mono.Security.Providers.OldTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
|
||||
[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
|
||||
[assembly: InternalsVisibleTo ("Mono.Security.Providers.DotNet, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
|
||||
[assembly: InternalsVisibleTo ("Mono.Security, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
|
||||
@@ -366,8 +366,6 @@ namespace Mono.CSharp
|
||||
}
|
||||
}
|
||||
|
||||
args.Append("/sdk:4.5");
|
||||
|
||||
args.Append (" -- ");
|
||||
foreach (string source in fileNames)
|
||||
args.AppendFormat("\"{0}\" ",source);
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace Mono.Http
|
||||
return null;
|
||||
|
||||
lock (cache) {
|
||||
var ds = cache.GetOrCreateValue (request);
|
||||
var ds = cache.GetValue (request, x => new NtlmSession ());
|
||||
return ds.Authenticate (header, webRequest, credentials);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Mono.Net.Security.Private
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool SupportsTlsContext {
|
||||
internal override bool SupportsTlsContext {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
|
||||
@@ -134,25 +134,35 @@ namespace Mono.Net.Security
|
||||
|
||||
#if SECURITY_DEP && !MONO_FEATURE_NEW_SYSTEM_SOURCE
|
||||
|
||||
#if !MOBILE
|
||||
static Dictionary<string,string> providerRegistration;
|
||||
|
||||
internal static void RegisterProvider (string name, string type)
|
||||
static Type LookupProviderType (string name, bool throwOnError)
|
||||
{
|
||||
lock (locker) {
|
||||
InitializeProviderRegistration ();
|
||||
providerRegistration.Add (name, type);
|
||||
string typeName;
|
||||
if (!providerRegistration.TryGetValue (name, out typeName)) {
|
||||
if (throwOnError)
|
||||
throw new NotSupportedException (string.Format ("No such TLS Provider: `{0}'.", name));
|
||||
return null;
|
||||
}
|
||||
var type = Type.GetType (typeName, false);
|
||||
if (type == null && throwOnError)
|
||||
throw new NotSupportedException (string.Format ("Could not find TLS Provider: `{0}'.", typeName));
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
static string LookupProvider (string name)
|
||||
static MSI.MonoTlsProvider LookupProvider (string name, bool throwOnError)
|
||||
{
|
||||
lock (locker) {
|
||||
InitializeProviderRegistration ();
|
||||
string type;
|
||||
if (!providerRegistration.TryGetValue (name, out type))
|
||||
type = null;
|
||||
return type;
|
||||
var type = LookupProviderType (name, throwOnError);
|
||||
if (type == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
return (MSI.MonoTlsProvider)Activator.CreateInstance (type);
|
||||
} catch (Exception ex) {
|
||||
throw new NotSupportedException (string.Format ("Unable to instantiate TLS Provider `{0}'.", type), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,11 +172,12 @@ namespace Mono.Net.Security
|
||||
if (providerRegistration != null)
|
||||
return;
|
||||
providerRegistration = new Dictionary<string,string> ();
|
||||
providerRegistration.Add ("newtls", "Mono.Security.Providers.NewTls.NewTlsProvider, Mono.Security.Providers.NewTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=84e3aee7225169c2");
|
||||
providerRegistration.Add ("oldtls", "Mono.Security.Providers.OldTls.OldTlsProvider, Mono.Security.Providers.OldTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=84e3aee7225169c2");
|
||||
providerRegistration.Add ("newtls", "Mono.Security.Providers.NewTls.NewTlsProvider, Mono.Security.Providers.NewTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
|
||||
providerRegistration.Add ("oldtls", "Mono.Security.Providers.OldTls.OldTlsProvider, Mono.Security.Providers.OldTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
|
||||
}
|
||||
}
|
||||
|
||||
#if !MOBILE
|
||||
static IMonoTlsProvider TryDynamicLoad ()
|
||||
{
|
||||
var variable = Environment.GetEnvironmentVariable ("MONO_TLS_PROVIDER");
|
||||
@@ -176,25 +187,7 @@ namespace Mono.Net.Security
|
||||
if (string.Equals (variable, "default", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
string typeName;
|
||||
if (variable.IndexOfAny (new char[] { ',', '.', '=' }) > 0) {
|
||||
typeName = variable;
|
||||
} else {
|
||||
typeName = LookupProvider (variable);
|
||||
if (typeName == null)
|
||||
throw new NotSupportedException (string.Format ("No such TLS Provider: `{0}'.", typeName));
|
||||
}
|
||||
|
||||
var type = Type.GetType (typeName, false);
|
||||
if (type == null)
|
||||
throw new NotSupportedException (string.Format ("Could not find TLS Provider: `{0}'.", typeName));
|
||||
|
||||
MSI.MonoTlsProvider provider;
|
||||
try {
|
||||
provider = (MSI.MonoTlsProvider)Activator.CreateInstance (type);
|
||||
} catch (Exception ex) {
|
||||
throw new NotSupportedException (string.Format ("Unable to instantiate TLS Provider `{0}'.", typeName), ex);
|
||||
}
|
||||
var provider = LookupProvider (variable, true);
|
||||
|
||||
return new Private.MonoTlsProviderWrapper (provider);
|
||||
}
|
||||
@@ -237,6 +230,11 @@ namespace Mono.Net.Security
|
||||
return provider.Provider;
|
||||
}
|
||||
|
||||
internal static MSI.MonoTlsProvider GetProvider (string name)
|
||||
{
|
||||
return LookupProvider (name, false);
|
||||
}
|
||||
|
||||
internal static bool HasProvider {
|
||||
get {
|
||||
lock (locker) {
|
||||
@@ -245,9 +243,10 @@ namespace Mono.Net.Security
|
||||
}
|
||||
}
|
||||
|
||||
internal static void InstallProvider (MSI.MonoTlsProvider provider)
|
||||
internal static void SetDefaultProvider (string name)
|
||||
{
|
||||
lock (locker) {
|
||||
var provider = LookupProvider (name, true);
|
||||
currentProvider = new Private.MonoTlsProviderWrapper (provider);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Mono.Net.Security.Private
|
||||
bool remoteCertRequired, MSI.MonoEncryptionPolicy encryptionPolicy,
|
||||
MSI.MonoTlsSettings settings);
|
||||
|
||||
public override MSI.IMonoTlsContext CreateTlsContext (
|
||||
internal override MSI.IMonoTlsContext CreateTlsContext (
|
||||
string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
|
||||
X509Certificate serverCertificate, XX509CertificateCollection clientCertificates,
|
||||
bool remoteCertRequired, MSI.MonoEncryptionPolicy encryptionPolicy,
|
||||
|
||||
@@ -84,10 +84,10 @@ namespace Mono.Net.Security
|
||||
}
|
||||
}
|
||||
|
||||
internal static void InstallProvider (object provider)
|
||||
internal static void SetDefaultProvider (string name)
|
||||
{
|
||||
#if SECURITY_DEP
|
||||
MonoTlsProviderFactory.InstallProvider ((MSI.MonoTlsProvider)provider);
|
||||
MonoTlsProviderFactory.SetDefaultProvider (name);
|
||||
#else
|
||||
throw new NotSupportedException ();
|
||||
#endif
|
||||
@@ -120,5 +120,13 @@ namespace Mono.Net.Security
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static object GetProvider (string name)
|
||||
{
|
||||
#if SECURITY_DEP
|
||||
return MonoTlsProviderFactory.GetProvider (name);
|
||||
#else
|
||||
throw new NotSupportedException ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1281,11 +1281,11 @@ namespace System.Diagnostics {
|
||||
return false;
|
||||
|
||||
#if MONO_FEATURE_PROCESS_START
|
||||
if (async_output != null && !async_output.IsCompleted)
|
||||
async_output.AsyncWaitHandle.WaitOne ();
|
||||
if (async_output != null)
|
||||
async_output.WaitUtilEOF ();
|
||||
|
||||
if (async_error != null && !async_error.IsCompleted)
|
||||
async_error.AsyncWaitHandle.WaitOne ();
|
||||
if (async_error != null)
|
||||
async_error.WaitUtilEOF ();
|
||||
#endif // MONO_FEATURE_PROCESS_START
|
||||
|
||||
if (EnableRaisingEvents)
|
||||
@@ -1327,20 +1327,6 @@ namespace System.Diagnostics {
|
||||
[MonitoringDescription ("Raised when it receives error data")]
|
||||
public event DataReceivedEventHandler ErrorDataReceived;
|
||||
|
||||
void OnOutputDataReceived (string str)
|
||||
{
|
||||
DataReceivedEventHandler cb = OutputDataReceived;
|
||||
if (cb != null)
|
||||
cb (this, new DataReceivedEventArgs (str));
|
||||
}
|
||||
|
||||
void OnErrorDataReceived (string str)
|
||||
{
|
||||
DataReceivedEventHandler cb = ErrorDataReceived;
|
||||
if (cb != null)
|
||||
cb (this, new DataReceivedEventArgs (str));
|
||||
}
|
||||
|
||||
#if MONO_FEATURE_PROCESS_START
|
||||
[Flags]
|
||||
enum AsyncModes {
|
||||
@@ -1351,121 +1337,9 @@ namespace System.Diagnostics {
|
||||
AsyncError = 1 << 3
|
||||
}
|
||||
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
sealed class ProcessAsyncReader : IOAsyncResult
|
||||
{
|
||||
Process process;
|
||||
IntPtr handle;
|
||||
Stream stream;
|
||||
bool err_out;
|
||||
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
byte[] buffer = new byte [4096];
|
||||
|
||||
const int ERROR_INVALID_HANDLE = 6;
|
||||
|
||||
public ProcessAsyncReader (Process process, FileStream stream, bool err_out)
|
||||
: base (null, null)
|
||||
{
|
||||
this.process = process;
|
||||
this.handle = stream.SafeFileHandle.DangerousGetHandle ();
|
||||
this.stream = stream;
|
||||
this.err_out = err_out;
|
||||
}
|
||||
|
||||
public void BeginReadLine ()
|
||||
{
|
||||
IOSelector.Add (this.handle, new IOSelectorJob (IOOperation.Read, _ => Read (), null));
|
||||
}
|
||||
|
||||
void Read ()
|
||||
{
|
||||
int nread = 0;
|
||||
|
||||
try {
|
||||
nread = stream.Read (buffer, 0, buffer.Length);
|
||||
} catch (ObjectDisposedException) {
|
||||
} catch (IOException ex) {
|
||||
if (ex.HResult != (unchecked((int) 0x80070000) | (int) ERROR_INVALID_HANDLE))
|
||||
throw;
|
||||
} catch (NotSupportedException) {
|
||||
if (stream.CanRead)
|
||||
throw;
|
||||
}
|
||||
|
||||
if (nread == 0) {
|
||||
Flush (true);
|
||||
|
||||
if (err_out)
|
||||
process.OnOutputDataReceived (null);
|
||||
else
|
||||
process.OnErrorDataReceived (null);
|
||||
|
||||
IsCompleted = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
sb.Append (Encoding.Default.GetString (buffer, 0, nread));
|
||||
} catch {
|
||||
// Just in case the encoding fails...
|
||||
for (int i = 0; i < nread; i++) {
|
||||
sb.Append ((char) buffer [i]);
|
||||
}
|
||||
}
|
||||
|
||||
Flush (false);
|
||||
|
||||
IOSelector.Add (this.handle, new IOSelectorJob (IOOperation.Read, _ => Read (), null));
|
||||
}
|
||||
|
||||
void Flush (bool last)
|
||||
{
|
||||
if (sb.Length == 0 || (err_out && process.output_canceled) || (!err_out && process.error_canceled))
|
||||
return;
|
||||
|
||||
string[] strs = sb.ToString ().Split ('\n');
|
||||
|
||||
sb.Length = 0;
|
||||
|
||||
if (strs.Length == 0)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < strs.Length - 1; i++) {
|
||||
if (err_out)
|
||||
process.OnOutputDataReceived (strs [i]);
|
||||
else
|
||||
process.OnErrorDataReceived (strs [i]);
|
||||
}
|
||||
|
||||
string end = strs [strs.Length - 1];
|
||||
if (last || (strs.Length == 1 && end == "")) {
|
||||
if (err_out)
|
||||
process.OnOutputDataReceived (end);
|
||||
else
|
||||
process.OnErrorDataReceived (end);
|
||||
} else {
|
||||
sb.Append (end);
|
||||
}
|
||||
}
|
||||
|
||||
public void Close ()
|
||||
{
|
||||
IOSelector.Remove (handle);
|
||||
}
|
||||
|
||||
internal override void CompleteDisposed ()
|
||||
{
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
}
|
||||
|
||||
AsyncModes async_mode;
|
||||
bool output_canceled;
|
||||
bool error_canceled;
|
||||
ProcessAsyncReader async_output;
|
||||
ProcessAsyncReader async_error;
|
||||
AsyncStreamReader async_output;
|
||||
AsyncStreamReader async_error;
|
||||
|
||||
[ComVisibleAttribute(false)]
|
||||
public void BeginOutputReadLine ()
|
||||
@@ -1476,11 +1350,26 @@ namespace System.Diagnostics {
|
||||
if ((async_mode & AsyncModes.SyncOutput) != 0)
|
||||
throw new InvalidOperationException ("Cannot mix asynchronous and synchonous reads.");
|
||||
|
||||
if ((async_mode & AsyncModes.AsyncOutput) != 0)
|
||||
throw new InvalidOperationException ("An async read operation has already been started on the stream.");
|
||||
|
||||
async_mode |= AsyncModes.AsyncOutput;
|
||||
output_canceled = false;
|
||||
if (async_output == null) {
|
||||
async_output = new ProcessAsyncReader (this, (FileStream) output_stream.BaseStream, true);
|
||||
async_output.BeginReadLine ();
|
||||
|
||||
if (async_output == null)
|
||||
async_output = new AsyncStreamReader (this, output_stream.BaseStream, new UserCallBack(this.OutputReadNotifyUser), output_stream.CurrentEncoding);
|
||||
|
||||
async_output.BeginReadLine ();
|
||||
}
|
||||
|
||||
void OutputReadNotifyUser (String data)
|
||||
{
|
||||
// To avoid ---- between remove handler and raising the event
|
||||
DataReceivedEventHandler outputDataReceived = OutputDataReceived;
|
||||
if (outputDataReceived != null) {
|
||||
if (SynchronizingObject != null && SynchronizingObject.InvokeRequired)
|
||||
SynchronizingObject.Invoke (outputDataReceived, new object[] { this, new DataReceivedEventArgs (data) });
|
||||
else
|
||||
outputDataReceived (this, new DataReceivedEventArgs (data)); // Call back to user informing data is available.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1496,7 +1385,9 @@ namespace System.Diagnostics {
|
||||
if (async_output == null)
|
||||
throw new InvalidOperationException ("No async operation in progress.");
|
||||
|
||||
output_canceled = true;
|
||||
async_output.CancelOperation ();
|
||||
|
||||
async_mode &= ~AsyncModes.AsyncOutput;
|
||||
}
|
||||
|
||||
[ComVisibleAttribute(false)]
|
||||
@@ -1508,11 +1399,26 @@ namespace System.Diagnostics {
|
||||
if ((async_mode & AsyncModes.SyncError) != 0)
|
||||
throw new InvalidOperationException ("Cannot mix asynchronous and synchonous reads.");
|
||||
|
||||
if ((async_mode & AsyncModes.AsyncError) != 0)
|
||||
throw new InvalidOperationException ("An async read operation has already been started on the stream.");
|
||||
|
||||
async_mode |= AsyncModes.AsyncError;
|
||||
error_canceled = false;
|
||||
if (async_error == null) {
|
||||
async_error = new ProcessAsyncReader (this, (FileStream) error_stream.BaseStream, false);
|
||||
async_error.BeginReadLine ();
|
||||
|
||||
if (async_error == null)
|
||||
async_error = new AsyncStreamReader (this, error_stream.BaseStream, new UserCallBack(this.ErrorReadNotifyUser), error_stream.CurrentEncoding);
|
||||
|
||||
async_error.BeginReadLine ();
|
||||
}
|
||||
|
||||
void ErrorReadNotifyUser (String data)
|
||||
{
|
||||
// To avoid ---- between remove handler and raising the event
|
||||
DataReceivedEventHandler errorDataReceived = ErrorDataReceived;
|
||||
if (errorDataReceived != null) {
|
||||
if (SynchronizingObject != null && SynchronizingObject.InvokeRequired)
|
||||
SynchronizingObject.Invoke (errorDataReceived, new object[] { this, new DataReceivedEventArgs (data) });
|
||||
else
|
||||
errorDataReceived (this, new DataReceivedEventArgs (data)); // Call back to user informing data is available.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1528,7 +1434,9 @@ namespace System.Diagnostics {
|
||||
if (async_error == null)
|
||||
throw new InvalidOperationException ("No async operation in progress.");
|
||||
|
||||
error_canceled = true;
|
||||
async_error.CancelOperation ();
|
||||
|
||||
async_mode &= ~AsyncModes.AsyncError;
|
||||
}
|
||||
#else
|
||||
[Obsolete ("Process.BeginOutputReadLine is not supported on the current platform.", true)]
|
||||
@@ -1588,11 +1496,8 @@ namespace System.Diagnostics {
|
||||
// dispose all managed resources.
|
||||
if (disposing) {
|
||||
#if MONO_FEATURE_PROCESS_START
|
||||
/* These have open FileStreams on the pipes we are about to close */
|
||||
if (async_output != null)
|
||||
async_output.Close ();
|
||||
if (async_error != null)
|
||||
async_error.Close ();
|
||||
async_output = null;
|
||||
async_error = null;
|
||||
|
||||
if (input_stream != null) {
|
||||
if (!input_stream_exposed)
|
||||
@@ -1667,16 +1572,26 @@ namespace System.Diagnostics {
|
||||
|
||||
void StartBackgroundWaitForExit ()
|
||||
{
|
||||
IntPtr handle = process_handle;
|
||||
|
||||
if (enable_raising_events == 0)
|
||||
return;
|
||||
if (exited_event == null)
|
||||
return;
|
||||
if (process_handle == IntPtr.Zero)
|
||||
if (handle == IntPtr.Zero)
|
||||
return;
|
||||
if (background_wait_for_exit_thread != null)
|
||||
return;
|
||||
|
||||
Thread t = new Thread (_ => WaitForExit ()) { IsBackground = true };
|
||||
Thread t = new Thread (_ => {
|
||||
if (!WaitForExit_internal (handle, -1))
|
||||
return;
|
||||
|
||||
if (EnableRaisingEvents)
|
||||
OnExited ();
|
||||
});
|
||||
|
||||
t.IsBackground = true;
|
||||
|
||||
if (Interlocked.CompareExchange (ref background_wait_for_exit_thread, t, null) == null)
|
||||
t.Start ();
|
||||
|
||||
@@ -592,8 +592,16 @@ namespace System.Net.Mail {
|
||||
// FIXME: parse the list of extensions so we don't bother wasting
|
||||
// our time trying commands if they aren't supported.
|
||||
|
||||
// Get the FQDN of the local machine
|
||||
string fqdn = Dns.GetHostEntry (Dns.GetHostName ()).HostName;
|
||||
// get the host name (not fully qualified)
|
||||
string fqdn = Dns.GetHostName ();
|
||||
try {
|
||||
// we'll try for the fully qualified name - ref: bug #33551
|
||||
fqdn = Dns.GetHostEntry (fqdn).HostName;
|
||||
}
|
||||
catch (SocketException) {
|
||||
// we could not resolve our name but will continue with the partial name
|
||||
// IOW we won't fail to send email because of this - ref: bug #37246
|
||||
}
|
||||
status = SendCommand ("EHLO " + fqdn);
|
||||
|
||||
if (IsError (status)) {
|
||||
|
||||
@@ -397,7 +397,7 @@ namespace System.Net {
|
||||
HttpListenerResponse response = context.Response;
|
||||
response.StatusCode = status;
|
||||
response.ContentType = "text/html";
|
||||
string description = HttpListenerResponse.GetStatusDescription (status);
|
||||
string description = HttpListenerResponseHelper.GetStatusDescription (status);
|
||||
string str;
|
||||
if (msg != null)
|
||||
str = String.Format ("<h1>{0} ({1})</h1>", description, msg);
|
||||
|
||||
@@ -218,63 +218,10 @@ namespace System.Net {
|
||||
if (value < 100 || value > 999)
|
||||
throw new ProtocolViolationException ("StatusCode must be between 100 and 999.");
|
||||
status_code = value;
|
||||
status_description = GetStatusDescription (value);
|
||||
status_description = HttpListenerResponseHelper.GetStatusDescription (value);
|
||||
}
|
||||
}
|
||||
|
||||
internal static string GetStatusDescription (int code)
|
||||
{
|
||||
switch (code){
|
||||
case 100: return "Continue";
|
||||
case 101: return "Switching Protocols";
|
||||
case 102: return "Processing";
|
||||
case 200: return "OK";
|
||||
case 201: return "Created";
|
||||
case 202: return "Accepted";
|
||||
case 203: return "Non-Authoritative Information";
|
||||
case 204: return "No Content";
|
||||
case 205: return "Reset Content";
|
||||
case 206: return "Partial Content";
|
||||
case 207: return "Multi-Status";
|
||||
case 300: return "Multiple Choices";
|
||||
case 301: return "Moved Permanently";
|
||||
case 302: return "Found";
|
||||
case 303: return "See Other";
|
||||
case 304: return "Not Modified";
|
||||
case 305: return "Use Proxy";
|
||||
case 307: return "Temporary Redirect";
|
||||
case 400: return "Bad Request";
|
||||
case 401: return "Unauthorized";
|
||||
case 402: return "Payment Required";
|
||||
case 403: return "Forbidden";
|
||||
case 404: return "Not Found";
|
||||
case 405: return "Method Not Allowed";
|
||||
case 406: return "Not Acceptable";
|
||||
case 407: return "Proxy Authentication Required";
|
||||
case 408: return "Request Timeout";
|
||||
case 409: return "Conflict";
|
||||
case 410: return "Gone";
|
||||
case 411: return "Length Required";
|
||||
case 412: return "Precondition Failed";
|
||||
case 413: return "Request Entity Too Large";
|
||||
case 414: return "Request-Uri Too Long";
|
||||
case 415: return "Unsupported Media Type";
|
||||
case 416: return "Requested Range Not Satisfiable";
|
||||
case 417: return "Expectation Failed";
|
||||
case 422: return "Unprocessable Entity";
|
||||
case 423: return "Locked";
|
||||
case 424: return "Failed Dependency";
|
||||
case 500: return "Internal Server Error";
|
||||
case 501: return "Not Implemented";
|
||||
case 502: return "Bad Gateway";
|
||||
case 503: return "Service Unavailable";
|
||||
case 504: return "Gateway Timeout";
|
||||
case 505: return "Http Version Not Supported";
|
||||
case 507: return "Insufficient Storage";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public string StatusDescription {
|
||||
get { return status_description; }
|
||||
set {
|
||||
@@ -552,6 +499,64 @@ namespace System.Net {
|
||||
cookies.Add (cookie);
|
||||
}
|
||||
}
|
||||
|
||||
// do not inline into HttpListenerResponse as this recursively brings everything that's
|
||||
// reachable by IDisposable.Dispose (and that's quite a lot in this case).
|
||||
static class HttpListenerResponseHelper {
|
||||
|
||||
internal static string GetStatusDescription (int code)
|
||||
{
|
||||
switch (code){
|
||||
case 100: return "Continue";
|
||||
case 101: return "Switching Protocols";
|
||||
case 102: return "Processing";
|
||||
case 200: return "OK";
|
||||
case 201: return "Created";
|
||||
case 202: return "Accepted";
|
||||
case 203: return "Non-Authoritative Information";
|
||||
case 204: return "No Content";
|
||||
case 205: return "Reset Content";
|
||||
case 206: return "Partial Content";
|
||||
case 207: return "Multi-Status";
|
||||
case 300: return "Multiple Choices";
|
||||
case 301: return "Moved Permanently";
|
||||
case 302: return "Found";
|
||||
case 303: return "See Other";
|
||||
case 304: return "Not Modified";
|
||||
case 305: return "Use Proxy";
|
||||
case 307: return "Temporary Redirect";
|
||||
case 400: return "Bad Request";
|
||||
case 401: return "Unauthorized";
|
||||
case 402: return "Payment Required";
|
||||
case 403: return "Forbidden";
|
||||
case 404: return "Not Found";
|
||||
case 405: return "Method Not Allowed";
|
||||
case 406: return "Not Acceptable";
|
||||
case 407: return "Proxy Authentication Required";
|
||||
case 408: return "Request Timeout";
|
||||
case 409: return "Conflict";
|
||||
case 410: return "Gone";
|
||||
case 411: return "Length Required";
|
||||
case 412: return "Precondition Failed";
|
||||
case 413: return "Request Entity Too Large";
|
||||
case 414: return "Request-Uri Too Long";
|
||||
case 415: return "Unsupported Media Type";
|
||||
case 416: return "Requested Range Not Satisfiable";
|
||||
case 417: return "Expectation Failed";
|
||||
case 422: return "Unprocessable Entity";
|
||||
case 423: return "Locked";
|
||||
case 424: return "Failed Dependency";
|
||||
case 500: return "Internal Server Error";
|
||||
case 501: return "Not Implemented";
|
||||
case 502: return "Bad Gateway";
|
||||
case 503: return "Service Unavailable";
|
||||
case 504: return "Gateway Timeout";
|
||||
case 505: return "Http Version Not Supported";
|
||||
case 507: return "Insufficient Storage";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -25,11 +25,12 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.Net
|
||||
namespace Mono.Net
|
||||
{
|
||||
internal class CFObject : IDisposable
|
||||
{
|
||||
|
||||
@@ -415,12 +415,18 @@ namespace System.Net
|
||||
|
||||
internal void SetServerCertificate (X509Certificate server)
|
||||
{
|
||||
this.certificate = server;
|
||||
var cloned = server != null ? new X509Certificate (server) : null;
|
||||
var old = Interlocked.Exchange (ref certificate, cloned);
|
||||
if (old != null)
|
||||
old.Dispose ();
|
||||
}
|
||||
|
||||
internal void SetClientCertificate (X509Certificate clientCertificate)
|
||||
{
|
||||
this.clientCertificate = clientCertificate;
|
||||
var cloned = clientCertificate != null ? new X509Certificate (clientCertificate) : null;
|
||||
var old = Interlocked.Exchange (ref clientCertificate, cloned);
|
||||
if (old != null)
|
||||
old.Dispose ();
|
||||
}
|
||||
|
||||
internal bool CallEndPointDelegate (Socket sock, IPEndPoint remote)
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace System.Net
|
||||
static object classLock = new object ();
|
||||
MonoTlsStream tlsStream;
|
||||
|
||||
#if MONOTOUCH
|
||||
#if MONOTOUCH && !MONOTOUCH_TV && !MONOTOUCH_WATCH
|
||||
[System.Runtime.InteropServices.DllImport ("__Internal")]
|
||||
static extern void xamarin_start_wwan (string uri);
|
||||
#endif
|
||||
@@ -152,7 +152,7 @@ namespace System.Net
|
||||
IPHostEntry hostEntry = sPoint.HostEntry;
|
||||
|
||||
if (hostEntry == null) {
|
||||
#if MONOTOUCH
|
||||
#if MONOTOUCH && !MONOTOUCH_TV && !MONOTOUCH_WATCH
|
||||
xamarin_start_wwan (sPoint.Address.ToString ());
|
||||
hostEntry = sPoint.HostEntry;
|
||||
if (hostEntry == null) {
|
||||
@@ -160,7 +160,7 @@ namespace System.Net
|
||||
status = sPoint.UsesProxy ? WebExceptionStatus.ProxyNameResolutionFailure :
|
||||
WebExceptionStatus.NameResolutionFailure;
|
||||
return;
|
||||
#if MONOTOUCH
|
||||
#if MONOTOUCH && !MONOTOUCH_TV && !MONOTOUCH_WATCH
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ using System.Net.Cache;
|
||||
using System.Security.Principal;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.RegularExpressions;
|
||||
using Mono.Net;
|
||||
|
||||
#if NET_2_1
|
||||
using ConfigurationException = System.ArgumentException;
|
||||
|
||||
@@ -44,6 +44,7 @@ using MX = Mono.Security.X509;
|
||||
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates {
|
||||
|
||||
@@ -557,12 +558,17 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
{
|
||||
var pfx = new MX.PKCS12 ();
|
||||
try {
|
||||
var attrs = new Hashtable ();
|
||||
var localKeyId = new ArrayList ();
|
||||
localKeyId.Add (new byte[] { 1, 0, 0, 0 });
|
||||
attrs.Add (MX.PKCS9.localKeyId, localKeyId);
|
||||
|
||||
if (password != null)
|
||||
pfx.Password = password;
|
||||
pfx.AddCertificate (_cert);
|
||||
pfx.AddCertificate (_cert, attrs);
|
||||
var privateKey = PrivateKey;
|
||||
if (privateKey != null)
|
||||
pfx.AddPkcs8ShroudedKeyBag (privateKey);
|
||||
pfx.AddPkcs8ShroudedKeyBag (privateKey, attrs);
|
||||
return pfx.GetBytes ();
|
||||
} finally {
|
||||
pfx.Password = null;
|
||||
|
||||
@@ -1176,3 +1176,5 @@ ReferenceSources/_SslStream.cs
|
||||
../../../external/referencesource/System/compmod/system/codedom/compiler/ICodeParser.cs
|
||||
../../../external/referencesource/System/compmod/system/codedom/compiler/IndentTextWriter.cs
|
||||
../../../external/referencesource/System/compmod/system/codedom/compiler/LanguageOptions.cs
|
||||
|
||||
../../../external/referencesource/System/services/monitoring/system/diagnosticts/AsyncStreamReader.cs
|
||||
@@ -231,7 +231,6 @@ System.Net/ServicePointManagerTest.cs
|
||||
System.Net/ServicePointTest.cs
|
||||
System.Net/SocketPermissionAttributeTest.cs
|
||||
System.Net/SocketPermissionTest.cs
|
||||
System.Net/SocketResponder.cs
|
||||
System.Net/WebHeaderCollectionTest.cs
|
||||
System.Net/WebPermissionAttributeTest.cs
|
||||
System.Net/WebPermissionTest.cs
|
||||
@@ -510,3 +509,4 @@ System.Collections.Concurrent/CollectionStressTestHelper.cs
|
||||
System.Collections.Concurrent/ParallelTestHelper.cs
|
||||
System.Net.WebSockets/ClientWebSocketTest.cs
|
||||
../../test-helpers/NetworkHelpers.cs
|
||||
../../test-helpers/SocketResponder.cs
|
||||
@@ -1018,5 +1018,47 @@ namespace MonoTests.System.Diagnostics
|
||||
Assert.IsTrue (found, sb.ToString ());
|
||||
}
|
||||
}
|
||||
|
||||
#if MONO_FEATURE_PROCESS_START
|
||||
[Test]
|
||||
[NUnit.Framework.Category ("MobileNotWorking")]
|
||||
[ExpectedException (typeof (InvalidOperationException))]
|
||||
public void TestDoubleBeginOutputReadLine ()
|
||||
{
|
||||
using (Process p = new Process ()) {
|
||||
p.StartInfo = GetCrossPlatformStartInfo ();
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
p.StartInfo.RedirectStandardError = true;
|
||||
|
||||
p.Start ();
|
||||
|
||||
p.BeginOutputReadLine ();
|
||||
p.BeginOutputReadLine ();
|
||||
|
||||
Assert.Fail ();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[NUnit.Framework.Category ("MobileNotWorking")]
|
||||
[ExpectedException (typeof (InvalidOperationException))]
|
||||
public void TestDoubleBeginErrorReadLine ()
|
||||
{
|
||||
using (Process p = new Process ()) {
|
||||
p.StartInfo = GetCrossPlatformStartInfo ();
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
p.StartInfo.RedirectStandardError = true;
|
||||
|
||||
p.Start ();
|
||||
|
||||
p.BeginErrorReadLine ();
|
||||
p.BeginErrorReadLine ();
|
||||
|
||||
Assert.Fail ();
|
||||
}
|
||||
}
|
||||
#endif // MONO_FEATURE_PROCESS_START
|
||||
}
|
||||
}
|
||||
@@ -3495,6 +3495,14 @@ namespace MonoTests.System.Net.Sockets
|
||||
s.Close ();
|
||||
}
|
||||
|
||||
#if MONOTOUCH
|
||||
// when the linker is enabled then reflection won't work and would throw an NRE
|
||||
// this is also always true for iOS - so we do not need to poke internals
|
||||
static bool SupportsPortReuse ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
static bool? supportsPortReuse;
|
||||
static bool SupportsPortReuse ()
|
||||
{
|
||||
@@ -3506,6 +3514,7 @@ namespace MonoTests.System.Net.Sockets
|
||||
.Invoke (null, new object [] {});
|
||||
return supportsPortReuse.Value;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Test case for bug #31557
|
||||
[Test]
|
||||
|
||||
@@ -13,6 +13,8 @@ using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Net.Sockets
|
||||
{
|
||||
/// <summary>
|
||||
@@ -76,9 +78,7 @@ namespace MonoTests.System.Net.Sockets
|
||||
public void CloseTest ()
|
||||
{
|
||||
IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 8765);
|
||||
using (SocketResponder sr = new SocketResponder (localEP, new SocketRequestHandler (CloseRequestHandler))) {
|
||||
sr.Start ();
|
||||
|
||||
using (SocketResponder sr = new SocketResponder (localEP, s => CloseRequestHandler (s))) {
|
||||
TcpClient tcpClient = new TcpClient (IPAddress.Loopback.ToString (), 8765);
|
||||
NetworkStream ns = tcpClient.GetStream ();
|
||||
Assert.IsNotNull (ns, "#A1");
|
||||
@@ -103,9 +103,7 @@ namespace MonoTests.System.Net.Sockets
|
||||
*/
|
||||
}
|
||||
|
||||
using (SocketResponder sr = new SocketResponder (localEP, new SocketRequestHandler (CloseRequestHandler))) {
|
||||
sr.Start ();
|
||||
|
||||
using (SocketResponder sr = new SocketResponder (localEP, s => CloseRequestHandler (s))) {
|
||||
TcpClient tcpClient = new TcpClient (IPAddress.Loopback.ToString (), 8765);
|
||||
Assert.AreEqual (0, tcpClient.Available, "#B1");
|
||||
Assert.IsTrue (tcpClient.Connected, "#B2");
|
||||
|
||||
@@ -100,9 +100,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.Timeout = 2000;
|
||||
@@ -119,8 +117,6 @@ namespace MonoTests.System.Net
|
||||
response.Close ();
|
||||
|
||||
rs.Close ();
|
||||
|
||||
responder.Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,26 +246,24 @@ namespace MonoTests.System.Net
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
foreach (DictionaryEntry de in methods) {
|
||||
SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler));
|
||||
responder.Start ();
|
||||
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = (string) de.Key;
|
||||
req.Timeout = 2000;
|
||||
req.ReadWriteTimeout = 2000;
|
||||
req.KeepAlive = false;
|
||||
Stream rs = req.GetRequestStream ();
|
||||
rs.Close ();
|
||||
using (HttpWebResponse resp = (HttpWebResponse) req.GetResponse ()) {
|
||||
StreamReader sr = new StreamReader (resp.GetResponseStream (),
|
||||
Encoding.UTF8);
|
||||
string line = sr.ReadLine ();
|
||||
sr.Close ();
|
||||
Assert.AreEqual (((string) de.Value) + " /test/ HTTP/1.1",
|
||||
line, req.Method);
|
||||
resp.Close ();
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = (string) de.Key;
|
||||
req.Timeout = 2000;
|
||||
req.ReadWriteTimeout = 2000;
|
||||
req.KeepAlive = false;
|
||||
Stream rs = req.GetRequestStream ();
|
||||
rs.Close ();
|
||||
using (HttpWebResponse resp = (HttpWebResponse) req.GetResponse ()) {
|
||||
StreamReader sr = new StreamReader (resp.GetResponseStream (),
|
||||
Encoding.UTF8);
|
||||
string line = sr.ReadLine ();
|
||||
sr.Close ();
|
||||
Assert.AreEqual (((string) de.Value) + " /test/ HTTP/1.1",
|
||||
line, req.Method);
|
||||
resp.Close ();
|
||||
}
|
||||
}
|
||||
responder.Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,9 +273,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest request;
|
||||
|
||||
request = (HttpWebRequest) WebRequest.Create (url);
|
||||
@@ -318,9 +310,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req;
|
||||
Stream rs;
|
||||
IAsyncResult ar;
|
||||
@@ -374,9 +364,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req;
|
||||
|
||||
req = (HttpWebRequest) WebRequest.Create (url);
|
||||
@@ -471,9 +459,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.Abort ();
|
||||
@@ -498,9 +484,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.Abort ();
|
||||
@@ -525,9 +509,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.BeginGetRequestStream (null, null);
|
||||
@@ -553,9 +535,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
IAsyncResult ar = req.BeginGetRequestStream (null, null);
|
||||
@@ -583,9 +563,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.Timeout = 2000;
|
||||
@@ -609,9 +587,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Timeout = 2000;
|
||||
req.ReadWriteTimeout = 2000;
|
||||
@@ -642,9 +618,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.Timeout = 2000;
|
||||
@@ -666,9 +640,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.Abort ();
|
||||
@@ -694,9 +666,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req;
|
||||
Stream rs;
|
||||
|
||||
@@ -763,9 +733,7 @@ namespace MonoTests.System.Net
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
// buffered, non-chunked
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req;
|
||||
Stream rs;
|
||||
byte [] buffer;
|
||||
@@ -815,9 +783,7 @@ namespace MonoTests.System.Net
|
||||
}
|
||||
|
||||
// buffered, chunked
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req;
|
||||
Stream rs;
|
||||
byte [] buffer;
|
||||
@@ -853,9 +819,7 @@ namespace MonoTests.System.Net
|
||||
}
|
||||
|
||||
// non-buffered, non-chunked
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req;
|
||||
Stream rs;
|
||||
byte [] buffer;
|
||||
@@ -907,9 +871,7 @@ namespace MonoTests.System.Net
|
||||
}
|
||||
|
||||
// non-buffered, chunked
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req;
|
||||
Stream rs;
|
||||
byte [] buffer;
|
||||
@@ -973,9 +935,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.Abort ();
|
||||
@@ -1001,9 +961,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 8764);
|
||||
string url = "http://" + localEP.ToString () + "/original/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (localEP, new SocketRequestHandler (RedirectRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (localEP, s => RedirectRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.AllowAutoRedirect = false;
|
||||
@@ -1024,7 +982,6 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (WebExceptionStatus.Timeout, ex.Status, "#5");
|
||||
}
|
||||
}
|
||||
responder.Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1035,9 +992,7 @@ namespace MonoTests.System.Net
|
||||
string url = "http://" + localEP.ToString () + "/original/";
|
||||
|
||||
// allow autoredirect
|
||||
using (SocketResponder responder = new SocketResponder (localEP, new SocketRequestHandler (RedirectRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (localEP, s => RedirectRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.Timeout = 2000;
|
||||
@@ -1056,13 +1011,10 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual ("GET", resp.Method, "#A3");
|
||||
Assert.AreEqual ("LOOKS OK", body, "#A4");
|
||||
}
|
||||
responder.Stop ();
|
||||
}
|
||||
|
||||
// do not allow autoredirect
|
||||
using (SocketResponder responder = new SocketResponder (localEP, new SocketRequestHandler (RedirectRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (localEP, s => RedirectRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.AllowAutoRedirect = false;
|
||||
@@ -1076,7 +1028,6 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (url, resp.ResponseUri.ToString (), "#B2");
|
||||
Assert.AreEqual ("POST", resp.Method, "#B3");
|
||||
}
|
||||
responder.Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1086,9 +1037,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 8769);
|
||||
string url = "http://" + localEP.ToString () + "/original/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (localEP, new SocketRequestHandler (RedirectRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (localEP, s => RedirectRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.Timeout = 2000;
|
||||
@@ -1107,7 +1056,6 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual ("GET", resp.Method, "#A3");
|
||||
Assert.AreEqual ("LOOKS OK", body, "#A4");
|
||||
}
|
||||
responder.Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1117,9 +1065,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 8770);
|
||||
string url = "http://" + localEP.ToString () + "/original/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (localEP, new SocketRequestHandler (RedirectRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (localEP, s => RedirectRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.Timeout = 2000;
|
||||
@@ -1138,7 +1084,6 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual ("GET", resp.Method, "#A3");
|
||||
Assert.AreEqual ("LOOKS OK", body, "#A4");
|
||||
}
|
||||
responder.Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1148,9 +1093,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 8771);
|
||||
string url = "http://" + localEP.ToString () + "/original/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (localEP, new SocketRequestHandler (RedirectRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (localEP, s => RedirectRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.Timeout = 2000;
|
||||
@@ -1169,7 +1112,6 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual ("GET", resp.Method, "#A3");
|
||||
Assert.AreEqual ("LOOKS OK", body, "#A4");
|
||||
}
|
||||
responder.Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1181,9 +1123,7 @@ namespace MonoTests.System.Net
|
||||
string url = "http://" + localEP.ToString () + "/original/";
|
||||
|
||||
// POST
|
||||
using (SocketResponder responder = new SocketResponder (localEP, new SocketRequestHandler (InternalErrorHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (localEP, s => InternalErrorHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.Timeout = 2000;
|
||||
@@ -1206,14 +1146,10 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual ("POST", webResponse.Method, "#A7");
|
||||
webResponse.Close ();
|
||||
}
|
||||
|
||||
responder.Stop ();
|
||||
}
|
||||
|
||||
// GET
|
||||
using (SocketResponder responder = new SocketResponder (localEP, new SocketRequestHandler (InternalErrorHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (localEP, s => InternalErrorHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -1233,8 +1169,6 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual ("GET", webResponse.Method, "#B6");
|
||||
webResponse.Close ();
|
||||
}
|
||||
|
||||
responder.Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1246,9 +1180,7 @@ namespace MonoTests.System.Net
|
||||
string url = "http://" + localEP.ToString () + "/original/";
|
||||
|
||||
// POST
|
||||
using (SocketResponder responder = new SocketResponder (localEP, new SocketRequestHandler (NoContentLengthHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (localEP, s => NoContentLengthHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
req.Timeout = 2000;
|
||||
@@ -1288,14 +1220,10 @@ namespace MonoTests.System.Net
|
||||
HttpWebResponse webResponse = ex.Response as HttpWebResponse;
|
||||
Assert.IsNull (webResponse, "#A11");
|
||||
}
|
||||
|
||||
responder.Stop ();
|
||||
}
|
||||
|
||||
// GET
|
||||
using (SocketResponder responder = new SocketResponder (localEP, new SocketRequestHandler (NoContentLengthHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (localEP, s => NoContentLengthHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -1317,8 +1245,6 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual ("GET", webResponse.Method, "#B6");
|
||||
webResponse.Close ();
|
||||
}
|
||||
|
||||
responder.Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1328,9 +1254,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/moved/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (VerbEchoHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => VerbEchoHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "WhatEver";
|
||||
req.KeepAlive = false;
|
||||
@@ -1351,8 +1275,6 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual ("WhatEver", resp.Method, "#3");
|
||||
Assert.AreEqual ("WhatEver", body, "#4");
|
||||
}
|
||||
|
||||
responder.Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1363,9 +1285,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (NotModifiedSinceHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => NotModifiedSinceHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.KeepAlive = false;
|
||||
@@ -1393,8 +1313,6 @@ namespace MonoTests.System.Net
|
||||
|
||||
TimeSpan elapsed = DateTime.Now - start;
|
||||
Assert.IsTrue (elapsed.TotalMilliseconds < 2000, "#4");
|
||||
|
||||
responder.Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1504,11 +1422,7 @@ namespace MonoTests.System.Net
|
||||
|
||||
using (var responder = new SocketResponder (ep, TimeOutHandler))
|
||||
{
|
||||
responder.Start ();
|
||||
|
||||
TestTimeOut (url, WebExceptionStatus.Timeout);
|
||||
|
||||
responder.Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2771,9 +2685,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (CookieRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => CookieRequestHandler (s))) {
|
||||
CookieContainer container = new CookieContainer ();
|
||||
container.Add(new Uri (url), new Cookie ("foo", "bar"));
|
||||
HttpWebRequest request = (HttpWebRequest) WebRequest.Create (url);
|
||||
@@ -2790,9 +2702,7 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual ("foo=bar", response.Headers.Get("Set-Cookie"), "#02");
|
||||
}
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (CookieRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => CookieRequestHandler (s))) {
|
||||
CookieContainer container = new CookieContainer ();
|
||||
HttpWebRequest request = (HttpWebRequest) WebRequest.Create (url);
|
||||
request.CookieContainer = container;
|
||||
@@ -2859,9 +2769,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -2889,9 +2797,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -2918,9 +2824,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -2942,9 +2846,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -2966,9 +2868,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -2990,9 +2890,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -3014,9 +2912,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -3043,9 +2939,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -3071,9 +2965,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -3095,9 +2987,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -3123,9 +3013,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -3151,9 +3039,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -3181,9 +3067,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -3211,9 +3095,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -3241,9 +3123,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -3271,9 +3151,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -3301,9 +3179,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -3330,9 +3206,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
@@ -3359,9 +3233,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebRequestTest.EchoRequestHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "POST";
|
||||
|
||||
|
||||
@@ -29,9 +29,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -59,9 +57,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -80,9 +76,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -110,9 +104,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -132,9 +124,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -162,9 +152,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -202,9 +190,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -232,9 +218,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -262,9 +246,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -291,9 +273,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -321,9 +301,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -351,9 +329,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -381,9 +357,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -411,9 +385,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -441,9 +413,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -463,9 +433,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -516,9 +484,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -567,9 +533,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -602,9 +566,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -631,9 +593,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -660,9 +620,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -689,9 +647,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -718,9 +674,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -757,9 +711,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -808,9 +760,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -860,9 +810,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -912,9 +860,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -964,9 +910,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -1017,9 +961,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req;
|
||||
|
||||
req = (HttpWebRequest) WebRequest.Create (url);
|
||||
@@ -1082,9 +1024,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -1111,9 +1051,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
@@ -1145,9 +1083,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.FullResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
|
||||
@@ -1423,9 +1423,7 @@ namespace MonoTests.System.Net
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => EchoRequestHandler (s))) {
|
||||
WebClient wc = new WebClient ();
|
||||
wc.Encoding = Encoding.ASCII;
|
||||
|
||||
@@ -1880,10 +1878,8 @@ namespace MonoTests.System.Net
|
||||
var ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString() + "/test/";
|
||||
|
||||
using (var responder = new SocketResponder (ep, EchoRequestHandler))
|
||||
using (var responder = new SocketResponder (ep, s => EchoRequestHandler (s)))
|
||||
{
|
||||
responder.Start ();
|
||||
|
||||
var webClient = new WebClient ();
|
||||
|
||||
var cancellationTokenSource = new CancellationTokenSource ();
|
||||
|
||||
@@ -881,3 +881,5 @@ ReferenceSources/Win32Exception.cs
|
||||
../Mono.Security/Mono.Security.Interface/TlsException.cs
|
||||
../Mono.Security/Mono.Security.Interface/TlsProtocolCode.cs
|
||||
../Mono.Security/Mono.Security.Interface/TlsProtocols.cs
|
||||
|
||||
../../../external/referencesource/System/services/monitoring/system/diagnosticts/AsyncStreamReader.cs
|
||||
@@ -82,5 +82,20 @@ using System.Runtime.InteropServices;
|
||||
#endif
|
||||
[assembly: InternalsVisibleTo ("System.Numerics, PublicKey=00000000000000000400000000000000")]
|
||||
|
||||
[assembly: Guid ("BED7F4EA-1A96-11D2-8F08-00A0C9A6186D")]
|
||||
#if MONOTOUCH
|
||||
#if MONOTOUCH_TV
|
||||
[assembly: InternalsVisibleTo ("Xamarin.TVOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
|
||||
#elif MONOTOUCH_WATCH
|
||||
[assembly: InternalsVisibleTo ("Xamarin.WatchOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
|
||||
#else
|
||||
[assembly: InternalsVisibleTo ("monotouch, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
|
||||
[assembly: InternalsVisibleTo ("Xamarin.iOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if XAMMAC || XAMMAC_4_5
|
||||
[assembly: InternalsVisibleTo ("XamMac, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
|
||||
[assembly: InternalsVisibleTo ("Xamarin.Mac, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
|
||||
#endif
|
||||
|
||||
[assembly: Guid ("BED7F4EA-1A96-11D2-8F08-00A0C9A6186D")]
|
||||
@@ -33,10 +33,8 @@ namespace System {
|
||||
[System.Security.SecurityCritical]
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
internal static bool CheckThrowUnobservedTaskExceptions()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
extern internal static bool CheckThrowUnobservedTaskExceptions();
|
||||
|
||||
} // internal class CLRConfig
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace System
|
||||
private object m_target;
|
||||
private IntPtr method;
|
||||
private IntPtr delegate_trampoline;
|
||||
private IntPtr rgctx;
|
||||
private IntPtr extra_arg;
|
||||
private IntPtr method_code;
|
||||
private MethodInfo method_info;
|
||||
|
||||
|
||||
@@ -375,7 +375,7 @@ namespace System {
|
||||
/// </summary>
|
||||
public static Version Version {
|
||||
get {
|
||||
return new Version (Consts.FxFileVersion);
|
||||
return new Version (Consts.EnvironmentVersion);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -327,8 +327,13 @@ namespace System
|
||||
private static bool TryAddTicks (DateTime date, long ticks, out DateTime result, DateTimeKind kind = DateTimeKind.Unspecified)
|
||||
{
|
||||
var resultTicks = date.Ticks + ticks;
|
||||
if (resultTicks < DateTime.MinValue.Ticks || resultTicks > DateTime.MaxValue.Ticks) {
|
||||
result = default (DateTime);
|
||||
if (resultTicks < DateTime.MinValue.Ticks) {
|
||||
result = DateTime.SpecifyKind (DateTime.MinValue, kind);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (resultTicks > DateTime.MaxValue.Ticks) {
|
||||
result = DateTime.SpecifyKind (DateTime.MaxValue, kind);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -475,9 +480,7 @@ namespace System
|
||||
var utcOffset = sourceTimeZone.GetUtcOffset (dateTime, out isDst);
|
||||
|
||||
DateTime utcDateTime;
|
||||
if (!TryAddTicks (dateTime, -utcOffset.Ticks, out utcDateTime, DateTimeKind.Utc))
|
||||
return DateTime.SpecifyKind (DateTime.MinValue, DateTimeKind.Utc);
|
||||
|
||||
TryAddTicks (dateTime, -utcOffset.Ticks, out utcDateTime, DateTimeKind.Utc);
|
||||
return utcDateTime;
|
||||
}
|
||||
|
||||
|
||||
@@ -1660,6 +1660,25 @@ namespace MonoTests.System.IO
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OpenCharDeviceRepeatedly ()
|
||||
{
|
||||
// https://bugzilla.xamarin.com/show_bug.cgi?id=38408
|
||||
try {
|
||||
using (var f = new FileStream ("/dev/zero", FileMode.Open))
|
||||
{
|
||||
}
|
||||
} catch (FileNotFoundException) {
|
||||
// Only run this test on platforms where /dev/zero exists
|
||||
Assert.Ignore();
|
||||
}
|
||||
|
||||
// this shouldn't throw
|
||||
using (var g = new FileStream ("/dev/zero", FileMode.Open))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#if !MOBILE
|
||||
[Test]
|
||||
public void WriteWithExposedHandle ()
|
||||
|
||||
@@ -65,9 +65,11 @@ namespace MonoTests.System.Threading
|
||||
{
|
||||
int called = 0;
|
||||
var cts = new CancellationTokenSource ();
|
||||
cts.Token.Register (() => called++);
|
||||
var mre = new ManualResetEvent(false);
|
||||
cts.Token.Register (() => { called++; mre.Set (); });
|
||||
cts.CancelAfter (20);
|
||||
Thread.Sleep (50);
|
||||
|
||||
Assert.IsTrue(mre.WaitOne (1000), "Should be cancelled in ~20ms");
|
||||
Assert.AreEqual (1, called, "#1");
|
||||
}
|
||||
|
||||
|
||||
@@ -193,6 +193,9 @@ namespace MonoTests.System.Threading
|
||||
}
|
||||
|
||||
[Test]
|
||||
#if MONOTOUCH
|
||||
[Category ("NotWorking")] // https://bugzilla.xamarin.com/show_bug.cgi?id=34617
|
||||
#endif
|
||||
public void DisposeOnThreadExit ()
|
||||
{
|
||||
var threadLocal = new ThreadLocal<SetMreOnFinalize>();
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace MonoTests.System.Threading {
|
||||
// this makes fair for the "DueTime" test since it
|
||||
// doesn't have to wait for the scheduler thread to be
|
||||
// created.
|
||||
new Timer (new TimerCallback (DoNothing), null, Timeout.Infinite, 0);
|
||||
new Timer (o => DoNothing (o), null, Timeout.Infinite, 0);
|
||||
}
|
||||
|
||||
void DoNothing (object foo)
|
||||
@@ -40,32 +40,34 @@ namespace MonoTests.System.Threading {
|
||||
public void TestDueTime ()
|
||||
{
|
||||
Bucket bucket = new Bucket();
|
||||
Timer t = new Timer (new TimerCallback (Callback), bucket, 200, Timeout.Infinite);
|
||||
Thread.Sleep (50);
|
||||
Assert.AreEqual (0, bucket.count, "#1");
|
||||
Thread.Sleep (200);
|
||||
Assert.AreEqual (1, bucket.count, "#2");
|
||||
Thread.Sleep (500);
|
||||
Assert.AreEqual (1, bucket.count, "#3");
|
||||
t.Change (10, 10);
|
||||
Thread.Sleep (1000);
|
||||
Assert.IsTrue(bucket.count > 20, "#4");
|
||||
t.Dispose ();
|
||||
|
||||
using (Timer t = new Timer (o => Callback (o), bucket, 200, Timeout.Infinite)) {
|
||||
Thread.Sleep (50);
|
||||
Assert.AreEqual (0, bucket.count, "#1");
|
||||
Thread.Sleep (200);
|
||||
Assert.AreEqual (1, bucket.count, "#2");
|
||||
Thread.Sleep (500);
|
||||
Assert.AreEqual (1, bucket.count, "#3");
|
||||
t.Change (10, 10);
|
||||
Thread.Sleep (1000);
|
||||
Assert.IsTrue(bucket.count > 20, "#4");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChange ()
|
||||
{
|
||||
Bucket bucket = new Bucket();
|
||||
Timer t = new Timer (new TimerCallback (Callback), bucket, 10, 10);
|
||||
Thread.Sleep (500);
|
||||
int c = bucket.count;
|
||||
Assert.IsTrue (c > 20, "#1 " + c.ToString ());
|
||||
t.Change (100, 100);
|
||||
c = bucket.count;
|
||||
Thread.Sleep (500);
|
||||
Assert.IsTrue (bucket.count <= c + 20, "#2 " + c.ToString ());
|
||||
t.Dispose ();
|
||||
|
||||
using (Timer t = new Timer (o => Callback (o), bucket, 10, 10)) {
|
||||
Thread.Sleep (500);
|
||||
int c = bucket.count;
|
||||
Assert.IsTrue (c > 20, "#1 " + c.ToString ());
|
||||
t.Change (100, 100);
|
||||
c = bucket.count;
|
||||
Thread.Sleep (500);
|
||||
Assert.IsTrue (bucket.count <= c + 20, "#2 " + c.ToString ());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -73,22 +75,24 @@ namespace MonoTests.System.Threading {
|
||||
{
|
||||
Bucket bucket = new Bucket();
|
||||
|
||||
Timer t = new Timer (new TimerCallback (Callback), bucket, 0, Timeout.Infinite);
|
||||
Thread.Sleep (100);
|
||||
Assert.AreEqual (1, bucket.count, "#1");
|
||||
t.Change (0, Timeout.Infinite);
|
||||
Thread.Sleep (100);
|
||||
Assert.AreEqual (2, bucket.count, "#2");
|
||||
t.Dispose ();
|
||||
using (Timer t = new Timer (o => Callback (o), bucket, 0, Timeout.Infinite)) {
|
||||
Thread.Sleep (100);
|
||||
Assert.AreEqual (1, bucket.count, "#1");
|
||||
t.Change (0, Timeout.Infinite);
|
||||
Thread.Sleep (100);
|
||||
Assert.AreEqual (2, bucket.count, "#2");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDispose ()
|
||||
{
|
||||
Bucket bucket = new Bucket();
|
||||
Timer t = new Timer (new TimerCallback (Callback), bucket, 10, 10);
|
||||
Thread.Sleep (200);
|
||||
t.Dispose ();
|
||||
|
||||
using (Timer t = new Timer (o => Callback (o), bucket, 10, 10)) {
|
||||
Thread.Sleep (200);
|
||||
}
|
||||
|
||||
Thread.Sleep (20);
|
||||
int c = bucket.count;
|
||||
Assert.IsTrue (bucket.count > 5, "#1");
|
||||
@@ -99,7 +103,7 @@ namespace MonoTests.System.Threading {
|
||||
[Test] // bug #320950
|
||||
public void TestDispose2 ()
|
||||
{
|
||||
Timer t = new Timer (new TimerCallback (Callback), null, 10, 10);
|
||||
Timer t = new Timer (o => Callback (o), null, 10, 10);
|
||||
t.Dispose ();
|
||||
t.Dispose ();
|
||||
}
|
||||
@@ -108,9 +112,10 @@ namespace MonoTests.System.Threading {
|
||||
public void TestHeavyCreationLoad ()
|
||||
{
|
||||
Bucket b = new Bucket ();
|
||||
|
||||
for (int i = 0; i < 500; ++i)
|
||||
new Timer (new TimerCallback (Callback), b, 10,
|
||||
Timeout.Infinite);
|
||||
new Timer (o => Callback (o), b, 10, Timeout.Infinite);
|
||||
|
||||
// 1000 * 10 msec = 10,000 msec or 10 sec - if everything goes well
|
||||
// we add some slack to cope with timing issues caused by system load etc.
|
||||
for (int i = 0; i < 20; ++i) {
|
||||
@@ -118,23 +123,22 @@ namespace MonoTests.System.Threading {
|
||||
break;
|
||||
Thread.Sleep (1000);
|
||||
}
|
||||
|
||||
Assert.AreEqual (500, b.count);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestQuickDisposeDeadlockBug ()
|
||||
{
|
||||
int i = 0;
|
||||
Bucket b = new Bucket ();
|
||||
ArrayList timers = new ArrayList();
|
||||
while (i < 500) {
|
||||
Timer t = new Timer (new TimerCallback (Callback),
|
||||
b, 10, Timeout.Infinite);
|
||||
timers.Add (t);
|
||||
i++;
|
||||
t.Dispose ();
|
||||
ArrayList timers = new ArrayList (500);
|
||||
|
||||
for (int i = 0; i < 500; ++i) {
|
||||
using (Timer t = new Timer (o => Callback (o), b, 10, Timeout.Infinite)) {
|
||||
timers.Add (t);
|
||||
}
|
||||
}
|
||||
|
||||
Thread.Sleep (11 * 500);
|
||||
}
|
||||
|
||||
@@ -142,46 +146,41 @@ namespace MonoTests.System.Threading {
|
||||
public void TestInt32MaxDelay ()
|
||||
{
|
||||
Bucket b = new Bucket ();
|
||||
new Timer (new TimerCallback (Callback), b, Int32.MaxValue,
|
||||
Timeout.Infinite);
|
||||
Thread.Sleep (50);
|
||||
Assert.AreEqual (0, b.count);
|
||||
|
||||
using (new Timer (o => Callback (o), b, Int32.MaxValue, Timeout.Infinite)) {
|
||||
Thread.Sleep (50);
|
||||
Assert.AreEqual (0, b.count);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInt32MaxPeriod ()
|
||||
{
|
||||
Bucket b = new Bucket ();
|
||||
new Timer (new TimerCallback (Callback), b, 0,
|
||||
Int32.MaxValue);
|
||||
Thread.Sleep (50);
|
||||
Assert.AreEqual (1, b.count);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNegativeDelay ()
|
||||
{
|
||||
Bucket b = new Bucket ();
|
||||
try {
|
||||
new Timer (new TimerCallback (Callback), b, -10,
|
||||
Timeout.Infinite);
|
||||
Assert.Fail ();
|
||||
} catch (ArgumentOutOfRangeException) {
|
||||
return;
|
||||
using (new Timer (o => Callback (o), b, 0, Int32.MaxValue)) {
|
||||
Thread.Sleep (50);
|
||||
Assert.AreEqual (1, b.count);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
public void TestNegativeDelay ()
|
||||
{
|
||||
Bucket b = new Bucket ();
|
||||
|
||||
using (new Timer (o => Callback (o), b, -10, Timeout.Infinite)) {
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
public void TestNegativePeriod ()
|
||||
{
|
||||
Bucket b = new Bucket ();
|
||||
try {
|
||||
new Timer (new TimerCallback (Callback), b, 0,
|
||||
-10);
|
||||
Assert.Fail ();
|
||||
} catch (ArgumentOutOfRangeException) {
|
||||
return;
|
||||
|
||||
using (new Timer (o => Callback (o), b, 0, -10)) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,11 +188,13 @@ namespace MonoTests.System.Threading {
|
||||
public void TestDelayZeroPeriodZero()
|
||||
{
|
||||
Bucket b = new Bucket();
|
||||
Timer t = new Timer(new TimerCallback(Callback),b,0,0);
|
||||
Thread.Sleep(100);
|
||||
t.Change (int.MaxValue, Timeout.Infinite);
|
||||
// since period is 0 the callback should happen once (bug #340212)
|
||||
Assert.AreEqual (1, b.count, "only once");
|
||||
|
||||
using (Timer t = new Timer(o => Callback (o),b,0,0)) {
|
||||
Thread.Sleep(100);
|
||||
t.Change (int.MaxValue, Timeout.Infinite);
|
||||
// since period is 0 the callback should happen once (bug #340212)
|
||||
Assert.AreEqual (1, b.count, "only once");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -204,7 +205,7 @@ namespace MonoTests.System.Threading {
|
||||
// that was ignored before 238785a3e3d510528228fc551625975bc508c2f3 and most unit test runner won't
|
||||
// report it since the NRE will not happen on the main thread (but Touch.Unit will)
|
||||
Timer t1 = null;
|
||||
t1 = new Timer (new TimerCallback (CallbackTestDisposeOnCallback), t1, 0, 10);
|
||||
t1 = new Timer (o => CallbackTestDisposeOnCallback (o), t1, 0, 10);
|
||||
Thread.Sleep (200);
|
||||
Assert.IsNotNull (t1);
|
||||
|
||||
@@ -225,7 +226,7 @@ namespace MonoTests.System.Threading {
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void DisposeNullWaitHandle ()
|
||||
{
|
||||
using (Timer t = new Timer (DoNothing, null, 0, 0)) {
|
||||
using (Timer t = new Timer (o => DoNothing (o), null, 0, 0)) {
|
||||
t.Dispose (null);
|
||||
}
|
||||
}
|
||||
@@ -233,7 +234,7 @@ namespace MonoTests.System.Threading {
|
||||
[Test]
|
||||
public void Change_IntInt_Infinite ()
|
||||
{
|
||||
using (Timer t = new Timer (DoNothing, null, 0, 0)) {
|
||||
using (Timer t = new Timer (o => DoNothing (o), null, 0, 0)) {
|
||||
t.Change ((int)Timeout.Infinite, (int)Timeout.Infinite);
|
||||
}
|
||||
}
|
||||
@@ -241,7 +242,7 @@ namespace MonoTests.System.Threading {
|
||||
[Test]
|
||||
public void Change_IntInt_MaxValue ()
|
||||
{
|
||||
using (Timer t = new Timer (DoNothing, null, 0, 0)) {
|
||||
using (Timer t = new Timer (o => DoNothing (o), null, 0, 0)) {
|
||||
t.Change (Int32.MaxValue, Int32.MaxValue);
|
||||
}
|
||||
}
|
||||
@@ -249,7 +250,7 @@ namespace MonoTests.System.Threading {
|
||||
[Test]
|
||||
public void Change_UIntUInt_Infinite ()
|
||||
{
|
||||
using (Timer t = new Timer (DoNothing, null, 0, 0)) {
|
||||
using (Timer t = new Timer (o => DoNothing (o), null, 0, 0)) {
|
||||
t.Change (unchecked ((uint) Timeout.Infinite), unchecked ((uint) Timeout.Infinite));
|
||||
}
|
||||
}
|
||||
@@ -257,7 +258,7 @@ namespace MonoTests.System.Threading {
|
||||
[Test]
|
||||
public void Change_UIntUInt_MaxValue ()
|
||||
{
|
||||
using (Timer t = new Timer (DoNothing, null, 0, 0)) {
|
||||
using (Timer t = new Timer (o => DoNothing (o), null, 0, 0)) {
|
||||
// UInt32.MaxValue == Timeout.Infinite == 0xffffffff
|
||||
t.Change (UInt32.MaxValue, UInt32.MaxValue);
|
||||
}
|
||||
@@ -266,7 +267,7 @@ namespace MonoTests.System.Threading {
|
||||
[Test]
|
||||
public void Change_LongLong_Infinite ()
|
||||
{
|
||||
using (Timer t = new Timer (DoNothing, null, 0, 0)) {
|
||||
using (Timer t = new Timer (o => DoNothing (o), null, 0, 0)) {
|
||||
t.Change ((long) Timeout.Infinite, (long) Timeout.Infinite);
|
||||
}
|
||||
}
|
||||
@@ -275,7 +276,7 @@ namespace MonoTests.System.Threading {
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
public void Change_LongLong_MaxValue ()
|
||||
{
|
||||
using (Timer t = new Timer (DoNothing, null, 0, 0)) {
|
||||
using (Timer t = new Timer (o => DoNothing (o), null, 0, 0)) {
|
||||
t.Change (Int64.MaxValue, Int64.MaxValue);
|
||||
}
|
||||
}
|
||||
@@ -284,7 +285,7 @@ namespace MonoTests.System.Threading {
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
public void Change_LongLong_UInt32MaxValue ()
|
||||
{
|
||||
using (Timer t = new Timer (DoNothing, null, 0, 0)) {
|
||||
using (Timer t = new Timer (o => DoNothing (o), null, 0, 0)) {
|
||||
// not identical to (long)-1
|
||||
t.Change ((long)UInt32.MaxValue, (long)UInt32.MaxValue);
|
||||
}
|
||||
@@ -293,7 +294,7 @@ namespace MonoTests.System.Threading {
|
||||
[Test]
|
||||
public void Change_LongLong_UInt32MaxValueMinusOne ()
|
||||
{
|
||||
using (Timer t = new Timer (DoNothing, null, 0, 0)) {
|
||||
using (Timer t = new Timer (o => DoNothing (o), null, 0, 0)) {
|
||||
// not identical to (long)-1
|
||||
t.Change ((long) UInt32.MaxValue - 1, (long) UInt32.MaxValue -1);
|
||||
}
|
||||
@@ -302,7 +303,7 @@ namespace MonoTests.System.Threading {
|
||||
[Test]
|
||||
public void Change_TimeSpanTimeSpan_Infinite ()
|
||||
{
|
||||
using (Timer t = new Timer (DoNothing, null, 0, 0)) {
|
||||
using (Timer t = new Timer (o => DoNothing (o), null, 0, 0)) {
|
||||
t.Change (new TimeSpan (-1), new TimeSpan (-1));
|
||||
}
|
||||
}
|
||||
@@ -311,7 +312,7 @@ namespace MonoTests.System.Threading {
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
public void Change_TimeSpanTimeSpan_MaxValue ()
|
||||
{
|
||||
using (Timer t = new Timer (DoNothing, null, 0, 0)) {
|
||||
using (Timer t = new Timer (o => DoNothing (o), null, 0, 0)) {
|
||||
t.Change (TimeSpan.MaxValue, TimeSpan.MaxValue);
|
||||
}
|
||||
}
|
||||
@@ -319,7 +320,7 @@ namespace MonoTests.System.Threading {
|
||||
[Test]
|
||||
public void Change_TimeSpanTimeSpan_UInt32MaxValue ()
|
||||
{
|
||||
using (Timer t = new Timer (DoNothing, null, 0, 0)) {
|
||||
using (Timer t = new Timer (o => DoNothing (o), null, 0, 0)) {
|
||||
t.Change (new TimeSpan (UInt32.MaxValue), new TimeSpan (UInt32.MaxValue));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2644,5 +2644,28 @@ namespace MonoTests.System
|
||||
Assert.AreEqual (2, res.Year, "#1");
|
||||
Assert.AreEqual (12, res.Month, "#2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Culture ("en-us")]
|
||||
public void ToUniversalTime_TimeZoneOffsetShouldNotOverflow ()
|
||||
{
|
||||
var m = DateTime.MaxValue;
|
||||
var res = m.ToUniversalTime ();
|
||||
|
||||
// It does not matter which time zone but we should never overflow or have DateTime.MinValue
|
||||
Assert.AreEqual (9999, res.Year, "#1");
|
||||
Assert.AreEqual (12, res.Month, "#2");
|
||||
Assert.AreEqual (31, res.Day, "#3");
|
||||
Assert.AreEqual (DateTimeKind.Utc, res.Kind, "#4");
|
||||
|
||||
m = DateTime.MinValue;
|
||||
res = m.ToUniversalTime ();
|
||||
|
||||
// It does not matter which time zone but we should never overflow or have DateTime.MinValue
|
||||
Assert.AreEqual (0, res.Year, "#10");
|
||||
Assert.AreEqual (1, res.Month, "#11");
|
||||
Assert.AreEqual (1, res.Day, "#12");
|
||||
Assert.AreEqual (DateTimeKind.Utc, res.Kind, "#13");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,16 +4,26 @@ include ../../build/rules.make
|
||||
|
||||
all-local:
|
||||
|
||||
PROFILE_DIR=$(DESTDIR)$(mono_libdir)/mono/
|
||||
PROFILE_DIR=$(DESTDIR)$(mono_libdir)/mono
|
||||
|
||||
install-local:
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/2.0
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/3.5
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.0
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v2.0/* $(PROFILE_DIR)/2.0
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v3.5/* $(PROFILE_DIR)/3.5
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.0/* $(PROFILE_DIR)/4.0
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/2.0-api
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/3.5-api
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.0-api
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.5-api
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.5-api/Facades
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v2.0/*.dll $(PROFILE_DIR)/2.0-api
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v3.5/*.dll $(PROFILE_DIR)/3.5-api
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.0/*.dll $(PROFILE_DIR)/4.0-api
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.5/*.dll $(PROFILE_DIR)/4.5-api
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.5/Facades/*.dll $(PROFILE_DIR)/4.5-api/Facades
|
||||
|
||||
DISTFILES = $(wildcard ../../../external/binary-reference-assemblies/v4.0/*) $(wildcard ../../../external/binary-reference-assemblies/v3.5/*) $(wildcard ../../../external/binary-reference-assemblies/v2.0/*) Makefile
|
||||
# Unfortunately, a few programs (most notably NUnit) have hardcoded checks for <prefix>/lib/mono/4.0/mscorlib.dll,
|
||||
# so we need to place something there or those tools break. We decided to symlink to the reference assembly for now.
|
||||
# See https://bugzilla.xamarin.com/show_bug.cgi?id=38331
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.0
|
||||
ln -sf ../4.0-api/mscorlib.dll $(PROFILE_DIR)/4.0/mscorlib.dll
|
||||
|
||||
DISTFILES = $(wildcard ../../../external/binary-reference-assemblies/v4.5/Facades/*.dll) $(wildcard ../../../external/binary-reference-assemblies/v4.5/*.dll) $(wildcard ../../../external/binary-reference-assemblies/v4.0/*.dll) $(wildcard ../../../external/binary-reference-assemblies/v3.5/*.dll) $(wildcard ../../../external/binary-reference-assemblies/v2.0/*.dll) Makefile
|
||||
|
||||
dist-local: dist-default
|
||||
+32
-80
@@ -32,98 +32,64 @@ using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MonoTests.System.Net
|
||||
namespace MonoTests.Helpers
|
||||
{
|
||||
public delegate byte [] SocketRequestHandler (Socket socket);
|
||||
|
||||
public class SocketResponderException : Exception
|
||||
{
|
||||
public SocketResponderException (string message)
|
||||
: base (message)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class SocketResponder : IDisposable
|
||||
{
|
||||
private TcpListener tcpListener;
|
||||
private readonly IPEndPoint _localEndPoint;
|
||||
private Thread listenThread;
|
||||
private Task listenTask;
|
||||
private Socket listenSocket;
|
||||
private SocketRequestHandler _requestHandler;
|
||||
private int _state = 0;
|
||||
private readonly object _syncRoot = new object ();
|
||||
private SocketRequestHandler requestHandler;
|
||||
private bool disposed;
|
||||
|
||||
private const int SOCKET_CLOSED = 10004;
|
||||
private const int SOCKET_INVALID_ARGS = 10022;
|
||||
|
||||
private const int STATE_UNINITIALIZED = 0;
|
||||
private const int STATE_RUNNING = 1;
|
||||
private const int STATE_STOPPED = 2;
|
||||
|
||||
public SocketResponder (IPEndPoint localEP, SocketRequestHandler requestHandler)
|
||||
public SocketResponder (IPEndPoint ep, SocketRequestHandler rh)
|
||||
{
|
||||
_localEndPoint = localEP;
|
||||
_requestHandler = requestHandler;
|
||||
}
|
||||
requestHandler = rh;
|
||||
|
||||
public IPEndPoint LocalEndPoint
|
||||
{
|
||||
get { return _localEndPoint; }
|
||||
tcpListener = new TcpListener (ep);
|
||||
tcpListener.Start ();
|
||||
|
||||
listenTask = Task.Run (Listen);
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
Stop ();
|
||||
}
|
||||
if (disposed)
|
||||
return;
|
||||
|
||||
public bool IsStopped
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_syncRoot) {
|
||||
return _state != STATE_RUNNING;
|
||||
}
|
||||
}
|
||||
}
|
||||
disposed = true;
|
||||
|
||||
public void Start ()
|
||||
{
|
||||
lock (_syncRoot) {
|
||||
if (_state != STATE_UNINITIALIZED)
|
||||
throw new InvalidOperationException ("cannot restart SocketResponder");
|
||||
_state = STATE_RUNNING;
|
||||
tcpListener = new TcpListener (LocalEndPoint);
|
||||
tcpListener.Start ();
|
||||
listenThread = new Thread (new ThreadStart (Listen));
|
||||
listenThread.Start ();
|
||||
}
|
||||
}
|
||||
tcpListener.Stop ();
|
||||
|
||||
public void Stop ()
|
||||
{
|
||||
lock (_syncRoot) {
|
||||
if (_state != STATE_RUNNING)
|
||||
return;
|
||||
_state = STATE_STOPPED;
|
||||
if (tcpListener != null) {
|
||||
tcpListener.Stop ();
|
||||
tcpListener = null;
|
||||
if (listenSocket != null)
|
||||
listenSocket.Close ();
|
||||
#if MONO_FEATURE_THREAD_ABORT
|
||||
listenThread.Abort ();
|
||||
#else
|
||||
listenThread.Interrupt ();
|
||||
#endif
|
||||
listenThread.Join ();
|
||||
listenThread = null;
|
||||
Thread.Sleep (50);
|
||||
}
|
||||
}
|
||||
if (listenSocket != null)
|
||||
listenSocket.Close ();
|
||||
|
||||
if (!listenTask.Wait (5000))
|
||||
throw new SocketResponderException ("Failed to stop in less than 5 seconds");
|
||||
}
|
||||
|
||||
private void Listen ()
|
||||
{
|
||||
while (_state == STATE_RUNNING) {
|
||||
while (!disposed) {
|
||||
listenSocket = null;
|
||||
try {
|
||||
listenSocket = tcpListener.AcceptSocket ();
|
||||
listenSocket.Send (_requestHandler (listenSocket));
|
||||
listenSocket.Send (requestHandler (listenSocket));
|
||||
try {
|
||||
listenSocket.Shutdown (SocketShutdown.Receive);
|
||||
listenSocket.Shutdown (SocketShutdown.Send);
|
||||
@@ -131,16 +97,11 @@ namespace MonoTests.System.Net
|
||||
}
|
||||
} catch (SocketException ex) {
|
||||
// ignore interruption of blocking call
|
||||
if (ex.ErrorCode != SOCKET_CLOSED && ex.ErrorCode != SOCKET_INVALID_ARGS && _state != STATE_STOPPED)
|
||||
if (ex.ErrorCode != SOCKET_CLOSED && ex.ErrorCode != SOCKET_INVALID_ARGS && !disposed)
|
||||
throw;
|
||||
} catch (ObjectDisposedException ex) {
|
||||
Console.WriteLine (ex);
|
||||
if (_state != STATE_STOPPED)
|
||||
if (!disposed)
|
||||
throw;
|
||||
#if !MONO_FEATURE_THREAD_ABORT
|
||||
} catch (ThreadInterruptedException) {
|
||||
break;
|
||||
#endif
|
||||
#if MOBILE
|
||||
} catch (InvalidOperationException ex) {
|
||||
// This breaks some tests running on Android. The problem is that the stack trace
|
||||
@@ -150,15 +111,6 @@ namespace MonoTests.System.Net
|
||||
Console.WriteLine (ex);
|
||||
#endif
|
||||
} finally {
|
||||
#if MONO_FEATURE_THREAD_ABORT
|
||||
Thread.Sleep (500);
|
||||
#else
|
||||
try {
|
||||
Thread.Sleep (500);
|
||||
} catch (ThreadInterruptedException) {
|
||||
// nothing to do
|
||||
}
|
||||
#endif
|
||||
if (listenSocket != null)
|
||||
listenSocket.Close ();
|
||||
}
|
||||
+141
-6
@@ -13,6 +13,11 @@ using System;
|
||||
using System.Linq;
|
||||
using SLE = System.Linq.Expressions;
|
||||
using System.Dynamic;
|
||||
#if STATIC
|
||||
using IKVM.Reflection.Emit;
|
||||
#else
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
|
||||
namespace Mono.CSharp
|
||||
{
|
||||
@@ -314,6 +319,50 @@ namespace Mono.CSharp
|
||||
EmitCall (ec, binder_expr, arguments, true);
|
||||
}
|
||||
|
||||
protected void EmitConditionalAccess (EmitContext ec)
|
||||
{
|
||||
var a_expr = arguments [0].Expr;
|
||||
|
||||
var des = a_expr as DynamicExpressionStatement;
|
||||
if (des != null) {
|
||||
des.EmitConditionalAccess (ec);
|
||||
}
|
||||
|
||||
if (HasConditionalAccess ()) {
|
||||
var NullOperatorLabel = ec.DefineLabel ();
|
||||
|
||||
if (ExpressionAnalyzer.IsInexpensiveLoad (a_expr)) {
|
||||
a_expr.Emit (ec);
|
||||
} else {
|
||||
var lt = new LocalTemporary (a_expr.Type);
|
||||
lt.EmitAssign (ec, a_expr, true, false);
|
||||
|
||||
Arguments [0].Expr = lt;
|
||||
}
|
||||
|
||||
ec.Emit (OpCodes.Brtrue_S, NullOperatorLabel);
|
||||
|
||||
if (!ec.ConditionalAccess.Statement) {
|
||||
if (ec.ConditionalAccess.Type.IsNullableType)
|
||||
Nullable.LiftedNull.Create (ec.ConditionalAccess.Type, Location.Null).Emit (ec);
|
||||
else
|
||||
ec.EmitNull ();
|
||||
}
|
||||
|
||||
ec.Emit (OpCodes.Br, ec.ConditionalAccess.EndLabel);
|
||||
ec.MarkLabel (NullOperatorLabel);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (a_expr.HasConditionalAccess ()) {
|
||||
var lt = new LocalTemporary (a_expr.Type);
|
||||
lt.EmitAssign (ec, a_expr, false, false);
|
||||
|
||||
Arguments [0].Expr = lt;
|
||||
}
|
||||
}
|
||||
|
||||
protected void EmitCall (EmitContext ec, Expression binder, Arguments arguments, bool isStatement)
|
||||
{
|
||||
//
|
||||
@@ -502,6 +551,24 @@ namespace Mono.CSharp
|
||||
StatementExpression s = new StatementExpression (new SimpleAssign (site_field_expr, new Invocation (new MemberAccess (instanceAccessExprType, "Create"), args)));
|
||||
|
||||
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
|
||||
|
||||
var conditionalAccessReceiver = IsConditionalAccessReceiver;
|
||||
var ca = ec.ConditionalAccess;
|
||||
|
||||
if (conditionalAccessReceiver) {
|
||||
ec.ConditionalAccess = new ConditionalAccessContext (type, ec.DefineLabel ()) {
|
||||
Statement = isStatement
|
||||
};
|
||||
|
||||
//
|
||||
// Emit conditional access expressions before dynamic call
|
||||
// is initialized. It pushes site_field_expr on stack before
|
||||
// the actual instance argument is emited which would cause
|
||||
// jump from non-empty stack.
|
||||
//
|
||||
EmitConditionalAccess (ec);
|
||||
}
|
||||
|
||||
if (s.Resolve (bc)) {
|
||||
Statement init = new If (new Binary (Binary.Operator.Equality, site_field_expr, new NullLiteral (loc)), s, loc);
|
||||
init.Emit (ec);
|
||||
@@ -526,9 +593,15 @@ namespace Mono.CSharp
|
||||
}
|
||||
}
|
||||
|
||||
Expression target = new DelegateInvocation (new MemberAccess (site_field_expr, "Target", loc).Resolve (bc), args, false, loc).Resolve (bc);
|
||||
if (target != null)
|
||||
var target = new DelegateInvocation (new MemberAccess (site_field_expr, "Target", loc).Resolve (bc), args, false, loc).Resolve (bc);
|
||||
if (target != null) {
|
||||
target.Emit (ec);
|
||||
}
|
||||
|
||||
if (conditionalAccessReceiver) {
|
||||
ec.CloseConditionalAccess (!isStatement && type.IsNullableType ? type : null);
|
||||
ec.ConditionalAccess = ca;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -547,6 +620,12 @@ namespace Mono.CSharp
|
||||
{
|
||||
return new MemberAccess (new TypeExpression (binder_type, loc), name, loc);
|
||||
}
|
||||
|
||||
protected virtual bool IsConditionalAccessReceiver {
|
||||
get {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -671,14 +750,18 @@ namespace Mono.CSharp
|
||||
class DynamicIndexBinder : DynamicMemberAssignable
|
||||
{
|
||||
bool can_be_mutator;
|
||||
readonly bool conditional_access_receiver;
|
||||
readonly bool conditional_access;
|
||||
|
||||
public DynamicIndexBinder (Arguments args, Location loc)
|
||||
public DynamicIndexBinder (Arguments args, bool conditionalAccessReceiver, bool conditionalAccess, Location loc)
|
||||
: base (args, loc)
|
||||
{
|
||||
this.conditional_access_receiver = conditionalAccessReceiver;
|
||||
this.conditional_access = conditionalAccess;
|
||||
}
|
||||
|
||||
public DynamicIndexBinder (CSharpBinderFlags flags, Arguments args, Location loc)
|
||||
: this (args, loc)
|
||||
: this (args, false, false, loc)
|
||||
{
|
||||
base.flags = flags;
|
||||
}
|
||||
@@ -732,22 +815,35 @@ namespace Mono.CSharp
|
||||
setter_args.Add (new Argument (rhs));
|
||||
return setter_args;
|
||||
}
|
||||
|
||||
protected override bool IsConditionalAccessReceiver {
|
||||
get {
|
||||
return conditional_access_receiver;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool HasConditionalAccess ()
|
||||
{
|
||||
return conditional_access;
|
||||
}
|
||||
}
|
||||
|
||||
class DynamicInvocation : DynamicExpressionStatement, IDynamicBinder
|
||||
{
|
||||
readonly ATypeNameExpression member;
|
||||
readonly bool conditional_access_receiver;
|
||||
|
||||
public DynamicInvocation (ATypeNameExpression member, Arguments args, Location loc)
|
||||
public DynamicInvocation (ATypeNameExpression member, Arguments args, bool conditionalAccessReceiver, Location loc)
|
||||
: base (null, args, loc)
|
||||
{
|
||||
base.binder = this;
|
||||
this.member = member;
|
||||
this.conditional_access_receiver = conditionalAccessReceiver;
|
||||
}
|
||||
|
||||
public static DynamicInvocation CreateSpecialNameInvoke (ATypeNameExpression member, Arguments args, Location loc)
|
||||
{
|
||||
return new DynamicInvocation (member, args, loc) {
|
||||
return new DynamicInvocation (member, args, false, loc) {
|
||||
flags = CSharpBinderFlags.InvokeSpecialName
|
||||
};
|
||||
}
|
||||
@@ -805,11 +901,36 @@ namespace Mono.CSharp
|
||||
flags |= CSharpBinderFlags.ResultDiscarded;
|
||||
base.EmitStatement (ec);
|
||||
}
|
||||
|
||||
protected override bool IsConditionalAccessReceiver {
|
||||
get {
|
||||
return conditional_access_receiver;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool HasConditionalAccess ()
|
||||
{
|
||||
return member is ConditionalMemberAccess;
|
||||
}
|
||||
}
|
||||
|
||||
class DynamicConditionalMemberBinder : DynamicMemberBinder
|
||||
{
|
||||
public DynamicConditionalMemberBinder (string name, Arguments args, Location loc)
|
||||
: base (name, args, loc)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool HasConditionalAccess ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class DynamicMemberBinder : DynamicMemberAssignable
|
||||
{
|
||||
readonly string name;
|
||||
bool conditionalAccessReceiver;
|
||||
|
||||
public DynamicMemberBinder (string name, Arguments args, Location loc)
|
||||
: base (args, loc)
|
||||
@@ -835,6 +956,20 @@ namespace Mono.CSharp
|
||||
isSet |= (flags & CSharpBinderFlags.ValueFromCompoundAssignment) != 0;
|
||||
return new Invocation (GetBinder (isSet ? "SetMember" : "GetMember", loc), binder_args);
|
||||
}
|
||||
|
||||
protected override Expression DoResolve (ResolveContext rc)
|
||||
{
|
||||
if (!rc.HasSet (ResolveContext.Options.DontSetConditionalAccessReceiver))
|
||||
conditionalAccessReceiver = HasConditionalAccess () || Arguments [0].Expr.HasConditionalAccess ();
|
||||
|
||||
return base.DoResolve (rc);
|
||||
}
|
||||
|
||||
protected override bool IsConditionalAccessReceiver {
|
||||
get {
|
||||
return conditionalAccessReceiver;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Loaded 100 of 211 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user