mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 01:41:18 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d01276bb36 | ||
|
|
7f1768441c | ||
|
|
39d89a335c | ||
|
|
a533cb343b | ||
|
|
c5b8988d22 | ||
|
|
15eab7066c | ||
|
|
e0e035e3b1 | ||
|
|
4e0a2ac0dd | ||
|
|
02928166e5 | ||
|
|
6c1f4b9746 | ||
|
|
4fe3280bba | ||
|
|
12ae4f9b0c | ||
|
|
a2b95fbb4b | ||
|
|
f795aa5d2d | ||
|
|
04493d2224 | ||
|
|
35284c340c | ||
|
|
077307fce4 | ||
|
|
1ad118647c | ||
|
|
86f99d31bd | ||
|
|
97aa066389 | ||
|
|
37091f00c2 | ||
|
|
955ad4538e | ||
|
|
fc0c12f768 | ||
|
|
c495285cac | ||
|
|
d18b8941ab | ||
|
|
1bdbf71a8b | ||
|
|
cae8c54884 | ||
|
|
8b479398bb | ||
|
|
9ef7249458 | ||
|
|
cd5d306ea0 | ||
|
|
8b628bb532 | ||
|
|
671db7c46d | ||
|
|
a57665c315 | ||
|
|
f552ff99a1 | ||
|
|
4e1474e9e3 | ||
|
|
f3235f3d03 | ||
|
|
3467e374ba | ||
|
|
f353dc4db0 | ||
|
|
f59eac4c0f | ||
|
|
a37e6e5739 | ||
|
|
6f9bef3bdb | ||
|
|
1c24c158b0 | ||
|
|
a49a68c6d7 | ||
|
|
92e11812f4 | ||
|
|
260676f948 | ||
|
|
eefdf4ed31 | ||
|
|
0754926394 | ||
|
|
7bdb7dd765 | ||
|
|
65d719d16e | ||
|
|
88262b52d2 | ||
|
|
aaed1f77ce | ||
|
|
58637d0ee7 | ||
|
|
c22f532871 | ||
|
|
d2a4141475 | ||
|
|
5db90bde0c | ||
|
|
21716f8b68 | ||
|
|
f2381f329a | ||
|
|
4afcb37eca | ||
|
|
139d2a441b | ||
|
|
76c1c1baec | ||
|
|
9529b37b69 | ||
|
|
f80aeb547f | ||
|
|
cbbe573e20 | ||
|
|
f80ae8146f | ||
|
|
5152e84055 | ||
|
|
35d4d7e8e6 | ||
|
|
d3fa0e12d0 | ||
|
|
2c0121911d | ||
|
|
fc45400caa | ||
|
|
baf8448122 | ||
|
|
e6b6562cdc | ||
|
|
c0bf542e2a | ||
|
|
4f23989316 | ||
|
|
514c06b12f | ||
|
|
d785f7d7f0 | ||
|
|
b7ea31a324 | ||
|
|
8d2dc95494 | ||
|
|
93e3dafc38 | ||
|
|
965c939531 | ||
|
|
7c317d0af3 | ||
|
|
6ec37b18d9 | ||
|
|
2a90cd598d | ||
|
|
48fcc7e350 | ||
|
|
90b0ea99cd | ||
|
|
217d0c7ab7 | ||
|
|
9824e260f5 | ||
|
|
a085951264 | ||
|
|
b4a42e6e4b | ||
|
|
a0228295dc | ||
|
|
91509419f5 | ||
|
|
07ba54237d | ||
|
|
5130d89a0d | ||
|
|
78740e252b | ||
|
|
0d37a86d2c | ||
|
|
9061f77e7f | ||
|
|
700f316825 | ||
|
|
12d764f5a0 | ||
|
|
638a7ed3b0 | ||
|
|
6c5b8bcc39 | ||
|
|
b1dda64bda | ||
|
|
64ec2dd3eb | ||
|
|
9bbc930d62 | ||
|
|
891c01eb6e | ||
|
|
e03516d11f | ||
|
|
4a00c501b2 | ||
|
|
34b31f05f5 | ||
|
|
8e08947e1c | ||
|
|
d96186b5e8 | ||
|
|
763e7f9d78 | ||
|
|
35cb6bda95 | ||
|
|
61da4c7a5f | ||
|
|
2710e67296 | ||
|
|
dbf27d49ad | ||
|
|
02390a7414 | ||
|
|
cea4294912 | ||
|
|
9e7efad7be | ||
|
|
d0562a9e6f | ||
|
|
887d3ad27e | ||
|
|
363790b1ec | ||
|
|
bf838da659 | ||
|
|
c530c5182f | ||
|
|
e310966925 | ||
|
|
5c2ab44dec | ||
|
|
0fac09cf89 | ||
|
|
02d69477dd | ||
|
|
54f51bf701 | ||
|
|
0ca09346e3 | ||
|
|
f5989de3b4 | ||
|
|
8ad8623646 | ||
|
|
19cc4c427a | ||
|
|
e88bfbcbce | ||
|
|
7048fb45ab | ||
|
|
2c564f83f2 | ||
|
|
3c52f0a4a9 | ||
|
|
c5f99aa4dc | ||
|
|
1e35db0ae2 | ||
|
|
88f5058a33 | ||
|
|
0d5eb5c9bb | ||
|
|
723f194cdc | ||
|
|
a5e4482376 | ||
|
|
95cc49a65c | ||
|
|
dea448aa83 | ||
|
|
21cef8b793 | ||
|
|
0ba54d6bdd | ||
|
|
c3e00ab9bc | ||
|
|
30b5b2b188 | ||
|
|
29adf3012f | ||
|
|
d6fde73640 | ||
|
|
572c33ae18 | ||
|
|
dcdd956e1b | ||
|
|
811e3b4dcd | ||
|
|
25aba4e86e | ||
|
|
ae7f365c06 | ||
|
|
cda8574a88 | ||
|
|
a6b0e1ccbe | ||
|
|
7ee378c904 | ||
|
|
511ca9f507 | ||
|
|
88b5266376 | ||
|
|
4aa9fd41b8 | ||
|
|
4bf541a969 | ||
|
|
b250b4a657 | ||
|
|
6c324b91b2 | ||
|
|
77fc4cfa2e | ||
|
|
3984508a04 | ||
|
|
67a2468db9 | ||
|
|
da0e172ae5 | ||
|
|
1c9d8aad07 | ||
|
|
c6fc176f5c | ||
|
|
c9bf7a3878 | ||
|
|
d37075a949 | ||
|
|
42fc0bd51f | ||
|
|
2487301faf | ||
|
|
0d6be4da5e | ||
|
|
ebbed2bb87 | ||
|
|
e5bad88ebb | ||
|
|
238c21cf77 | ||
|
|
2fbd5a16a3 | ||
|
|
a13c12ac99 | ||
|
|
bdf405fae4 | ||
|
|
ce612bb49e | ||
|
|
0a3d40ac60 | ||
|
|
c17d8c6dcd | ||
|
|
07d5a031d4 | ||
|
|
ff546b9d8b | ||
|
|
9922d1af20 | ||
|
|
875240538e | ||
|
|
e29f146ab3 | ||
|
|
535bfc5d84 | ||
|
|
5b66de0bf0 | ||
|
|
a6c7b9eca4 | ||
|
|
3577465fcd | ||
|
|
7d9e106c03 | ||
|
|
3931767dca | ||
|
|
deb3474e7c | ||
|
|
27c7a4b01e | ||
|
|
da5b39d785 | ||
|
|
7f69ff87b5 | ||
|
|
e33bf27c9a | ||
|
|
79030a3284 | ||
|
|
e74d4a6e31 | ||
|
|
c2fe39f13e | ||
|
|
0d8de253cb | ||
|
|
e9c512092d | ||
|
|
08a7043b66 | ||
|
|
cb89a1575c | ||
|
|
1a0508a58c | ||
|
|
d67d75a4f3 | ||
|
|
6036b45bce | ||
|
|
9136f4c1a0 | ||
|
|
abb82546d7 | ||
|
|
6af13f6e83 | ||
|
|
c684567bd7 | ||
|
|
4ab5e8a495 | ||
|
|
ed56e90aca | ||
|
|
57e18b15d0 | ||
|
|
279d7e230f | ||
|
|
2ce1d5f3d5 | ||
|
|
668baf1915 | ||
|
|
2201952d9a | ||
|
|
4d3e9d53b2 | ||
|
|
2476d2ac06 | ||
|
|
91fe1eb5f5 | ||
|
|
bb0c123e74 | ||
|
|
e965e1647d | ||
|
|
a652297384 | ||
|
|
685d39238a | ||
|
|
3648ace2b9 | ||
|
|
b62bfdcb55 | ||
|
|
9f2841c3a0 | ||
|
|
6f90188e9f | ||
|
|
84027bddaa | ||
|
|
66f19a974a | ||
|
|
99b7f59ddc | ||
|
|
f28abdbebd | ||
|
|
2dc56b5a60 | ||
|
|
58d02a9603 | ||
|
|
fa1ec4ac4d | ||
|
|
30aadcaa3a | ||
|
|
214321dee5 | ||
|
|
413f2fb976 | ||
|
|
020ac2de89 | ||
|
|
769bf9ef25 | ||
|
|
878a54030a | ||
|
|
a849f9a6e8 | ||
|
|
d9aa6f4083 | ||
|
|
c0b76ff9ae | ||
|
|
5cef19dcd2 | ||
|
|
ffe180c47f | ||
|
|
c627c1b4b6 | ||
|
|
d0e7df4717 | ||
|
|
28c171a337 | ||
|
|
0c8f0774ce | ||
|
|
6a1b416592 | ||
|
|
078760db9b | ||
|
|
ffc643d10c | ||
|
|
6ed6a1b568 | ||
|
|
33b47292c3 | ||
|
|
df0a29e779 | ||
|
|
6ccf73c8c8 | ||
|
|
d6b6fc61f1 | ||
|
|
8249522f23 | ||
|
|
2623bc3045 | ||
|
|
3be3714b6e | ||
|
|
daace66339 | ||
|
|
fd18515516 | ||
|
|
c68cc6a4f4 | ||
|
|
4169af750b | ||
|
|
ed22f9fa84 | ||
|
|
d389ff9ff6 | ||
|
|
d1f461c5a3 | ||
|
|
4e29f2ef9a | ||
|
|
b242e82ba4 | ||
|
|
9c9d5d9e22 | ||
|
|
f8ed9bcd12 | ||
|
|
578cfcd146 | ||
|
|
93705443b6 | ||
|
|
5f626db882 | ||
|
|
6cb693c4b5 | ||
|
|
e96f9fbb4a | ||
|
|
6559a504ed | ||
|
|
c62864c98e | ||
|
|
c5accf5ebc | ||
|
|
470256aca5 | ||
|
|
f0f76abc30 | ||
|
|
e7e28f4b9d | ||
|
|
00dec1f0c0 | ||
|
|
e0c46d9114 | ||
|
|
ba542c0b1e | ||
|
|
72aea0056b | ||
|
|
0dfa4f85a9 | ||
|
|
d956447d56 | ||
|
|
4aa717dc82 | ||
|
|
d8e28e14a5 | ||
|
|
176f127c1b | ||
|
|
764b03fcab | ||
|
|
1df45be2e9 | ||
|
|
e9fa8a306d | ||
|
|
7126712f86 | ||
|
|
07a5c686e0 | ||
|
|
bc64a17db8 | ||
|
|
f3c1fcd7c9 | ||
|
|
268f2ac419 | ||
|
|
ebb26ab546 | ||
|
|
01e35bc383 | ||
|
|
4e374e8cea | ||
|
|
94a8a589c8 | ||
|
|
fd7c5cdac6 | ||
|
|
942dd07c65 | ||
|
|
f403697225 | ||
|
|
20ada1bc3b | ||
|
|
3320f45d98 | ||
|
|
f804385745 | ||
|
|
8f16dd35ba | ||
|
|
fe918745d5 |
No files matched your search
+2
-8
@@ -11,15 +11,9 @@ else
|
||||
tools_dir = tools
|
||||
endif
|
||||
|
||||
if BUILD_SUPPORT
|
||||
support_dir = support
|
||||
else
|
||||
support_dir =
|
||||
endif
|
||||
|
||||
SUBDIRS = po $(libgc_dir) mono $(ikvm_native_dir) $(support_dir) data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm
|
||||
SUBDIRS = po $(libgc_dir) mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm
|
||||
# Keep in sync with SUBDIRS
|
||||
DIST_SUBDIRS = m4 po $(libgc_dir) mono ikvm-native $(support_dir) data runtime scripts man samples tools msvc docs acceptance-tests llvm
|
||||
DIST_SUBDIRS = m4 po $(libgc_dir) mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm
|
||||
|
||||
all: update_submodules
|
||||
|
||||
|
||||
@@ -2217,7 +2217,6 @@ CORECLR_COREMANGLIB_TEST_CS_SRC= \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcgettotalmemory.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gckeepalive.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcmaxgeneration.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcsuppressfinalize.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcwaitforpendingfinalizers.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/globalization/calendarweekrule/calendarweekrulefirstday.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/globalization/calendarweekrule/calendarweekrulefirstfourdayweek.cs \
|
||||
@@ -3982,6 +3981,10 @@ CORECLR_DISABLED_TEST_CS_SRC += \
|
||||
$(CORECLR_PATH)/tests/src/JIT/Directed/newarr/newarr.cs \
|
||||
$(CORECLR_PATH)/tests/src/baseservices/exceptions/sharedexceptions/emptystacktrace/oomexception01.cs
|
||||
|
||||
# https://github.com/mono/mono/issues/7432
|
||||
CORECLR_DISABLED_TEST_CS_SRC += \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcsuppressfinalize.cs
|
||||
|
||||
CORECLR_TEST_IL_SRC = \
|
||||
$(CORECLR_PATH)/tests/src/JIT/BBT/Scenario4/Not-Int32.il \
|
||||
$(CORECLR_PATH)/tests/src/JIT/Directed/Convert/implicitConv.il \
|
||||
|
||||
+68
-4
@@ -1,7 +1,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#AC_PREREQ([2.62])
|
||||
|
||||
AC_INIT(mono, [5.11.0],
|
||||
AC_INIT(mono, [5.12.0],
|
||||
[https://github.com/mono/mono/issues/new])
|
||||
|
||||
AC_CONFIG_SRCDIR([README.md])
|
||||
@@ -40,7 +40,7 @@ MONO_VERSION_BUILD=`echo $VERSION | cut -d . -f 3`
|
||||
# This can be reset to 0 when Mono's version number is bumped
|
||||
# since it's part of the corlib version (the prefix '1' in the full
|
||||
# version number is to ensure the number isn't treated as octal in C)
|
||||
MONO_CORLIB_COUNTER=4
|
||||
MONO_CORLIB_COUNTER=5
|
||||
MONO_CORLIB_VERSION=`printf "1%02d%02d%02d%03d" $MONO_VERSION_MAJOR $MONO_VERSION_MINOR 0 $MONO_CORLIB_COUNTER`
|
||||
|
||||
AC_DEFINE_UNQUOTED(MONO_CORLIB_VERSION,$MONO_CORLIB_VERSION,[Version of the corlib-runtime interface])
|
||||
@@ -979,6 +979,30 @@ AC_SUBST(JEMALLOC_LDFLAGS)
|
||||
AC_SUBST(JEMALLOC_AUTOCONF_FLAGS)
|
||||
fi
|
||||
|
||||
|
||||
# Terminology:
|
||||
# Crash privacy - Attempts to not send identifying information in the crash dump / to protect the obscurity of the program control flow
|
||||
# MERP - The MS telemetry profile. Not for general use.
|
||||
# Structured crashes - crashes at runtime that trigger a stack walk by mono that happens cooperatively
|
||||
|
||||
# Structured crashes are not merp crashes. Structured crashes are json dumps made by mono during crashes. Merp upload is going to use the dumping code is a very specific way, and is enabled at runtime with an icall.
|
||||
|
||||
#--with-crash_privacy=yes --with-structured_crashes=no means we don't wanna dump in non-merp-enabled builds, and we want to not send symbol strings. This is going to be the default pair of settings for VS4Mac.
|
||||
#--with-crash_privacy=yes --with-structured_crashes=yes means you want to see crashes on your console, and you want to not see unmanaged symbol names. This is an option for proprietary apps that have manual bugs filed.
|
||||
#--with-crash_privacy=no --with-structured_crashes=no means you want to see no crash dumps on failure and you don't care about privacy. This is how you'd set a "don't want it, don't care" configuration.
|
||||
#--with-crash_privacy=no --with-structured_crashes=yes means you want full crashes and you want to see them in the terminal, not on telemetry. This is going to be how we build for CI.
|
||||
|
||||
AC_ARG_WITH(crash-privacy, [ --with-crash_privacy=yes,no If you want your crashes to not include names of symbols present in the binary. ], [], [with_crash_privacy=no])
|
||||
AC_ARG_WITH(structured-crashes, [ --with-structured_crashes=yes,no If you want your unmanaged crashes to result in a small crash dump file. ], [], [with_structured_crashes=yes])
|
||||
|
||||
if test "x$with_crash_privacy" = "xno"; then
|
||||
AC_DEFINE(MONO_PRIVATE_CRASHES,1,[Do not include names of unmanaged functions in the crash dump])
|
||||
fi
|
||||
|
||||
if test "x$with_structured_crashes" = "xno"; then
|
||||
AC_DEFINE(DISABLE_STRUCTURED_CRASH,1,[Do not create structured crash files during unmanaged crashes])
|
||||
fi
|
||||
|
||||
#
|
||||
# Set the build profiles and options before things which use them
|
||||
#
|
||||
@@ -1421,6 +1445,12 @@ fi
|
||||
|
||||
AM_CONDITIONAL(DISABLE_INTERPRETER, test x$mono_feature_disable_interpreter = xyes)
|
||||
|
||||
if test "x$mono_feature_disable_interpreter" != "xyes" -o "x$mono_feature_disable_jit" != "xyes"; then
|
||||
AC_DEFINE(ENABLE_ILGEN, 1, [Some VES is available at runtime])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_ILGEN, test x$mono_feature_disable_interpreter != xyes -o x$mono_feature_disable_jit != xyes)
|
||||
|
||||
if test "x$mono_feature_disable_simd" = "xyes"; then
|
||||
AC_DEFINE(DISABLE_SIMD, 1, [Disable SIMD intrinsics related optimizations.])
|
||||
AC_MSG_NOTICE([Disabled SIMD support])
|
||||
@@ -1657,6 +1687,33 @@ if test x$platform_android = xyes; then
|
||||
fi
|
||||
|
||||
if test x$host_win32 = xno; then
|
||||
dnl *************************************
|
||||
dnl *** Checks for time capabilities ***
|
||||
dnl *************************************
|
||||
|
||||
AC_MSG_CHECKING(for CLOCK_MONOTONIC)
|
||||
AC_TRY_COMPILE([#include <time.h>], [
|
||||
const int foo = CLOCK_MONOTONIC;
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_CLOCK_MONOTONIC, 1, [CLOCK_MONOTONIC])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(for CLOCK_MONOTONIC_COARSE)
|
||||
AC_TRY_COMPILE([#include <time.h>], [
|
||||
const int foo = CLOCK_MONOTONIC_COARSE;
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_CLOCK_MONOTONIC_COARSE, 1, [CLOCK_MONOTONIC_COARSE])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_CHECK_FUNC(mach_absolute_time, [AC_DEFINE(HAVE_MACH_ABSOLUTE_TIME, 1, [mach_absolute_time])])
|
||||
AC_CHECK_FUNC(gethrtime, [AC_DEFINE(HAVE_GETHRTIME, 1, [gethrtime])])
|
||||
AC_CHECK_FUNC(read_real_time, [AC_DEFINE(HAVE_READ_REAL_TIME, 1, [read_real_time])])
|
||||
|
||||
dnl hires monotonic clock support
|
||||
AC_SEARCH_LIBS(clock_gettime, rt)
|
||||
@@ -4075,7 +4132,7 @@ fi
|
||||
AC_SUBST(G_HAVE_ISO_VARARGS)
|
||||
|
||||
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h iconv.h localcharset.h sys/types.h sys/resource.h)
|
||||
AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+="-liconv -lcharset"])])
|
||||
AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+=" -liconv -lcharset"])])
|
||||
AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
|
||||
AC_SUBST(HAVE_ALLOCA_H)
|
||||
|
||||
@@ -4167,6 +4224,8 @@ if test "x$icall_tables" = "xno"; then
|
||||
AC_DEFINE(DISABLE_ICALL_TABLES, 1, [Icall tables disabled])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(DISABLE_ICALL_TABLES, test x$icall_tables = xno)
|
||||
|
||||
if test "x$with_tls" = "x__thread"; then
|
||||
AC_DEFINE(HAVE_KW_THREAD, 1, [Have __thread keyword])
|
||||
# Pass the information to libgc
|
||||
@@ -4486,9 +4545,14 @@ dnl *** Btls ***
|
||||
dnl **************
|
||||
|
||||
AC_ARG_ENABLE(btls, [ --disable-btls Disable the BoringTls provider], enable_btls=$enableval, enable_btls=$BTLS_SUPPORTED)
|
||||
AC_ARG_ENABLE(btls-lib, [ --disable-btls-lib Disable building the BTLS native library], enable_btls_lib=$enableval, enable_btls_lib=$BTLS_SUPPORTED)
|
||||
AC_ARG_WITH(btls_android_ndk, [ --with-btls-android-ndk Android NDK for BoringTls])
|
||||
|
||||
AM_CONDITIONAL(BTLS, test x$enable_btls = xyes)
|
||||
if test "x$enable_btls" = "xno"; then
|
||||
enable_btls_lib=no
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(BTLS, test x$enable_btls_lib = xyes)
|
||||
|
||||
btls_android=no
|
||||
if test "x$enable_btls" = "xyes"; then
|
||||
|
||||
Vendored
+1
-1
Submodule external/api-snapshot updated: 10fb3656f9...747f69d6d9.
Vendored
+1
-1
Submodule external/binary-reference-assemblies updated: 47546281d8...e048fe4a88.
Vendored
+1
-1
Submodule external/bockbuild updated: f643982aef...cee494cc15.
Vendored
+1
-1
Submodule external/cecil updated: dfee11e80d...b6c50e3d34.
Vendored
+1
-1
Submodule external/corefx updated: c01df835c9...f2c0be7e62.
Vendored
+1
-1
Submodule external/linker updated: 4b32a99397...dccb0d2378.
Vendored
+1
-1
Submodule external/nunit-lite updated: a8bef89392...00e259a4bd.
Vendored
+1
-1
Submodule external/roslyn-binaries updated: 00da53c474...ab3485efcd.
Vendored
+1
-1
Submodule external/xunit-binaries updated: c5a907be25...9df2dda529.
+1
-1
@@ -47,7 +47,7 @@ all-profiles $(STD_TARGETS:=-profiles): %-profiles: profiles-do--%
|
||||
@:
|
||||
|
||||
profiles-do--%:
|
||||
$(MAKE) $(PROFILES:%=profile-do--%--$*)
|
||||
$(if $(PROFILES),$(MAKE) $(PROFILES:%=profile-do--%--$*))
|
||||
|
||||
# The % below looks like profile-name--target-name
|
||||
profile-do--%:
|
||||
|
||||
@@ -394,5 +394,5 @@ ifneq ($(RESX_STRINGS),)
|
||||
endif
|
||||
|
||||
update-corefx-sr: $(RESX_RESOURCE_STRING) $(XTEST_RESX_RESOURCE_STRING)
|
||||
make SR_OUTPUT=corefx/SR.cs RESX_STRINGS=$(RESX_RESOURCE_STRING) update-corefx-sr-generic \
|
||||
make SR_OUTPUT=corefx/SR.cs RESX_STRINGS="$(RESX_RESOURCE_STRING)" update-corefx-sr-generic \
|
||||
&& make SR_OUTPUT=corefx/SR.tests.cs RESX_STRINGS=$(XTEST_RESX_RESOURCE_STRING) update-corefx-sr-generic
|
||||
@@ -22,3 +22,5 @@ NO_TEST = yes
|
||||
NO_INSTALL = yes
|
||||
|
||||
FRAMEWORK_VERSION = 4.5
|
||||
MONO_FEATURE_APPLETLS=1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Copyright (c) 2018 Microsoft
|
||||
//
|
||||
// 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.Runtime.CompilerServices;
|
||||
|
||||
[assembly: AssemblyTitle ("System.Drawing.Common")]
|
||||
[assembly: AssemblyDescription ("System.Drawing.Common")]
|
||||
[assembly: AssemblyDefaultAlias ("System.Drawing.Common")]
|
||||
[assembly: AssemblyCompany ("Mono development team")]
|
||||
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
|
||||
[assembly: AssemblyCopyright ("(c) Various Mono authors")]
|
||||
[assembly: AssemblyVersion ("4.0.0.0")]
|
||||
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
|
||||
[assembly: AssemblyFileVersion ("4.0.0.0")]
|
||||
@@ -0,0 +1,49 @@
|
||||
MCS_BUILD_DIR = ../../../build
|
||||
|
||||
thisdir = class/Facades/System.Drawing.Common
|
||||
SUBDIRS =
|
||||
include $(MCS_BUILD_DIR)/rules.make
|
||||
|
||||
LIBRARY_SUBDIR = Facades
|
||||
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
|
||||
|
||||
LIBRARY = System.Drawing.Common.dll
|
||||
|
||||
KEYFILE = ../../Open.snk
|
||||
LIBRARY_SNK = $(KEYFILE)
|
||||
SIGN_FLAGS = /delaysign /nowarn:1616,1699
|
||||
LIB_REFS =
|
||||
LIB_MCS_FLAGS = $(SIGN_FLAGS) $(EXTRA_LIB_MCS_FLAGS)
|
||||
|
||||
ifdef false # we'll enable this at a later point
|
||||
|
||||
# xammac_net_4_5 and the testing_* profiles are special, they don't build
|
||||
# System.Drawing.dll or equivalent neither in Mono nor in the XM repo.
|
||||
# For now we embed the types directly here.
|
||||
# TODO: find a better solution.
|
||||
EMBEDDED_DRAWING_DEP := $(filter xammac_net_4_5 testing_aot_full testing_aot_hybrid, $(PROFILE))
|
||||
|
||||
ifndef EMBEDDED_DRAWING_DEP
|
||||
|
||||
# profiles which build a System.Drawing.dll in the repo
|
||||
REPO_DRAWING_DEP := $(filter net_4_x orbis winaot unreal wasm, $(PROFILE))
|
||||
|
||||
ifdef REPO_DRAWING_DEP
|
||||
LIB_REFS += System.Drawing
|
||||
else
|
||||
# When System.Drawing.dll is not built in the Mono repo but in
|
||||
# the product repo like in the XI/XA case we need to pass in a reference
|
||||
# to the assembly containing drawing types like Rectangle etc. from there.
|
||||
# This needs to be passed in via EXTERNAL_FACADE_DRAWING_REFERENCE.
|
||||
LIB_MCS_FLAGS += /r:$(EXTERNAL_FACADE_DRAWING_REFERENCE)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
PLATFORM_DEBUG_FLAGS =
|
||||
|
||||
NO_TEST = yes
|
||||
|
||||
include $(MCS_BUILD_DIR)/library.make
|
||||
@@ -0,0 +1,2 @@
|
||||
TypeForwarders.cs
|
||||
AssemblyInfo.cs
|
||||
@@ -0,0 +1,174 @@
|
||||
//
|
||||
// Copyright (c) 2018 Microsoft
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#if false // we'll enable these at a later point
|
||||
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Bitmap))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.BitmapSuffixInSameAssemblyAttribute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.BitmapSuffixInSatelliteAssemblyAttribute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Brush))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Brushes))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.BufferedGraphics))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.BufferedGraphicsContext))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.BufferedGraphicsManager))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.CharacterRange))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.ColorTranslator))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.ContentAlignment))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.CopyPixelOperation))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Design.CategoryNameCollection))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.AdjustableArrowCap))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.Blend))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.ColorBlend))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.CombineMode))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.CompositingMode))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.CompositingQuality))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.CoordinateSpace))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.CustomLineCap))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.DashCap))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.DashStyle))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.FillMode))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.FlushIntention))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.GraphicsContainer))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.GraphicsPath))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.GraphicsPathIterator))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.GraphicsState))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.HatchBrush))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.HatchStyle))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.InterpolationMode))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.LinearGradientBrush))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.LinearGradientMode))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.LineCap))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.LineJoin))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.Matrix))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.MatrixOrder))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.PathData))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.PathGradientBrush))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.PathPointType))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.PenAlignment))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.PenType))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.PixelOffsetMode))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.QualityMode))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.RegionData))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.SmoothingMode))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.WarpMode))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.WrapMode))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Font))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.FontFamily))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.FontStyle))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Graphics))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Graphics.DrawImageAbort))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Graphics.EnumerateMetafileProc))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.GraphicsUnit))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Icon))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.IDeviceContext))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Image))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Image.GetThumbnailImageAbort))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.ImageAnimator))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.BitmapData))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorAdjustType))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorChannelFlag))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorMap))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorMapType))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorMatrix))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorMatrixFlag))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorMode))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorPalette))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.EmfPlusRecordType))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.EmfType))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.Encoder))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.EncoderParameter))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.EncoderParameters))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.EncoderParameterValueType))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.EncoderValue))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.FrameDimension))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ImageAttributes))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ImageCodecFlags))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ImageCodecInfo))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ImageFlags))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ImageFormat))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ImageLockMode))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.Metafile))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.MetafileFrameUnit))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.MetafileHeader))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.MetafileType))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.MetaHeader))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.PaletteFlags))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.PixelFormat))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.PlayRecordCallback))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.PropertyItem))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.WmfPlaceableFileHeader))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Pen))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Pens))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.Duplex))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.InvalidPrinterException))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.Margins))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PageSettings))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PaperKind))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PaperSize))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PaperSource))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PaperSourceKind))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PreviewPageInfo))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PreviewPrintController))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintAction))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintController))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintDocument))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterResolution))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterResolutionKind))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterSettings))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterSettings.PaperSizeCollection))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterSettings.PaperSourceCollection))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterSettings.PrinterResolutionCollection))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterSettings.StringCollection))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterUnit))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterUnitConvert))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintEventArgs))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintEventHandler))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintPageEventArgs))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintPageEventHandler))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintRange))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.QueryPageSettingsEventArgs))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.QueryPageSettingsEventHandler))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.StandardPrintController))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Region))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.RotateFlipType))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.SolidBrush))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.StringAlignment))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.StringDigitSubstitute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.StringFormat))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.StringFormatFlags))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.StringTrimming))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.StringUnit))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.SystemBrushes))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.SystemColors))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.SystemFonts))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.SystemIcons))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.SystemPens))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Text.FontCollection))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Text.GenericFontFamilies))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Text.HotkeyPrefix))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Text.InstalledFontCollection))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Text.PrivateFontCollection))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Text.TextRenderingHint))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.TextureBrush))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.ToolboxBitmapAttribute))]
|
||||
|
||||
#endif
|
||||
@@ -9,7 +9,7 @@ LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
|
||||
|
||||
LIBRARY = System.IO.Compression.ZipFile.dll
|
||||
|
||||
KEYFILE = ../../msfinal.pub
|
||||
KEYFILE = ../../ecma.pub
|
||||
SIGN_FLAGS = /delaysign /nowarn:1616,1699
|
||||
LIB_REFS = System System.IO.Compression.FileSystem
|
||||
LIB_MCS_FLAGS = $(SIGN_FLAGS)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Copyright (c) 2018 Microsoft
|
||||
//
|
||||
// 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.Runtime.CompilerServices;
|
||||
|
||||
[assembly: AssemblyTitle ("System.Memory")]
|
||||
[assembly: AssemblyDescription ("System.Memory")]
|
||||
[assembly: AssemblyDefaultAlias ("System.Memory")]
|
||||
[assembly: AssemblyCompany ("Mono development team")]
|
||||
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
|
||||
[assembly: AssemblyCopyright ("(c) Various Mono authors")]
|
||||
[assembly: AssemblyVersion ("4.0.1.0")]
|
||||
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
|
||||
[assembly: AssemblyFileVersion ("4.0.0.0")]
|
||||
@@ -0,0 +1,24 @@
|
||||
MCS_BUILD_DIR = ../../../build
|
||||
|
||||
thisdir = class/Facades/System.Memory
|
||||
SUBDIRS =
|
||||
include $(MCS_BUILD_DIR)/rules.make
|
||||
|
||||
LIBRARY_SUBDIR = Facades
|
||||
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
|
||||
|
||||
LIBRARY = System.Memory.dll
|
||||
|
||||
KEYFILE = ../../Open.snk
|
||||
LIBRARY_SNK = $(KEYFILE)
|
||||
SIGN_FLAGS = /delaysign /nowarn:1616,1699
|
||||
LIB_REFS =
|
||||
LIB_MCS_FLAGS = $(SIGN_FLAGS)
|
||||
|
||||
PLATFORM_DEBUG_FLAGS =
|
||||
|
||||
NO_TEST = yes
|
||||
|
||||
include $(MCS_BUILD_DIR)/library.make
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
TypeForwarders.cs
|
||||
AssemblyInfo.cs
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// Copyright (c) 2018 Microsoft
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.MemoryExtensions))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Memory<>))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ReadOnlyMemory<>))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ReadOnlySpan<>))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Span<>))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.MemoryHandle))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.OperationStatus))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.StandardFormat))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Binary.BinaryPrimitives))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.MemoryMarshal))]
|
||||
|
||||
// TODO: we don't have these types yet
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.SequencePosition))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.BuffersExtensions))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.IBufferWriter<>))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.IMemoryOwner<>))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.IPinnable))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.MemoryManager<>))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.MemoryPool<>))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.ReadOnlySequenceSegment<>))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.ReadOnlySequence<>))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Text.Base64))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Text.Utf8Formatter))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Text.Utf8Parser))]
|
||||
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.SequenceMarshal))]
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Copyright (c) 2013 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;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: AssemblyTitle ("System.Net.Http.Rtc")]
|
||||
[assembly: AssemblyDescription ("System.Net.Http.Rtc")]
|
||||
[assembly: AssemblyDefaultAlias ("System.Net.Http.Rtc")]
|
||||
[assembly: AssemblyCompany ("Mono development team")]
|
||||
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
|
||||
[assembly: AssemblyCopyright ("(c) Various Mono authors")]
|
||||
[assembly: AssemblyVersion ("4.0.0.0")]
|
||||
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
|
||||
[assembly: AssemblyFileVersion ("4.0.0.0")]
|
||||
@@ -0,0 +1,21 @@
|
||||
MCS_BUILD_DIR = ../../../build
|
||||
|
||||
thisdir = class/Facades/System.Net.Http.Rtc
|
||||
SUBDIRS =
|
||||
include $(MCS_BUILD_DIR)/rules.make
|
||||
|
||||
LIBRARY_SUBDIR = Facades
|
||||
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
|
||||
|
||||
LIBRARY = System.Net.Http.Rtc.dll
|
||||
|
||||
KEYFILE = ../../msfinal.pub
|
||||
SIGN_FLAGS = /delaysign /nowarn:1616,1699
|
||||
LIB_REFS = System
|
||||
LIB_MCS_FLAGS = $(SIGN_FLAGS)
|
||||
|
||||
PLATFORM_DEBUG_FLAGS =
|
||||
|
||||
NO_TEST = yes
|
||||
|
||||
include $(MCS_BUILD_DIR)/library.make
|
||||
@@ -0,0 +1,2 @@
|
||||
TypeForwarders.cs
|
||||
AssemblyInfo.cs
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Copyright (c) 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.
|
||||
//
|
||||
|
||||
#if false // it is forwarded to System.Net.Http.WebRequest.dll but doesn't actually exist there in the .NET 4.7.1 reference assemblies ...
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Http.RtcRequestFactory))]
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Copyright (c) 2015 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;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: AssemblyTitle ("System.Resources.Reader")]
|
||||
[assembly: AssemblyDescription ("System.Resources.Reader")]
|
||||
[assembly: AssemblyDefaultAlias ("System.Resources.Reader")]
|
||||
[assembly: AssemblyCompany ("Mono development team")]
|
||||
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
|
||||
[assembly: AssemblyCopyright ("(c) Various Mono authors")]
|
||||
[assembly: AssemblyVersion ("4.0.2.0")]
|
||||
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
|
||||
[assembly: AssemblyFileVersion ("4.0.0.0")]
|
||||
@@ -0,0 +1,23 @@
|
||||
MCS_BUILD_DIR = ../../../build
|
||||
|
||||
thisdir = class/Facades/System.Resources.Reader
|
||||
SUBDIRS =
|
||||
include $(MCS_BUILD_DIR)/rules.make
|
||||
|
||||
LIBRARY_SUBDIR = Facades
|
||||
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
|
||||
|
||||
LIBRARY = System.Resources.Reader.dll
|
||||
|
||||
KEYFILE = ../../msfinal.pub
|
||||
SIGN_FLAGS = /delaysign /nowarn:1616,1699
|
||||
LIB_REFS = System
|
||||
LIB_MCS_FLAGS = $(SIGN_FLAGS)
|
||||
|
||||
PLATFORM_DEBUG_FLAGS =
|
||||
|
||||
NO_TEST = yes
|
||||
|
||||
include $(MCS_BUILD_DIR)/library.make
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
TypeForwarders.cs
|
||||
AssemblyInfo.cs
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Copyright (c) 2015 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.
|
||||
//
|
||||
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceReader))]
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Copyright (c) 2015 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;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: AssemblyTitle ("System.Resources.Writer")]
|
||||
[assembly: AssemblyDescription ("System.Resources.Writer")]
|
||||
[assembly: AssemblyDefaultAlias ("System.Resources.Writer")]
|
||||
[assembly: AssemblyCompany ("Mono development team")]
|
||||
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
|
||||
[assembly: AssemblyCopyright ("(c) Various Mono authors")]
|
||||
[assembly: AssemblyVersion ("4.0.2.0")]
|
||||
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
|
||||
[assembly: AssemblyFileVersion ("4.0.0.0")]
|
||||
@@ -0,0 +1,23 @@
|
||||
MCS_BUILD_DIR = ../../../build
|
||||
|
||||
thisdir = class/Facades/System.Resources.Writer
|
||||
SUBDIRS =
|
||||
include $(MCS_BUILD_DIR)/rules.make
|
||||
|
||||
LIBRARY_SUBDIR = Facades
|
||||
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
|
||||
|
||||
LIBRARY = System.Resources.Writer.dll
|
||||
|
||||
KEYFILE = ../../msfinal.pub
|
||||
SIGN_FLAGS = /delaysign /nowarn:1616,1699
|
||||
LIB_REFS = System
|
||||
LIB_MCS_FLAGS = $(SIGN_FLAGS)
|
||||
|
||||
PLATFORM_DEBUG_FLAGS =
|
||||
|
||||
NO_TEST = yes
|
||||
|
||||
include $(MCS_BUILD_DIR)/library.make
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
TypeForwarders.cs
|
||||
AssemblyInfo.cs
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Copyright (c) 2015 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.
|
||||
//
|
||||
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceWriter))]
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@ System.Xml.XPath System.Xml.XmlDocument System.Xml.Xsl.Primitives Microsoft.Win3
|
||||
System.IO.FileSystem.AccessControl System.Reflection.TypeExtensions System.Reflection.Emit.Lightweight System.Reflection.Emit.ILGeneration System.Reflection.Emit \
|
||||
System.Threading.AccessControl System.ValueTuple \
|
||||
System.Security.Cryptography.Primitives System.Text.Encoding.CodePages System.IO.FileSystem.Watcher \
|
||||
System.Security.Cryptography.ProtectedData System.ServiceProcess.ServiceController System.IO.Pipes
|
||||
System.Security.Cryptography.ProtectedData System.ServiceProcess.ServiceController System.IO.Pipes \
|
||||
System.Net.Ping System.Resources.Reader System.Resources.Writer System.Runtime.Serialization.Formatters System.Security.Cryptography.Csp
|
||||
|
||||
# common_SUBDIRS dependencies
|
||||
common_DEPS_SUBDIRS = System.Security.Cryptography.X509Certificates System.ServiceModel.Primitives System.Runtime.Serialization.Primitives \
|
||||
@@ -50,7 +51,7 @@ testing_aot_full_SUBDIRS = $(monotouch_SUBDIRS)
|
||||
testing_aot_full_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
|
||||
|
||||
net_4_x_SUBDIRS = $(common_DEPS_SUBDIRS) $(netstandard_drawing_SUBDIRS)
|
||||
net_4_x_PARALLEL_SUBDIRS = $(common_SUBDIRS)
|
||||
net_4_x_PARALLEL_SUBDIRS = $(common_SUBDIRS) System.Net.Http.Rtc
|
||||
|
||||
basic_PARALLEL_SUBDIRS = System.Runtime System.Reflection System.Collections System.Resources.ResourceManager System.Globalization \
|
||||
System.Threading.Tasks System.Collections.Concurrent System.Text.Encoding System.IO System.Threading System.Diagnostics.Debug \
|
||||
@@ -89,8 +90,8 @@ unreal_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS)
|
||||
wasm_SUBDIRS = $(common_DEPS_SUBDIRS) $(netstandard_drawing_SUBDIRS) $(mobile_only_DEPS_SUBDIRS)
|
||||
wasm_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS)
|
||||
|
||||
mobile_only_SUBDIRS = System.Net.Ping System.Runtime.Serialization.Formatters System.Security.Cryptography.Csp System.Security.Cryptography.Pkcs \
|
||||
System.Security.Cryptography.Cng System.Runtime.Loader System.Xml.XPath.XmlDocument System.Reflection.DispatchProxy
|
||||
mobile_only_SUBDIRS = System.Security.Cryptography.Pkcs \
|
||||
System.Security.Cryptography.Cng System.Runtime.Loader System.Xml.XPath.XmlDocument System.Reflection.DispatchProxy System.Drawing.Common
|
||||
|
||||
mobile_only_DEPS_SUBDIRS = System.Security.Cryptography.OpenSsl
|
||||
|
||||
|
||||
@@ -59,6 +59,13 @@ namespace Microsoft.Build.Utilities
|
||||
bool typeLoadException;
|
||||
ManualResetEvent canceled;
|
||||
|
||||
/* dummy getter/setter for msbuild compability */
|
||||
public bool YieldDuringToolExecution
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
protected ToolTask ()
|
||||
: this (null, null)
|
||||
{
|
||||
|
||||
@@ -19,6 +19,12 @@ endif
|
||||
TEST_MCS_FLAGS =
|
||||
TEST_LIB_REFS = System.Core
|
||||
|
||||
ifndef NO_PROCESS_START
|
||||
REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_PROCESS_START
|
||||
TEST_MCS_FLAGS += -d:MONO_FEATURE_PROCESS_START
|
||||
endif
|
||||
|
||||
|
||||
LIB_MCS_FLAGS += $(REFERENCE_SOURCES_FLAGS)
|
||||
|
||||
BUILT_SOURCES = $(PROFILE)-parser.cs
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace Mono.Debugger.Soft
|
||||
if (!type.IsEnum)
|
||||
throw new ArgumentException ("type must be an enum type", "type");
|
||||
TypeMirror t = type.EnumUnderlyingType;
|
||||
if (value.Value == null || !value.Value.GetType ().IsPrimitive || t != vm.RootDomain.GetCorrespondingType (value.Value.GetType ()))
|
||||
// Can't access t's domain, so compare type names
|
||||
if (value.Value == null || !value.Value.GetType ().IsPrimitive || t.Name != vm.RootDomain.GetCorrespondingType (value.Value.GetType ()).Name)
|
||||
throw new ArgumentException ("Value '" + value.Value + "' does not match the type of the enum.");
|
||||
}
|
||||
|
||||
|
||||
@@ -322,6 +322,12 @@ public class Tests : TestsBase, ITest2
|
||||
new Tests ().attach ();
|
||||
return 0;
|
||||
}
|
||||
if (args.Length > 0 && args [0] == "step-out-void-async") {
|
||||
var wait = new ManualResetEvent (false);
|
||||
step_out_void_async (wait);
|
||||
wait.WaitOne ();//Don't exist until step_out_void_async is executed...
|
||||
return 0;
|
||||
}
|
||||
assembly_load ();
|
||||
breakpoints ();
|
||||
single_stepping ();
|
||||
@@ -1742,6 +1748,19 @@ public class Tests : TestsBase, ITest2
|
||||
{
|
||||
UninitializedClass.Call();//Breakpoint here and step in
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
static async void step_out_void_async (ManualResetEvent wait)
|
||||
{
|
||||
await Task.Yield ();
|
||||
step_out_void_async_2 ();
|
||||
wait.Set ();
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
static void step_out_void_async_2 ()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class SentinelClass : MarshalByRefObject {
|
||||
|
||||
@@ -10,6 +10,7 @@ using Diag = System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
@@ -3508,6 +3509,10 @@ public class DebuggerTests
|
||||
Assert.AreEqual ("domains", frames [2].Method.Name);
|
||||
Assert.AreEqual (vm.RootDomain, frames [2].Domain);
|
||||
|
||||
// Check enum creation in other domains
|
||||
var anenum = vm.CreateEnumMirror (d_method.DeclaringType.Assembly.GetType ("AnEnum"), vm.CreateValue (1));
|
||||
Assert.AreEqual (1, anenum.Value);
|
||||
|
||||
// Test breakpoints on already JITted methods in other domains
|
||||
m = entry_point.DeclaringType.GetMethod ("invoke_in_domain_2");
|
||||
Assert.IsNotNull (m);
|
||||
@@ -4286,6 +4291,26 @@ public class DebuggerTests
|
||||
e = step_out (); // leave threadpool_io
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("NotWorking")] // flaky, see https://github.com/mono/mono/issues/6997
|
||||
public void StepOutAsync () {
|
||||
vm.Detach ();
|
||||
Start (new string [] { "dtest-app.exe", "step-out-void-async" });
|
||||
var e = run_until ("step_out_void_async_2");
|
||||
create_step (e);
|
||||
var e2 = step_out ();
|
||||
assert_location (e2, "MoveNext");//we are in step_out_void_async
|
||||
step_req.Disable ();
|
||||
step_req.Depth = StepDepth.Out;
|
||||
step_req.Enable ();
|
||||
vm.Resume ();
|
||||
var e3 = GetNextEvent ();
|
||||
//after step-out from async void, execution should continue
|
||||
//and runtime should exit
|
||||
Assert.IsTrue (e3 is VMDeathEvent, e3.GetType().FullName);
|
||||
vm = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("NotWorking")]
|
||||
public void ShouldCorrectlyStepOverOnExitFromArgsAfterStepInMethodParameter() {
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
../../../external/corefx/src/Common/src/System/Net/Security/Unix/SafeDeleteContext.cs
|
||||
../../../external/corefx/src/Common/src/System/Net/Security/Unix/SafeFreeCredentials.cs
|
||||
../../../external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs
|
||||
../../../external/corefx/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.NetSecurityNative.cs
|
||||
corefx/Interop.NetSecurityNative.cs
|
||||
#../../../external/corefx/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.NetSecurityNative.cs
|
||||
../../../external/corefx/src/Common/src/System/Net/Security/Unix/SafeFreeNegoCredentials.cs
|
||||
../../../external/corefx/src/Common/src/Interop/Unix/Interop.Libraries.cs
|
||||
../../../external/corefx/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssBuffer.cs
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
// stubs for external/corefx/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.NetSecurityNative.cs
|
||||
// needed for https://github.com/mono/mono/issues/6766
|
||||
// or can be implemented via pal_gssapi (see https://github.com/mono/mono/pull/6806)
|
||||
static partial class Interop
|
||||
{
|
||||
static partial class NetSecurityNative
|
||||
{
|
||||
internal static void ReleaseGssBuffer (
|
||||
IntPtr bufferPtr,
|
||||
UInt64 length) => throw new NotSupportedException ();
|
||||
|
||||
internal static Status DisplayMinorStatus (
|
||||
out Status minorStatus,
|
||||
Status statusValue,
|
||||
ref GssBuffer buffer) => throw new NotSupportedException ();
|
||||
|
||||
internal static Status DisplayMajorStatus (
|
||||
out Status minorStatus,
|
||||
Status statusValue,
|
||||
ref GssBuffer buffer) => throw new NotSupportedException ();
|
||||
|
||||
internal static Status ImportUserName (
|
||||
out Status minorStatus,
|
||||
string inputName,
|
||||
int inputNameByteCount,
|
||||
out SafeGssNameHandle outputName) => throw new NotSupportedException ();
|
||||
|
||||
internal static Status ImportPrincipalName (
|
||||
out Status minorStatus,
|
||||
string inputName,
|
||||
int inputNameByteCount,
|
||||
out SafeGssNameHandle outputName) => throw new NotSupportedException ();
|
||||
|
||||
internal static Status ReleaseName (
|
||||
out Status minorStatus,
|
||||
ref IntPtr inputName) => throw new NotSupportedException ();
|
||||
|
||||
internal static Status InitiateCredSpNego (
|
||||
out Status minorStatus,
|
||||
SafeGssNameHandle desiredName,
|
||||
out SafeGssCredHandle outputCredHandle) => throw new NotSupportedException ();
|
||||
|
||||
internal static Status InitiateCredWithPassword (
|
||||
out Status minorStatus,
|
||||
bool isNtlm,
|
||||
SafeGssNameHandle desiredName,
|
||||
string password,
|
||||
int passwordLen,
|
||||
out SafeGssCredHandle outputCredHandle) => throw new NotSupportedException ();
|
||||
|
||||
internal static Status ReleaseCred (
|
||||
out Status minorStatus,
|
||||
ref IntPtr credHandle) => throw new NotSupportedException ();
|
||||
|
||||
internal static Status InitSecContext (
|
||||
out Status minorStatus,
|
||||
SafeGssCredHandle initiatorCredHandle,
|
||||
ref SafeGssContextHandle contextHandle,
|
||||
bool isNtlmOnly,
|
||||
SafeGssNameHandle targetName,
|
||||
uint reqFlags,
|
||||
byte[] inputBytes,
|
||||
int inputLength,
|
||||
ref GssBuffer token,
|
||||
out uint retFlags,
|
||||
out int isNtlmUsed) => throw new NotSupportedException ();
|
||||
|
||||
internal static Status AcceptSecContext (
|
||||
out Status minorStatus,
|
||||
ref SafeGssContextHandle acceptContextHandle,
|
||||
byte[] inputBytes,
|
||||
int inputLength,
|
||||
ref GssBuffer token) => throw new NotSupportedException ();
|
||||
|
||||
internal static Status DeleteSecContext (
|
||||
out Status minorStatus,
|
||||
ref IntPtr contextHandle) => throw new NotSupportedException ();
|
||||
|
||||
static Status Wrap(
|
||||
out Status minorStatus,
|
||||
SafeGssContextHandle contextHandle,
|
||||
bool isEncrypt,
|
||||
byte[] inputBytes,
|
||||
int offset,
|
||||
int count,
|
||||
ref GssBuffer outBuffer) => throw new NotSupportedException ();
|
||||
|
||||
static Status Unwrap (
|
||||
out Status minorStatus,
|
||||
SafeGssContextHandle contextHandle,
|
||||
byte[] inputBytes,
|
||||
int offset,
|
||||
int count,
|
||||
ref GssBuffer outBuffer) => throw new NotSupportedException ();
|
||||
|
||||
internal static Status WrapBuffer (
|
||||
out Status minorStatus,
|
||||
SafeGssContextHandle contextHandle,
|
||||
bool isEncrypt,
|
||||
byte[] inputBytes,
|
||||
int offset,
|
||||
int count,
|
||||
ref GssBuffer outBuffer) => throw new NotSupportedException ();
|
||||
|
||||
internal static Status UnwrapBuffer (
|
||||
out Status minorStatus,
|
||||
SafeGssContextHandle contextHandle,
|
||||
byte[] inputBytes,
|
||||
int offset,
|
||||
int count,
|
||||
ref GssBuffer outBuffer) => throw new NotSupportedException ();
|
||||
|
||||
internal enum Status : uint
|
||||
{
|
||||
GSS_S_COMPLETE = 0,
|
||||
GSS_S_CONTINUE_NEEDED = 1
|
||||
}
|
||||
|
||||
[Flags]
|
||||
internal enum GssFlags : uint
|
||||
{
|
||||
GSS_C_DELEG_FLAG = 0x1,
|
||||
GSS_C_MUTUAL_FLAG = 0x2,
|
||||
GSS_C_REPLAY_FLAG = 0x4,
|
||||
GSS_C_SEQUENCE_FLAG = 0x8,
|
||||
GSS_C_CONF_FLAG = 0x10,
|
||||
GSS_C_INTEG_FLAG = 0x20,
|
||||
GSS_C_ANON_FLAG = 0x40,
|
||||
GSS_C_PROT_READY_FLAG = 0x80,
|
||||
GSS_C_TRANS_FLAG = 0x100,
|
||||
GSS_C_DCE_STYLE = 0x1000,
|
||||
GSS_C_IDENTIFY_FLAG = 0x2000,
|
||||
GSS_C_EXTENDED_ERROR_FLAG = 0x4000,
|
||||
GSS_C_DELEG_POLICY_FLAG = 0x8000
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,12 @@ namespace System.Data.SqlClient
|
||||
"keyword and always reset the connection")]
|
||||
public bool ConnectionReset { get; set; }
|
||||
|
||||
[MonoTODO("Not implemented in corefx: https://github.com/dotnet/corefx/issues/22474")]
|
||||
public SqlAuthenticationMethod Authentication {
|
||||
get => throw new NotImplementedException();
|
||||
set => throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[MonoTODO("Not implemented in corefx: https://github.com/dotnet/corefx/issues/22474")]
|
||||
public bool ContextConnection {
|
||||
get => throw new NotImplementedException();
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace System.Web.UI.Design
|
||||
public HtmlControlDesigner () { throw new NotImplementedException (); }
|
||||
|
||||
[MonoTODO]
|
||||
protected override void Dispose (bool disposing) { throw new NotImplementedException (); }
|
||||
protected override void Dispose (bool disposing) { }
|
||||
|
||||
[MonoTODO]
|
||||
[Obsolete ("Use ControlDesigner.Tag instead")]
|
||||
|
||||
@@ -308,6 +308,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
|
||||
/* Checks bitmap features on a known 2bbp bitmap */
|
||||
[Test]
|
||||
[Category("NotWorking")]
|
||||
public void Bitmap2bitFeatures ()
|
||||
{
|
||||
if (IsArm64Process ())
|
||||
@@ -339,6 +340,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("NotWorking")]
|
||||
public void Bitmap2bitPixels ()
|
||||
{
|
||||
if (IsArm64Process ())
|
||||
@@ -374,6 +376,7 @@ namespace MonoTests.System.Drawing.Imaging {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("NotWorking")]
|
||||
public void Bitmap2bitData ()
|
||||
{
|
||||
if (IsArm64Process ())
|
||||
|
||||
@@ -5,7 +5,7 @@ include ../../build/rules.make
|
||||
LIBRARY = System.Dynamic.dll
|
||||
|
||||
LIB_REFS = System.Core System
|
||||
KEYFILE = ../ecma.pub
|
||||
KEYFILE = ../msfinal.pub
|
||||
LIB_MCS_FLAGS = -unsafe -d:CODEPLEX_40 -nowarn:414,169
|
||||
|
||||
# This is a .NET 4.0+ only assembly
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace System.Net.Http
|
||||
|
||||
public WindowsProxyUsePolicy WindowsProxyUsePolicy { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
|
||||
|
||||
protected override void Dispose (bool disposing) { throw new PlatformNotSupportedException (); }
|
||||
protected override void Dispose (bool disposing) { }
|
||||
|
||||
protected override Task<HttpResponseMessage> SendAsync (HttpRequestMessage request, Threading.CancellationToken cancellationToken) { throw new PlatformNotSupportedException (); }
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ namespace MonoTests.System.Net.Http
|
||||
httpClient.PostAsync (restRequest.RequestUri, restRequest.Content).Wait (WaitTimeout);
|
||||
Assert.Fail ("#1");
|
||||
} catch (AggregateException e) {
|
||||
Assert.IsTrue (e.InnerException is TaskCanceledException, "#2");
|
||||
Assert.That (e.InnerException, Is.InstanceOf<TaskCanceledException> (), "#2");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -680,16 +680,15 @@ namespace MonoTests.System.Net.Http
|
||||
#endif
|
||||
public void Send_Complete_CustomHeaders_Host ()
|
||||
{
|
||||
bool? failed = null;
|
||||
Exception error = null;
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
var listener = CreateListener (l => {
|
||||
var request = l.Request;
|
||||
|
||||
try {
|
||||
Assert.AreEqual ("customhost", request.Headers["Host"], "#1");
|
||||
failed = false;
|
||||
} catch {
|
||||
failed = true;
|
||||
} catch (Exception ex) {
|
||||
error = ex;
|
||||
}
|
||||
}, port);
|
||||
|
||||
@@ -704,7 +703,7 @@ namespace MonoTests.System.Net.Http
|
||||
|
||||
Assert.AreEqual ("", response.Content.ReadAsStringAsync ().Result, "#100");
|
||||
Assert.AreEqual (HttpStatusCode.OK, response.StatusCode, "#101");
|
||||
Assert.AreEqual (false, failed, "#102");
|
||||
Assert.IsNull (error, "#102");
|
||||
} finally {
|
||||
listener.Abort ();
|
||||
listener.Close ();
|
||||
@@ -1440,10 +1439,29 @@ namespace MonoTests.System.Net.Http
|
||||
ch.AllowAutoRedirect = false;
|
||||
}
|
||||
|
||||
#if !FEATURE_NO_BSD_SOCKETS
|
||||
[Test]
|
||||
// https://github.com/mono/mono/issues/7355
|
||||
public void WildcardConnect ()
|
||||
{
|
||||
try {
|
||||
using (var client = new HttpClient ()) {
|
||||
client.GetAsync ("http://255.255.255.255").Wait (WaitTimeout);
|
||||
}
|
||||
} catch (AggregateException e) {
|
||||
Assert.That (e.InnerException, Is.InstanceOf<HttpRequestException> (), "#1");
|
||||
var rex = (HttpRequestException)e.InnerException;
|
||||
Assert.That (rex.InnerException, Is.InstanceOf<WebException> (), "#2");
|
||||
var wex = (WebException)rex.InnerException;
|
||||
Assert.That (wex.Status, Is.EqualTo (WebExceptionStatus.ConnectFailure), "#3");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
HttpListener CreateListener (Action<HttpListenerContext> contextAssert, int port)
|
||||
{
|
||||
var l = new HttpListener ();
|
||||
l.Prefixes.Add (string.Format ("http://+:{0}/", port));
|
||||
l.Prefixes.Add (string.Format ("http://*:{0}/", port));
|
||||
l.Start ();
|
||||
AddListenerContext(l, contextAssert);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ include ../../build/rules.make
|
||||
LIBRARY = System.Numerics.dll
|
||||
LIB_REFS = System
|
||||
KEYFILE = ../ecma.pub
|
||||
LIB_MCS_FLAGS = /unsafe
|
||||
LIB_MCS_FLAGS = /unsafe -nowarn:436
|
||||
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
|
||||
XTEST_LIB_REFS = System Facades/System.Threading.Tasks Facades/System.Runtime.InteropServices.RuntimeInformation System.Core System.Numerics.Vectors Microsoft.CSharp
|
||||
XTEST_LIB_FLAGS = -unsafe
|
||||
|
||||
@@ -4,7 +4,7 @@ include ../../build/rules.make
|
||||
|
||||
LIBRARY = System.Reflection.Context.dll
|
||||
LIB_REFS = System
|
||||
KEYFILE = ../msfinal.pub
|
||||
KEYFILE = ../ecma.pub
|
||||
LIB_MCS_FLAGS =
|
||||
|
||||
NO_TEST = yes
|
||||
|
||||
@@ -88,6 +88,8 @@
|
||||
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlSerializableWriter.cs
|
||||
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlWriterDelegator.cs
|
||||
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XPathQueryGenerator.cs
|
||||
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaHelper.cs
|
||||
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaExporter.cs
|
||||
../referencesource/System.Runtime.Serialization/System/Text/Base64Encoding.cs
|
||||
../referencesource/System.Runtime.Serialization/System/Text/BinHexEncoding.cs
|
||||
../referencesource/System.Runtime.Serialization/System/Text/SurrogateChar.cs
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
|
||||
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ExportOptions.cs
|
||||
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ImportOptions.cs
|
||||
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaExporter.cs
|
||||
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaHelper.cs
|
||||
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaImporter.cs
|
||||
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XsdDataContractExporter.cs
|
||||
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XsdDataContractImporter.cs
|
||||
|
||||
@@ -2,7 +2,7 @@ using System.Diagnostics;
|
||||
|
||||
namespace System.Runtime.Serialization {
|
||||
|
||||
internal static class DiagnosticUtility {
|
||||
internal static partial class DiagnosticUtility {
|
||||
internal static bool ShouldTraceError = true;
|
||||
internal static readonly bool ShouldTraceWarning = false;
|
||||
internal static readonly bool ShouldTraceInformation = false;
|
||||
|
||||
@@ -308,5 +308,19 @@ public const string XmlMaxStringContentLengthExceeded = @"XML max string content
|
||||
public const string XmlObjectAssignedToIncompatibleInterface = @"Object of type '{0}' is assigned to an incompatible interface '{1}'.";
|
||||
|
||||
#endregion
|
||||
|
||||
// CoreFX
|
||||
public const string PlatformNotSupported_SchemaImporter = "The implementation of the function requires System.Runtime.Serialization.SchemaImporter which is not supported on this platform.";
|
||||
public const string PlatformNotSupported_IDataContractSurrogate = "The implementation of the function requires System.Runtime.Serialization.IDataContractSurrogate which is not supported on this platform.";
|
||||
|
||||
internal static string Format(string resourceFormats)
|
||||
{
|
||||
return resourceFormats;
|
||||
}
|
||||
|
||||
internal static string Format(string resourceFormat, object p1)
|
||||
{
|
||||
return string.Format (CultureInfo.InvariantCulture, resourceFormat, p1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,227 +0,0 @@
|
||||
|
||||
namespace System.Runtime.Serialization
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Diagnostics;
|
||||
using System.Security;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Xml.Serialization;
|
||||
using System.Runtime.Serialization.Diagnostics;
|
||||
|
||||
class SchemaExporter
|
||||
{
|
||||
internal static void GetXmlTypeInfo(Type type, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
|
||||
{
|
||||
if (IsSpecialXmlType(type, out stableName, out xsdType, out hasRoot))
|
||||
return;
|
||||
XmlSchemaSet schemas = new XmlSchemaSet();
|
||||
schemas.XmlResolver = null;
|
||||
InvokeSchemaProviderMethod(type, schemas, out stableName, out xsdType, out hasRoot);
|
||||
if (stableName.Name == null || stableName.Name.Length == 0)
|
||||
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.InvalidXmlDataContractName, DataContract.GetClrTypeFullName(type))));
|
||||
}
|
||||
|
||||
internal static bool IsSpecialXmlType(Type type, out XmlQualifiedName typeName, out XmlSchemaType xsdType, out bool hasRoot)
|
||||
{
|
||||
xsdType = null;
|
||||
hasRoot = true;
|
||||
if (type == Globals.TypeOfXmlElement || type == Globals.TypeOfXmlNodeArray)
|
||||
{
|
||||
string name = null;
|
||||
if (type == Globals.TypeOfXmlElement)
|
||||
{
|
||||
xsdType = CreateAnyElementType();
|
||||
name = "XmlElement";
|
||||
hasRoot = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
xsdType = CreateAnyType();
|
||||
name = "ArrayOfXmlNode";
|
||||
hasRoot = true;
|
||||
}
|
||||
typeName = new XmlQualifiedName(name, DataContract.GetDefaultStableNamespace(type));
|
||||
return true;
|
||||
}
|
||||
typeName = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static void AddDefaultXmlType(XmlSchemaSet schemas, string localName, string ns)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
static bool InvokeSchemaProviderMethod(Type clrType, XmlSchemaSet schemas, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
|
||||
{
|
||||
xsdType = null;
|
||||
hasRoot = true;
|
||||
object[] attrs = clrType.GetCustomAttributes(Globals.TypeOfXmlSchemaProviderAttribute, false);
|
||||
if (attrs == null || attrs.Length == 0)
|
||||
{
|
||||
stableName = DataContract.GetDefaultStableName(clrType);
|
||||
return false;
|
||||
}
|
||||
|
||||
XmlSchemaProviderAttribute provider = (XmlSchemaProviderAttribute)attrs[0];
|
||||
if (provider.IsAny)
|
||||
{
|
||||
xsdType = CreateAnyElementType();
|
||||
hasRoot = false;
|
||||
}
|
||||
string methodName = provider.MethodName;
|
||||
if (methodName == null || methodName.Length == 0)
|
||||
{
|
||||
if (!provider.IsAny)
|
||||
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.InvalidGetSchemaMethod, DataContract.GetClrTypeFullName(clrType))));
|
||||
stableName = DataContract.GetDefaultStableName(clrType);
|
||||
}
|
||||
else
|
||||
{
|
||||
MethodInfo getMethod = clrType.GetMethod(methodName, /*BindingFlags.DeclaredOnly |*/ BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public, null, new Type[] { typeof(XmlSchemaSet) }, null);
|
||||
if (getMethod == null)
|
||||
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.MissingGetSchemaMethod, DataContract.GetClrTypeFullName(clrType), methodName)));
|
||||
|
||||
if (!(Globals.TypeOfXmlQualifiedName.IsAssignableFrom(getMethod.ReturnType)) && !(Globals.TypeOfXmlSchemaType.IsAssignableFrom(getMethod.ReturnType)))
|
||||
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.InvalidReturnTypeOnGetSchemaMethod, DataContract.GetClrTypeFullName(clrType), methodName, DataContract.GetClrTypeFullName(getMethod.ReturnType), DataContract.GetClrTypeFullName(Globals.TypeOfXmlQualifiedName), typeof(XmlSchemaType))));
|
||||
|
||||
object typeInfo = getMethod.Invoke(null, new object[] { schemas });
|
||||
|
||||
if (provider.IsAny)
|
||||
{
|
||||
if (typeInfo != null)
|
||||
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.InvalidNonNullReturnValueByIsAny, DataContract.GetClrTypeFullName(clrType), methodName)));
|
||||
stableName = DataContract.GetDefaultStableName(clrType);
|
||||
}
|
||||
else if (typeInfo == null)
|
||||
{
|
||||
xsdType = CreateAnyElementType();
|
||||
hasRoot = false;
|
||||
stableName = DataContract.GetDefaultStableName(clrType);
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlSchemaType providerXsdType = typeInfo as XmlSchemaType;
|
||||
if (providerXsdType != null)
|
||||
{
|
||||
string typeName = providerXsdType.Name;
|
||||
string typeNs = null;
|
||||
if (typeName == null || typeName.Length == 0)
|
||||
{
|
||||
DataContract.GetDefaultStableName(DataContract.GetClrTypeFullName(clrType), out typeName, out typeNs);
|
||||
stableName = new XmlQualifiedName(typeName, typeNs);
|
||||
providerXsdType.Annotation = GetSchemaAnnotation(ExportActualType(stableName, new XmlDocument()));
|
||||
xsdType = providerXsdType;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (XmlSchema schema in schemas.Schemas())
|
||||
{
|
||||
foreach (XmlSchemaObject schemaItem in schema.Items)
|
||||
{
|
||||
if ((object)schemaItem == (object)providerXsdType)
|
||||
{
|
||||
typeNs = schema.TargetNamespace;
|
||||
if (typeNs == null)
|
||||
typeNs = String.Empty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (typeNs != null)
|
||||
break;
|
||||
}
|
||||
if (typeNs == null)
|
||||
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.MissingSchemaType, typeName, DataContract.GetClrTypeFullName(clrType))));
|
||||
stableName = new XmlQualifiedName(typeName, typeNs);
|
||||
}
|
||||
}
|
||||
else
|
||||
stableName = (XmlQualifiedName)typeInfo;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static XmlSchemaComplexType CreateAnyElementType()
|
||||
{
|
||||
XmlSchemaComplexType anyElementType = new XmlSchemaComplexType();
|
||||
anyElementType.IsMixed = false;
|
||||
anyElementType.Particle = new XmlSchemaSequence();
|
||||
XmlSchemaAny any = new XmlSchemaAny();
|
||||
any.MinOccurs = 0;
|
||||
any.ProcessContents = XmlSchemaContentProcessing.Lax;
|
||||
((XmlSchemaSequence)anyElementType.Particle).Items.Add(any);
|
||||
return anyElementType;
|
||||
}
|
||||
|
||||
static XmlSchemaAnnotation GetSchemaAnnotation(params XmlNode[] nodes)
|
||||
{
|
||||
if (nodes == null || nodes.Length == 0)
|
||||
return null;
|
||||
bool hasAnnotation = false;
|
||||
for (int i = 0; i < nodes.Length; i++)
|
||||
if (nodes[i] != null)
|
||||
{
|
||||
hasAnnotation = true;
|
||||
break;
|
||||
}
|
||||
if (!hasAnnotation)
|
||||
return null;
|
||||
|
||||
XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
|
||||
XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo();
|
||||
annotation.Items.Add(appInfo);
|
||||
appInfo.Markup = nodes;
|
||||
return annotation;
|
||||
}
|
||||
|
||||
static XmlSchemaComplexType CreateAnyType()
|
||||
{
|
||||
XmlSchemaComplexType anyType = new XmlSchemaComplexType();
|
||||
anyType.IsMixed = true;
|
||||
anyType.Particle = new XmlSchemaSequence();
|
||||
XmlSchemaAny any = new XmlSchemaAny();
|
||||
any.MinOccurs = 0;
|
||||
any.MaxOccurs = Decimal.MaxValue;
|
||||
any.ProcessContents = XmlSchemaContentProcessing.Lax;
|
||||
((XmlSchemaSequence)anyType.Particle).Items.Add(any);
|
||||
anyType.AnyAttribute = new XmlSchemaAnyAttribute();
|
||||
return anyType;
|
||||
}
|
||||
|
||||
static XmlElement ExportActualType(XmlQualifiedName typeName, XmlDocument xmlDoc)
|
||||
{
|
||||
XmlElement actualTypeElement = xmlDoc.CreateElement(ActualTypeAnnotationName.Name, ActualTypeAnnotationName.Namespace);
|
||||
|
||||
XmlAttribute nameAttribute = xmlDoc.CreateAttribute(Globals.ActualTypeNameAttribute);
|
||||
nameAttribute.Value = typeName.Name;
|
||||
actualTypeElement.Attributes.Append(nameAttribute);
|
||||
|
||||
XmlAttribute nsAttribute = xmlDoc.CreateAttribute(Globals.ActualTypeNamespaceAttribute);
|
||||
nsAttribute.Value = typeName.Namespace;
|
||||
actualTypeElement.Attributes.Append(nsAttribute);
|
||||
|
||||
return actualTypeElement;
|
||||
}
|
||||
|
||||
static XmlQualifiedName actualTypeAnnotationName;
|
||||
internal static XmlQualifiedName ActualTypeAnnotationName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (actualTypeAnnotationName == null)
|
||||
actualTypeAnnotationName = new XmlQualifiedName(Globals.ActualTypeLocalName, Globals.SerializationNamespace);
|
||||
return actualTypeAnnotationName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
//
|
||||
// XsdDataContractExporter_mobile.cs
|
||||
//
|
||||
// Authors:
|
||||
// Alexander Köplinger <[email protected]>
|
||||
//
|
||||
// Copyright (C) 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
|
||||
namespace System.Runtime.Serialization
|
||||
{
|
||||
public class XsdDataContractExporter
|
||||
{
|
||||
public XsdDataContractExporter () { throw new NotImplementedException (); }
|
||||
public XsdDataContractExporter (XmlSchemaSet schemas) { throw new NotImplementedException (); }
|
||||
public ExportOptions Options { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } }
|
||||
public XmlSchemaSet Schemas { get { throw new NotImplementedException (); } }
|
||||
public bool CanExport (ICollection<Assembly> assemblies) { throw new NotImplementedException ();}
|
||||
public bool CanExport (ICollection<Type> types) { throw new NotImplementedException (); }
|
||||
public bool CanExport (Type type) { throw new NotImplementedException (); }
|
||||
public void Export (ICollection<Assembly> assemblies) { throw new NotImplementedException (); }
|
||||
public void Export (ICollection<Type> types) { throw new NotImplementedException (); }
|
||||
public void Export (Type type) { throw new NotImplementedException (); }
|
||||
public XmlQualifiedName GetRootElementName (Type type) { throw new NotImplementedException (); }
|
||||
public XmlSchemaType GetSchemaType (Type type) { throw new NotImplementedException (); }
|
||||
public XmlQualifiedName GetSchemaTypeName (Type type) { throw new NotImplementedException (); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace System.Runtime.Serialization
|
||||
{
|
||||
partial class DiagnosticUtility
|
||||
{
|
||||
internal static bool IsFatal(Exception exception)
|
||||
{
|
||||
while (exception != null)
|
||||
{
|
||||
// These exceptions aren't themselves fatal, but since the CLR uses them to wrap other exceptions,
|
||||
// we want to check to see whether they've been used to wrap a fatal exception. If so, then they
|
||||
// count as fatal.
|
||||
if (exception is TypeInitializationException)
|
||||
{
|
||||
exception = exception.InnerException;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -1,6 +1,8 @@
|
||||
#include System.Runtime.Serialization.dll.sources
|
||||
#include ReferenceSource.common.sources
|
||||
|
||||
ReferenceSources/SchemaExporter_mobile.cs
|
||||
ReferenceSources/XsdDataContractExporter_mobile.cs
|
||||
ReferenceSources/SimplifiedCodeTypeReference.cs
|
||||
|
||||
corefx/DiagnosticUtility.cs
|
||||
|
||||
../../../external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XsdDataContractExporter.cs
|
||||
@@ -46,7 +46,7 @@ namespace System.Security.Cryptography.Pkcs {
|
||||
// only accessible from SignedPkcs7.SignerInfos
|
||||
internal SignerInfo (string hashName, X509Certificate2 certificate, SubjectIdentifierType type, object o, int version)
|
||||
{
|
||||
_digest = new Oid (CryptoConfig.MapNameToOID (hashName));
|
||||
_digest = new Oid (CryptoConfig.MapNameToOID (hashName) ?? hashName);
|
||||
_certificate = certificate;
|
||||
_counter = new SignerInfoCollection ();
|
||||
_signed = new CryptographicAttributeObjectCollection ();
|
||||
|
||||
@@ -100,6 +100,26 @@ namespace MonoTests.System.Security.Cryptography.Pkcs {
|
||||
Assert.AreEqual (0, si.UnsignedAttributes.Count, "UnsignedAttributes");
|
||||
Assert.AreEqual (3, si.Version, "Version");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ExplicitCryptographicObjectIdentifier ()
|
||||
{
|
||||
var data = new byte [] {
|
||||
48, 130, 36, 126, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 2, 160, 130, 36, 111, 48, 130, 36, 107, 2, 1, 3, 49, 15, 48, 13, 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, 1, 5, 0, 48, 100, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 1, 160, 87, 4, 85, 86, 101, 114, 115, 105, 111, 110, 58, 49, 10, 10, 50, 46, 49, 54, 46, 56, 52, 48, 46, 49, 46, 49, 48, 49, 46, 51, 46, 52, 46, 50, 46, 49, 45, 72, 97, 115, 104, 58, 109, 117, 115, 49, 107, 97, 84, 89, 76, 113, 111, 81, 110, 85, 105, 104, 103, 104, 109, 102, 48, 120, 110, 104, 43, 69, 111, 65, 85, 73, 119, 104, 122, 50, 82, 117, 57, 52, 109, 69, 54, 117, 73, 61, 10, 10, 160, 130, 14, 42, 48, 130, 3, 183, 48, 130, 2, 159, 160, 3, 2, 1, 2, 2, 16, 12, 231, 224, 229, 23, 216, 70, 254, 143, 229, 96, 252, 27, 240, 48, 57, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 5, 5, 0, 48, 101, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 85, 83, 49, 21, 48, 19, 6, 3, 85, 4, 10, 19, 12, 68, 105, 103, 105, 67, 101, 114, 116, 32, 73, 110, 99, 49, 25, 48, 23, 6, 3, 85, 4, 11, 19, 16, 119, 119, 119, 46, 100, 105, 103, 105, 99, 101, 114, 116, 46, 99, 111, 109, 49, 36, 48, 34, 6, 3, 85, 4, 3, 19, 27, 68, 105, 103, 105, 67, 101, 114, 116, 32, 65, 115, 115, 117, 114, 101, 100, 32, 73, 68, 32, 82, 111, 111, 116, 32, 67, 65, 48, 30, 23, 13, 48, 54, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 90, 23, 13, 51, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 90, 48, 101, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 85, 83, 49, 21, 48, 19, 6, 3, 85, 4, 10, 19, 12, 68, 105, 103, 105, 67, 101, 114, 116, 32, 73, 110, 99, 49, 25, 48, 23, 6, 3, 85, 4, 11, 19, 16, 119, 119, 119, 46, 100, 105, 103, 105, 99, 101, 114, 116, 46, 99, 111, 109, 49, 36, 48, 34, 6, 3, 85, 4, 3, 19, 27, 68, 105, 103, 105, 67, 101, 114, 116, 32, 65, 115, 115, 117, 114, 101, 100, 32, 73, 68, 32, 82, 111, 111, 116, 32, 67, 65, 48, 130, 1, 34, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 130, 1, 15, 0, 48, 130, 1, 10, 2, 130, 1, 1, 0, 173, 14, 21, 206, 228, 67, 128, 92, 177, 135, 243, 183, 96, 249, 113, 18, 165, 174, 220, 38, 148, 136, 170, 244, 206, 245, 32, 57, 40, 88, 96, 12, 248, 128, 218, 169, 21, 149, 50, 97, 60, 181, 177, 40, 132, 138, 138, 220, 159, 10, 12, 131, 23, 122, 143, 144, 172, 138, 231, 121, 83, 92, 49, 132, 42, 246, 15, 152, 50, 54, 118, 204, 222, 221, 60, 168, 162, 239, 106, 251, 33, 242, 82, 97, 223, 159, 32, 215, 31, 226, 177, 217, 254, 24, 100, 210, 18, 91, 95, 249, 88, 24, 53, 188, 71, 205, 161, 54, 249, 107, 127, 212, 176, 56, 62, 193, 27, 195, 140, 51, 217, 216, 47, 24, 254, 40, 15, 179, 167, 131, 214, 195, 110, 68, 192, 97, 53, 150, 22, 254, 89, 156, 139, 118, 109, 215, 241, 162, 75, 13, 43, 255, 11, 114, 218, 158, 96, 208, 142, 144, 53, 198, 120, 85, 135, 32, 161, 207, 229, 109, 10, 200, 73, 124, 49, 152, 51, 108, 34, 233, 135, 208, 50, 90, 162, 186, 19, 130, 17, 237, 57, 23, 157, 153, 58, 114, 161, 230, 250, 164, 217, 213, 23, 49, 117, 174, 133, 125, 34, 174, 63, 1, 70, 134, 246, 40, 121, 200, 177, 218, 228, 87, 23, 196, 126, 28, 14, 176, 180, 146, 166, 86, 179, 189, 178, 151, 237, 170, 167, 240, 183, 197, 168, 63, 149, 22, 208, 255, 161, 150, 235, 8, 95, 24, 119, 79, 2, 3, 1, 0, 1, 163, 99, 48, 97, 48, 14, 6, 3, 85, 29, 15, 1, 1, 255, 4, 4, 3, 2, 1, 134, 48, 15, 6, 3, 85, 29, 19, 1, 1, 255, 4, 5, 48, 3, 1, 1, 255, 48, 29, 6, 3, 85, 29, 14, 4, 22, 4, 20, 69, 235, 162, 175, 244, 146, 203, 130, 49, 45, 81, 139, 167, 167, 33, 157, 243, 109, 200, 15, 48, 31, 6, 3, 85, 29, 35, 4, 24, 48, 22, 128, 20, 69, 235, 162, 175, 244, 146, 203, 130, 49, 45, 81, 139, 167, 167, 33, 157, 243, 109, 200, 15, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 5, 5, 0, 3, 130, 1, 1, 0, 162, 14, 188, 223, 226, 237, 240, 227, 114, 115, 122, 100, 148, 191, 247, 114, 102, 216, 50, 228, 66, 117, 98, 174, 135, 235, 242, 213, 217, 222, 86, 179, 159, 204, 206, 20, 40, 185, 13, 151, 96, 92, 18, 76, 88, 228, 211, 61, 131, 73, 69, 88, 151, 53, 105, 26, 168, 71, 234, 86, 198, 121, 171, 18, 216, 103, 129, 132, 223, 127, 9, 60, 148, 230, 184, 38, 44, 32, 189, 61, 179, 40, 137, 247, 95, 255, 34, 226, 151, 132, 31, 233, 101, 239, 135, 224, 223, 193, 103, 73, 179, 93, 235, 178, 9, 42, 235, 38, 237, 120, 190, 125, 63, 43, 243, 183, 38, 53, 109, 95, 137, 1, 182, 73, 91, 159, 1, 5, 155, 171, 61, 37, 193, 204, 182, 127, 194, 241, 111, 134, 198, 250, 100, 104, 235, 129, 45, 148, 235, 66, 183, 250, 140, 30, 221, 98, 241, 190, 80, 103, 183, 108, 189, 243, 241, 31, 107, 12, 54, 7, 22, 127, 55, 124, 169, 91, 109, 122, 241, 18, 70, 96, 131, 215, 39, 4, 190, 75, 206, 151, 190, 195, 103, 42, 104, 17, 223, 128, 231, 12, 51, 102, 191, 19, 13, 20, 110, 243, 127, 31, 99, 16, 30, 250, 141, 27, 37, 109, 108, 143, 165, 183, 97, 1, 177, 210, 163, 38, 161, 16, 113, 157, 173, 226, 195, 249, 195, 153, 81, 183, 43, 7, 8, 206, 46, 230, 80, 178, 167, 250, 10, 69, 47, 162, 240, 242, 48, 130, 5, 48, 48, 130, 4, 24, 160, 3, 2, 1, 2, 2, 16, 4, 9, 24, 27, 95, 213, 187, 102, 117, 83, 67, 181, 111, 149, 80, 8, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, 48, 101, 49, 11, 48, 9, 6, 3,Line truncated
|
||||
};
|
||||
|
||||
SignerInfo si = GetSignerInfo (data);
|
||||
// default properties
|
||||
Assert.AreEqual (0, si.SignedAttributes.Count, "SignedAttributes");
|
||||
Assert.IsNotNull (si.Certificate, "Certificate");
|
||||
Assert.AreEqual (0, si.CounterSignerInfos.Count, "CounterSignerInfos");
|
||||
Assert.AreEqual ("sha256", si.DigestAlgorithm.FriendlyName, "DigestAlgorithm.FriendlyName");
|
||||
Assert.AreEqual ("2.16.840.1.101.3.4.2.1", si.DigestAlgorithm.Value, "DigestAlgorithm.Value");
|
||||
Assert.AreEqual (SubjectIdentifierType.SubjectKeyIdentifier, si.SignerIdentifier.Type, "SignerIdentifier.Type");
|
||||
Assert.AreEqual ("F1CC7184EBDA537140C1A57416017810DF133020", (string)si.SignerIdentifier.Value, "SignerIdentifier.Value");
|
||||
Assert.AreEqual (0, si.UnsignedAttributes.Count, "UnsignedAttributes");
|
||||
Assert.AreEqual (3, si.Version, "Version");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace System.Xml
|
||||
{
|
||||
static class BinaryCompatibility
|
||||
{
|
||||
public static bool TargetsAtLeast_Desktop_V4_5_2 => true;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ Assembly/AssemblyInfo.cs
|
||||
ReferenceSources/Res.cs
|
||||
ReferenceSources/LocalAppContextSwitches.cs
|
||||
ReferenceSources/ThisAssembly.cs
|
||||
ReferenceSources/BinaryCompatibility.cs
|
||||
../referencesource/System.Data.SqlXml/System/Xml/Xsl/IlGen/GenerateHelper.cs
|
||||
../referencesource/System.Data.SqlXml/System/Xml/Xsl/IlGen/IteratorDescriptor.cs
|
||||
../referencesource/System.Data.SqlXml/System/Xml/Xsl/IlGen/OptimizerPatterns.cs
|
||||
@@ -237,7 +238,6 @@ ReferenceSources/ThisAssembly.cs
|
||||
../referencesource/System.Xml/System/Xml/Cache/XPathNodeInfoAtom.cs
|
||||
../referencesource/System.Xml/System/Xml/Cache/XPathNodeView.cs
|
||||
../referencesource/System.Xml/System/Xml/Cache/XPathNodeViewPropertyDescriptor.cs
|
||||
../referencesource/System.Xml/System/Xml/Core/BinaryCompatibility.cs
|
||||
../referencesource/System.Xml/System/Xml/Core/CharEntityEncoderFallback.cs
|
||||
../referencesource/System.Xml/System/Xml/Core/ConformanceLevel.cs
|
||||
../referencesource/System.Xml/System/Xml/Core/DtdProcessing.cs
|
||||
|
||||
@@ -9,6 +9,7 @@ ReferenceSources/ThisAssembly.cs
|
||||
ReferenceSources/TypeScope.cs
|
||||
ReferenceSources/Wsdl.cs
|
||||
ReferenceSources/CodeDom.cs
|
||||
ReferenceSources/BinaryCompatibility.cs
|
||||
../referencesource/System.Data.SqlXml/System/Xml/Xsl/ISourceLineInfo.cs
|
||||
../referencesource/System.Data.SqlXml/System/Xml/Xsl/ListBase.cs
|
||||
../referencesource/System.Data.SqlXml/System/Xml/Xsl/Pair.cs
|
||||
@@ -138,7 +139,6 @@ ReferenceSources/CodeDom.cs
|
||||
../referencesource/System.Xml/System/Xml/Cache/XPathNodeInfoAtom.cs
|
||||
../referencesource/System.Xml/System/Xml/Cache/XPathNodeView.cs
|
||||
../referencesource/System.Xml/System/Xml/Cache/XPathNodeViewPropertyDescriptor.cs
|
||||
../referencesource/System.Xml/System/Xml/Core/BinaryCompatibility.cs
|
||||
../referencesource/System.Xml/System/Xml/Core/CharEntityEncoderFallback.cs
|
||||
../referencesource/System.Xml/System/Xml/Core/ConformanceLevel.cs
|
||||
../referencesource/System.Xml/System/Xml/Core/DtdProcessing.cs
|
||||
|
||||
@@ -15,7 +15,6 @@ using NUnit.Framework;
|
||||
using System;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using Network = System.Net;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Schema;
|
||||
using System.Collections.Generic;
|
||||
@@ -94,7 +93,7 @@ namespace MonoTests.System.Xml.Schema
|
||||
{
|
||||
// Create a resolver with default credentials.
|
||||
XmlUrlResolver resolver = new XmlUrlResolver ();
|
||||
resolver.Credentials = Network.CredentialCache.DefaultCredentials;
|
||||
resolver.Credentials = global::System.Net.CredentialCache.DefaultCredentials;
|
||||
// Set the reader settings object to use the resolver.
|
||||
XmlReaderSettings settings = new XmlReaderSettings ();
|
||||
settings.XmlResolver = resolver;
|
||||
|
||||
@@ -20,7 +20,8 @@ RESX_RESOURCE_STRING = \
|
||||
../../../external/corefx/src/System.Buffers/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Private.Uri/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.IO.Ports/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Net.HttpListener/src/Resources/Strings.resx
|
||||
../../../external/corefx/src/System.Net.HttpListener/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Net.Requests/src/Resources/Strings.resx
|
||||
|
||||
TEST_RESOURCES = \
|
||||
Test/System/test-uri-props.txt \
|
||||
|
||||
@@ -226,45 +226,79 @@ namespace Mono.Net.Security
|
||||
providerRegistration = new Dictionary<string,Tuple<Guid,string>> ();
|
||||
providerCache = new Dictionary<Guid,MSI.MonoTlsProvider> ();
|
||||
|
||||
var appleTlsEntry = new Tuple<Guid,String> (AppleTlsId, "Mono.AppleTls.AppleTlsProvider");
|
||||
|
||||
#if ONLY_APPLETLS || MONOTOUCH || XAMMAC
|
||||
providerRegistration.Add ("default", appleTlsEntry);
|
||||
providerRegistration.Add ("apple", appleTlsEntry);
|
||||
#else
|
||||
var legacyEntry = new Tuple<Guid,String> (LegacyId, "Mono.Net.Security.LegacyTlsProvider");
|
||||
providerRegistration.Add ("legacy", legacyEntry);
|
||||
|
||||
Tuple<Guid,String> btlsEntry = null;
|
||||
#if MONO_FEATURE_BTLS
|
||||
if (IsBtlsSupported ()) {
|
||||
btlsEntry = new Tuple<Guid,String> (BtlsId, "Mono.Btls.MonoBtlsProvider");
|
||||
providerRegistration.Add ("btls", btlsEntry);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Platform.IsMacOS)
|
||||
providerRegistration.Add ("default", appleTlsEntry);
|
||||
else if (btlsEntry != null)
|
||||
providerRegistration.Add ("default", btlsEntry);
|
||||
else
|
||||
providerRegistration.Add ("default", legacyEntry);
|
||||
|
||||
providerRegistration.Add ("apple", appleTlsEntry);
|
||||
#endif
|
||||
PopulateProviders ();
|
||||
}
|
||||
}
|
||||
|
||||
#region Platform-Specific code
|
||||
#if ONLY_APPLETLS || MONOTOUCH || XAMMAC
|
||||
// TODO: Should be redundant
|
||||
static void PopulateProviders ()
|
||||
{
|
||||
var appleTlsEntry = new Tuple<Guid,String> (AppleTlsId, typeof (Mono.AppleTls.AppleTlsProvider).FullName);
|
||||
|
||||
providerRegistration.Add ("default", appleTlsEntry);
|
||||
providerRegistration.Add ("apple", appleTlsEntry);
|
||||
}
|
||||
#elif MONODROID
|
||||
// TODO: Should be redundant
|
||||
static void PopulateProviders ()
|
||||
{
|
||||
var legacyEntry = new Tuple<Guid,String> (LegacyId, typeof (Mono.Net.Security.LegacyTlsProvider).FullName);
|
||||
|
||||
providerRegistration.Add ("legacy", legacyEntry);
|
||||
|
||||
#if MONO_FEATURE_BTLS
|
||||
var btlsEntry = new Tuple<Guid,String> (BtlsId, typeof (Mono.Btls.MonoBtlsProvider).FullName);
|
||||
if (btlsEntry != null)
|
||||
providerRegistration.Add ("default", btlsEntry);
|
||||
else
|
||||
#endif
|
||||
providerRegistration.Add ("default", legacyEntry);
|
||||
}
|
||||
#else
|
||||
static void PopulateProviders ()
|
||||
{
|
||||
#if MONO_FEATURE_APPLETLS
|
||||
var appleTlsEntry = new Tuple<Guid,String> (AppleTlsId, typeof (Mono.AppleTls.AppleTlsProvider).FullName);
|
||||
#endif
|
||||
var legacyEntry = new Tuple<Guid,String> (LegacyId, typeof (Mono.Net.Security.LegacyTlsProvider).FullName);
|
||||
providerRegistration.Add ("legacy", legacyEntry);
|
||||
|
||||
Tuple<Guid,String> btlsEntry = null;
|
||||
#if MONO_FEATURE_BTLS
|
||||
if (IsBtlsSupported ()) {
|
||||
btlsEntry = new Tuple<Guid,String> (BtlsId, typeof (Mono.Btls.MonoBtlsProvider).FullName);
|
||||
providerRegistration.Add ("btls", btlsEntry);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MONO_FEATURE_APPLETLS
|
||||
if (Platform.IsMacOS)
|
||||
providerRegistration.Add ("default", appleTlsEntry);
|
||||
else
|
||||
#endif
|
||||
#if MONO_FEATURE_BTLS
|
||||
if (btlsEntry != null)
|
||||
providerRegistration.Add ("default", btlsEntry);
|
||||
else
|
||||
#endif
|
||||
providerRegistration.Add ("default", legacyEntry);
|
||||
|
||||
#if MONO_FEATURE_APPLETLS
|
||||
providerRegistration.Add ("apple", appleTlsEntry);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if MONO_FEATURE_BTLS
|
||||
[MethodImpl (MethodImplOptions.InternalCall)]
|
||||
internal extern static bool IsBtlsSupported ();
|
||||
#endif
|
||||
|
||||
#if MONODROID
|
||||
static MSI.MonoTlsProvider CreateDefaultProviderImpl ()
|
||||
{
|
||||
#if MONODROID
|
||||
MSI.MonoTlsProvider provider = null;
|
||||
var type = Environment.GetEnvironmentVariable ("XA_TLS_PROVIDER");
|
||||
switch (type) {
|
||||
@@ -281,24 +315,40 @@ namespace Mono.Net.Security
|
||||
default:
|
||||
throw new NotSupportedException (string.Format ("Invalid TLS Provider: `{0}'.", provider));
|
||||
}
|
||||
}
|
||||
|
||||
#elif ONLY_APPLETLS || MONOTOUCH || XAMMAC
|
||||
static MSI.MonoTlsProvider CreateDefaultProviderImpl ()
|
||||
{
|
||||
return new AppleTlsProvider ();
|
||||
}
|
||||
#else
|
||||
static MSI.MonoTlsProvider CreateDefaultProviderImpl ()
|
||||
{
|
||||
var variable = Environment.GetEnvironmentVariable ("MONO_TLS_PROVIDER");
|
||||
if (string.IsNullOrEmpty (variable))
|
||||
variable = "default";
|
||||
var type = Environment.GetEnvironmentVariable ("MONO_TLS_PROVIDER");
|
||||
if (string.IsNullOrEmpty (type))
|
||||
type = "default";
|
||||
|
||||
return LookupProvider (variable, true);
|
||||
}
|
||||
switch (type) {
|
||||
case "default":
|
||||
#if MONO_FEATURE_APPLETLS
|
||||
if (Platform.IsMacOS)
|
||||
goto case "apple";
|
||||
#endif
|
||||
#if MONO_FEATURE_BTLS
|
||||
if (IsBtlsSupported ())
|
||||
goto case "btls";
|
||||
#endif
|
||||
goto case "legacy";
|
||||
#if MONO_FEATURE_APPLETLS
|
||||
case "apple":
|
||||
return new AppleTlsProvider ();
|
||||
#endif
|
||||
#if MONO_FEATURE_BTLS
|
||||
case "btls":
|
||||
return new MonoBtlsProvider ();
|
||||
#endif
|
||||
case "legacy":
|
||||
return new Mono.Net.Security.LegacyTlsProvider ();
|
||||
}
|
||||
|
||||
#endregion
|
||||
return LookupProvider (type, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
#region Mono.Security visible API
|
||||
|
||||
|
||||
@@ -312,73 +312,36 @@ partial class SR
|
||||
public const string net_nonClsCompliantException = "A non-CLS Compliant Exception (i.e. an object that does not derive from System.Exception) was thrown.";
|
||||
public const string net_illegalConfigWith = "The '{0}' attribute cannot appear when '{1}' is present.";
|
||||
public const string net_illegalConfigWithout = "The '{0}' attribute can only appear when '{1}' is present.";
|
||||
public const string net_baddate = "The value of the date string in the header is invalid.";
|
||||
public const string net_writestarted = "This property cannot be set after writing has started.";
|
||||
public const string net_reqsubmitted = "This operation cannot be performed after the request has been submitted.";
|
||||
public const string net_ftp_no_http_cmd = "The requested FTP command is not supported when using HTTP proxy.";
|
||||
public const string net_ftp_invalid_method_name = "FTP Method names cannot be null or empty.";
|
||||
public const string net_ftp_invalid_renameto = "The RenameTo filename cannot be null or empty.";
|
||||
public const string net_ftp_no_defaultcreds = "Default credentials are not supported on an FTP request.";
|
||||
public const string net_ftpnoresponse = "This type of FTP request does not return a response stream.";
|
||||
public const string net_ftp_response_invalid_format = "The response string '{0}' has invalid format.";
|
||||
public const string net_ftp_no_offsetforhttp = "Offsets are not supported when sending an FTP request over an HTTP proxy.";
|
||||
public const string net_ftp_invalid_uri = "The requested URI is invalid for this FTP command.";
|
||||
public const string net_ftp_invalid_status_response = "The status response ({0}) is not expected in response to '{1}' command.";
|
||||
public const string net_ftp_server_failed_passive = "The server failed the passive mode request with status response ({0}).";
|
||||
public const string net_ftp_active_address_different = "The data connection was made from an address that is different than the address to which the FTP connection was made.";
|
||||
public const string net_ftp_proxy_does_not_support_ssl = "SSL cannot be enabled when using a proxy.";
|
||||
public const string net_ftp_invalid_response_filename = "The server returned the filename ({0}) which is not valid.";
|
||||
public const string net_ftp_unsupported_method = "This method is not supported.";
|
||||
public const string net_resubmitcanceled = "An error occurred on an automatic resubmission of the request.";
|
||||
public const string net_redirect_perm = "WebPermission demand failed for redirect URI.";
|
||||
public const string net_resubmitprotofailed = "Cannot handle redirect from HTTP/HTTPS protocols to other dissimilar ones.";
|
||||
public const string net_needchunked = "TransferEncoding requires the SendChunked property to be set to true.";
|
||||
public const string net_connarg = "Keep-Alive and Close may not be set using this property.";
|
||||
public const string net_no100 = "100-Continue may not be set using this property.";
|
||||
public const string net_fromto = "The From parameter cannot be less than To.";
|
||||
public const string net_rangetoosmall = "The From or To parameter cannot be less than 0.";
|
||||
public const string net_invalidversion = "This protocol version is not supported.";
|
||||
public const string net_toosmall = "The specified value must be greater than 0.";
|
||||
public const string net_toolong = "The size of {0} is too long. It cannot be longer than {1} characters.";
|
||||
public const string net_connclosed = "The underlying connection was closed: {0}.";
|
||||
public const string net_servererror = "The remote server returned an error: {0}.";
|
||||
public const string net_nouploadonget = "Cannot send a content-body with this verb-type.";
|
||||
public const string net_mutualauthfailed = "The requirement for mutual authentication was not met by the remote server.";
|
||||
public const string net_invasync = "Cannot block a call on this socket while an earlier asynchronous call is in progress.";
|
||||
public const string net_inasync = "An asynchronous call is already in progress. It must be completed or canceled before you can call this method.";
|
||||
public const string net_mustbeuri = "The {0} parameter must represent a valid Uri (see inner exception).";
|
||||
public const string net_format_shexp = "The shell expression '{0}' could not be parsed because it is formatted incorrectly.";
|
||||
public const string net_cannot_load_proxy_helper = "Failed to load the proxy script runtime environment from the Microsoft.JScript assembly.";
|
||||
public const string net_invalid_host = "The specified value is not a valid Host header string.";
|
||||
public const string net_repcall = "Cannot re-call BeginGetRequestStream/BeginGetResponse while a previous call is still in progress.";
|
||||
public const string net_badmethod = "Cannot set null or blank methods on request.";
|
||||
public const string net_io_timeout_use_ge_zero = "Timeout can be only be set to 'System.Threading.Timeout.Infinite' or a value >= 0.";
|
||||
public const string net_io_timeout_use_gt_zero = "Timeout can be only be set to 'System.Threading.Timeout.Infinite' or a value > 0.";
|
||||
public const string net_io_no_0timeouts = "NetworkStream does not support a 0 millisecond timeout, use a value greater than zero for the timeout instead.";
|
||||
public const string net_requestaborted = "The request was aborted: {0}.";
|
||||
public const string net_tooManyRedirections = "Too many automatic redirections were attempted.";
|
||||
public const string net_authmodulenotregistered = "The supplied authentication module is not registered.";
|
||||
public const string net_authschemenotregistered = "There is no registered module for this authentication scheme.";
|
||||
public const string net_proxyschemenotsupported = "The ServicePointManager does not support proxies with the {0} scheme.";
|
||||
public const string net_maxsrvpoints = "The maximum number of service points was exceeded.";
|
||||
public const string net_unknown_prefix = "The URI prefix is not recognized.";
|
||||
public const string net_notconnected = "The operation is not allowed on non-connected sockets.";
|
||||
public const string net_notstream = "The operation is not allowed on non-stream oriented sockets.";
|
||||
public const string net_timeout = "The operation has timed out.";
|
||||
public const string net_nocontentlengthonget = "Content-Length or Chunked Encoding cannot be set for an operation that does not write data.";
|
||||
public const string net_contentlengthmissing = "When performing a write operation with AllowWriteStreamBuffering set to false, you must either set ContentLength to a non-negative number or set SendChunked to true.";
|
||||
public const string net_nonhttpproxynotallowed = "The URI scheme for the supplied IWebProxy has the illegal value '{0}'. Only 'http' is supported.";
|
||||
public const string net_nottoken = "The supplied string is not a valid HTTP token.";
|
||||
public const string net_rangetype = "A different range specifier has already been added to this request.";
|
||||
public const string net_need_writebuffering = "This request requires buffering data to succeed.";
|
||||
public const string net_securityprotocolnotsupported = "The requested security protocol is not supported.";
|
||||
public const string net_nodefaultcreds = "Default credentials cannot be supplied for the {0} authentication scheme.";
|
||||
public const string net_stopped = "Not listening. You must call the Start() method before calling this method.";
|
||||
public const string net_udpconnected = "Cannot send packets to an arbitrary host while connected.";
|
||||
public const string net_no_concurrent_io_allowed = "The stream does not support concurrent IO read or write operations.";
|
||||
public const string net_needmorethreads = "There were not enough free threads in the ThreadPool to complete the operation.";
|
||||
public const string net_MethodNotSupportedException = "This method is not supported by this class.";
|
||||
public const string net_PropertyNotSupportedException = "This property is not supported by this class.";
|
||||
public const string net_ProtocolNotSupportedException = "The '{0}' protocol is not supported by this class.";
|
||||
public const string net_SelectModeNotSupportedException = "The '{0}' select mode is not supported by this class.";
|
||||
public const string net_InvalidSocketHandle = "The socket handle is not valid.";
|
||||
@@ -389,7 +352,6 @@ partial class SR
|
||||
public const string net_invalidPingBufferSize = "The buffer length must not exceed 65500 bytes.";
|
||||
public const string net_cant_perform_during_shutdown = "This operation cannot be performed while the AppDomain is shutting down.";
|
||||
public const string net_cant_create_environment = "Unable to create another web proxy script environment at this time.";
|
||||
public const string net_completed_result = "This operation cannot be performed on a completed asynchronous result object.";
|
||||
public const string net_protocol_invalid_family = "'{0}' Client can only accept InterNetwork or InterNetworkV6 addresses.";
|
||||
public const string net_protocol_invalid_multicast_family = "Multicast family is not the same as the family of the '{0}' Client.";
|
||||
public const string net_empty_osinstalltype = "The Registry value '{0}' was either empty or not a string type.";
|
||||
@@ -443,8 +405,6 @@ partial class SR
|
||||
public const string net_WebResponseParseError_InvalidChunkFormat = "Response chunk format is invalid";
|
||||
public const string net_WebResponseParseError_UnexpectedServerResponse = "Unexpected server response received";
|
||||
public const string net_webstatus_Success = "Status success";
|
||||
public const string net_webstatus_NameResolutionFailure = "The remote name could not be resolved";
|
||||
public const string net_webstatus_ConnectFailure = "Unable to connect to the remote server";
|
||||
public const string net_webstatus_ReceiveFailure = "An unexpected error occurred on a receive";
|
||||
public const string net_webstatus_SendFailure = "An unexpected error occurred on a send";
|
||||
public const string net_webstatus_PipelineFailure = "A pipeline failure occurred";
|
||||
@@ -458,25 +418,7 @@ partial class SR
|
||||
public const string net_webstatus_MessageLengthLimitExceeded = "The message length limit was exceeded";
|
||||
public const string net_webstatus_CacheEntryNotFound = "The request cache-only policy does not allow a network request and the response is not found in cache";
|
||||
public const string net_webstatus_RequestProhibitedByCachePolicy = "The request could not be satisfied using a cache-only policy";
|
||||
public const string net_webstatus_Timeout = "The operation has timed out";
|
||||
public const string net_webstatus_RequestProhibitedByProxy = "The IWebProxy object associated with the request did not allow the request to proceed";
|
||||
public const string net_InvalidStatusCode = "The server returned a status code outside the valid range of 100-599.";
|
||||
public const string net_ftpstatuscode_ServiceNotAvailable = "Service not available, closing control connection";
|
||||
public const string net_ftpstatuscode_CantOpenData = "Can't open data connection";
|
||||
public const string net_ftpstatuscode_ConnectionClosed = "Connection closed; transfer aborted";
|
||||
public const string net_ftpstatuscode_ActionNotTakenFileUnavailableOrBusy = "File unavailable (e.g., file busy)";
|
||||
public const string net_ftpstatuscode_ActionAbortedLocalProcessingError = "Local error in processing";
|
||||
public const string net_ftpstatuscode_ActionNotTakenInsufficentSpace = "Insufficient storage space in system";
|
||||
public const string net_ftpstatuscode_CommandSyntaxError = "Syntax error, command unrecognized";
|
||||
public const string net_ftpstatuscode_ArgumentSyntaxError = "Syntax error in parameters or arguments";
|
||||
public const string net_ftpstatuscode_CommandNotImplemented = "Command not implemented";
|
||||
public const string net_ftpstatuscode_BadCommandSequence = "Bad sequence of commands";
|
||||
public const string net_ftpstatuscode_NotLoggedIn = "Not logged in";
|
||||
public const string net_ftpstatuscode_AccountNeeded = "Need account for storing files";
|
||||
public const string net_ftpstatuscode_ActionNotTakenFileUnavailable = "File unavailable (e.g., file not found, no access)";
|
||||
public const string net_ftpstatuscode_ActionAbortedUnknownPageType = "Page type unknown";
|
||||
public const string net_ftpstatuscode_FileActionAborted = "Exceeded storage allocation (for current directory or data set)";
|
||||
public const string net_ftpstatuscode_ActionNotTakenFilenameNotAllowed = "File name not allowed";
|
||||
public const string net_httpstatuscode_NoContent = "No Content";
|
||||
public const string net_httpstatuscode_NonAuthoritativeInformation = "Non Authoritative Information";
|
||||
public const string net_httpstatuscode_ResetContent = "Reset Content";
|
||||
@@ -516,8 +458,6 @@ partial class SR
|
||||
public const string net_headers_req = "This collection holds response headers and cannot contain the specified request header.";
|
||||
public const string net_headers_rsp = "This collection holds request headers and cannot contain the specified response header.";
|
||||
public const string net_headers_toolong = "Header values cannot be longer than {0} characters.";
|
||||
public const string net_WebHeaderInvalidCRLFChars = "Specified value has invalid CRLF characters.";
|
||||
public const string net_WebHeaderInvalidHeaderChars = "Specified value has invalid HTTP Header characters.";
|
||||
public const string net_WebHeaderInvalidNonAsciiChars = "Specified value has invalid non-ASCII characters.";
|
||||
public const string net_WebHeaderMissingColon = "Specified value does not have a ':' separator.";
|
||||
public const string net_headerrestrict = "The '{0}' header must be modified using the appropriate property or method.";
|
||||
|
||||
@@ -15,6 +15,4 @@ partial class SR
|
||||
public const string net_log_set_socketoption_reuseport_default_on = "net_log_set_socketoption_reuseport_default_on";
|
||||
public const string net_log_set_socketoption_reuseport_not_supported = "net_log_set_socketoption_reuseport_not_supported";
|
||||
public const string net_log_set_socketoption_reuseport = "net_log_set_socketoption_reuseport";
|
||||
|
||||
public const string net_reqaborted = "The request was aborted: The request was canceled.";
|
||||
}
|
||||
@@ -1231,7 +1231,6 @@
|
||||
<Compile Include="System.Net\ListenerAsyncResult.cs" />
|
||||
<Compile Include="System.Net\ListenerPrefix.cs" />
|
||||
<Compile Include="System.Net\MacProxy.cs" />
|
||||
<Compile Include="System.Net\MonoChunkParser.cs" />
|
||||
<Compile Include="System.Net\MonoChunkStream.cs" />
|
||||
<Compile Include="System.Net\MonoHttpDate.cs" />
|
||||
<Compile Include="System.Net\NetConfig.cs" />
|
||||
|
||||
@@ -1231,7 +1231,6 @@
|
||||
<Compile Include="System.Net\ListenerAsyncResult.cs" />
|
||||
<Compile Include="System.Net\ListenerPrefix.cs" />
|
||||
<Compile Include="System.Net\MacProxy.cs" />
|
||||
<Compile Include="System.Net\MonoChunkParser.cs" />
|
||||
<Compile Include="System.Net\MonoChunkStream.cs" />
|
||||
<Compile Include="System.Net\MonoHttpDate.cs" />
|
||||
<Compile Include="System.Net\NetConfig.cs" />
|
||||
|
||||
@@ -1231,7 +1231,6 @@
|
||||
<Compile Include="System.Net\ListenerAsyncResult.cs" />
|
||||
<Compile Include="System.Net\ListenerPrefix.cs" />
|
||||
<Compile Include="System.Net\MacProxy.cs" />
|
||||
<Compile Include="System.Net\MonoChunkParser.cs" />
|
||||
<Compile Include="System.Net\MonoChunkStream.cs" />
|
||||
<Compile Include="System.Net\MonoHttpDate.cs" />
|
||||
<Compile Include="System.Net\NetConfig.cs" />
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace System.CodeDom.Compiler
|
||||
[ConfigurationCollection (typeof (Compiler), AddItemName = "compiler", CollectionType = ConfigurationElementCollectionType.BasicMap)]
|
||||
internal sealed class CompilerCollection : ConfigurationElementCollection
|
||||
{
|
||||
static readonly string defaultCompilerVersion = "3.5";
|
||||
static readonly string defaultCompilerVersion = "4.0";
|
||||
static ConfigurationPropertyCollection properties;
|
||||
static List <CompilerInfo> compiler_infos;
|
||||
static Dictionary <string, CompilerInfo> compiler_languages;
|
||||
@@ -50,30 +50,15 @@ namespace System.CodeDom.Compiler
|
||||
properties = new ConfigurationPropertyCollection ();
|
||||
compiler_infos = new List <CompilerInfo> ();
|
||||
compiler_languages = new Dictionary <string, CompilerInfo> (16, StringComparer.OrdinalIgnoreCase);
|
||||
compiler_extensions = new Dictionary <string, CompilerInfo> (6, StringComparer.OrdinalIgnoreCase);
|
||||
compiler_extensions = new Dictionary <string, CompilerInfo> (4, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
CompilerInfo compiler = new CompilerInfo (null, "Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||
new [] { ".cs" }, new [] { "c#", "cs", "csharp" });
|
||||
CompilerInfo compiler = new CompilerInfo (null, "Microsoft.CSharp.CSharpCodeProvider, " + Consts.AssemblySystem,
|
||||
new [] { "c#", "cs", "csharp" }, new [] { ".cs" });
|
||||
compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion;
|
||||
AddCompilerInfo (compiler);
|
||||
|
||||
compiler = new CompilerInfo (null, "Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||
new [] { ".vb" }, new [] { "vb", "vbs", "visualbasic", "vbscript" });
|
||||
compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion;
|
||||
AddCompilerInfo (compiler);
|
||||
|
||||
compiler = new CompilerInfo (null, "Microsoft.JScript.JScriptCodeProvider, Microsoft.JScript, Version=8.0.1100.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
|
||||
new [] { ".js" }, new [] { "js", "jscript", "javascript" });
|
||||
compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion;
|
||||
AddCompilerInfo (compiler);
|
||||
|
||||
compiler = new CompilerInfo (null, "Microsoft.VJSharp.VJSharpCodeProvider, VJSharpCodeProvider, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
|
||||
new [] { ".jsl", ".java" }, new [] { "vj#", "vjs", "vjsharp" });
|
||||
compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion;
|
||||
AddCompilerInfo (compiler);
|
||||
|
||||
compiler = new CompilerInfo (null, "Microsoft.VisualC.CppCodeProvider, CppCodeProvider, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
|
||||
new [] { ".h" }, new [] { "c++", "mc", "cpp" });
|
||||
compiler = new CompilerInfo (null, "Microsoft.VisualBasic.VBCodeProvider, " + Consts.AssemblySystem,
|
||||
new [] { "vb", "vbs", "visualbasic", "vbscript" }, new [] { ".vb" });
|
||||
compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion;
|
||||
AddCompilerInfo (compiler);
|
||||
}
|
||||
|
||||
@@ -59,6 +59,6 @@ namespace System.IO
|
||||
protected void OnRenamed (RenamedEventArgs e) { throw new NotImplementedException (); }
|
||||
public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType) { throw new NotImplementedException (); }
|
||||
public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType, int timeout) { throw new NotImplementedException (); }
|
||||
protected override void Dispose (bool disposing) { throw new NotImplementedException (); }
|
||||
protected override void Dispose (bool disposing) { }
|
||||
}
|
||||
}
|
||||
@@ -1046,6 +1046,10 @@ namespace System.Net.Sockets
|
||||
sockares.EndPoint = remoteEP = sockares.socket.RemapIPEndPoint (ep);
|
||||
}
|
||||
|
||||
if (!sockares.socket.CanTryAddressFamily(sockares.EndPoint.AddressFamily)) {
|
||||
throw new ArgumentException(SR.net_invalidAddressList);
|
||||
}
|
||||
|
||||
int error = 0;
|
||||
|
||||
if (sockares.socket.connect_in_progress) {
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
//
|
||||
// BufferedReadStream.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2018 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;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
class BufferedReadStream : WebReadStream
|
||||
{
|
||||
readonly BufferOffsetSize readBuffer;
|
||||
|
||||
public BufferedReadStream (WebOperation operation, Stream innerStream,
|
||||
BufferOffsetSize readBuffer)
|
||||
: base (operation, innerStream)
|
||||
{
|
||||
this.readBuffer = readBuffer;
|
||||
}
|
||||
|
||||
public override async Task<int> ReadAsync (byte[] buffer, int offset, int size,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested ();
|
||||
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
|
||||
int length = buffer.Length;
|
||||
if (offset < 0 || length < offset)
|
||||
throw new ArgumentOutOfRangeException (nameof (offset));
|
||||
if (size < 0 || (length - offset) < size)
|
||||
throw new ArgumentOutOfRangeException (nameof (size));
|
||||
|
||||
var remaining = readBuffer?.Size ?? 0;
|
||||
if (remaining > 0) {
|
||||
int copy = (remaining > size) ? size : remaining;
|
||||
Buffer.BlockCopy (readBuffer.Buffer, readBuffer.Offset, buffer, offset, copy);
|
||||
readBuffer.Offset += copy;
|
||||
readBuffer.Size -= copy;
|
||||
offset += copy;
|
||||
size -= copy;
|
||||
return copy;
|
||||
}
|
||||
|
||||
if (InnerStream == null)
|
||||
return 0;
|
||||
|
||||
return await InnerStream.ReadAsync (
|
||||
buffer, offset, size, cancellationToken).ConfigureAwait (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
|
||||
namespace System.Net {
|
||||
class ChunkedInputStream : RequestStream {
|
||||
bool disposed;
|
||||
MonoChunkParser decoder;
|
||||
MonoChunkStream decoder;
|
||||
HttpListenerContext context;
|
||||
bool no_more_data;
|
||||
|
||||
@@ -58,10 +58,10 @@ namespace System.Net {
|
||||
{
|
||||
this.context = context;
|
||||
WebHeaderCollection coll = (WebHeaderCollection) context.Request.Headers;
|
||||
decoder = new MonoChunkParser (coll);
|
||||
decoder = new MonoChunkStream (coll);
|
||||
}
|
||||
|
||||
public MonoChunkParser Decoder {
|
||||
public MonoChunkStream Decoder {
|
||||
get { return decoder; }
|
||||
set { decoder = value; }
|
||||
}
|
||||
|
||||
@@ -320,11 +320,9 @@ namespace System.Net {
|
||||
try {
|
||||
IPAddress newAddress = IPAddress.Parse(h_addrlist[i]);
|
||||
|
||||
#pragma warning disable 618
|
||||
if( (Socket.SupportsIPv6 && newAddress.AddressFamily == AddressFamily.InterNetworkV6) ||
|
||||
(Socket.SupportsIPv4 && newAddress.AddressFamily == AddressFamily.InterNetwork) )
|
||||
if( (Socket.OSSupportsIPv6 && newAddress.AddressFamily == AddressFamily.InterNetworkV6) ||
|
||||
(Socket.OSSupportsIPv4 && newAddress.AddressFamily == AddressFamily.InterNetwork) )
|
||||
addrlist.Add(newAddress);
|
||||
#pragma warning restore 618
|
||||
} catch (ArgumentNullException) {
|
||||
/* Ignore this, as the
|
||||
* internal call might have
|
||||
|
||||
@@ -68,6 +68,7 @@ namespace System.Net
|
||||
bool hostChanged;
|
||||
bool allowAutoRedirect = true;
|
||||
bool allowBuffering = true;
|
||||
bool allowReadStreamBuffering;
|
||||
X509CertificateCollection certificates;
|
||||
string connectionGroup;
|
||||
bool haveContentLength;
|
||||
@@ -93,10 +94,11 @@ namespace System.Net
|
||||
bool sendChunked;
|
||||
ServicePoint servicePoint;
|
||||
int timeout = 100000;
|
||||
int continueTimeout = 350;
|
||||
|
||||
WebRequestStream writeStream;
|
||||
HttpWebResponse webResponse;
|
||||
TaskCompletionSource<HttpWebResponse> responseTask;
|
||||
WebCompletionSource responseTask;
|
||||
WebOperation currentOperation;
|
||||
int aborted;
|
||||
bool gotRequestStream;
|
||||
@@ -108,6 +110,8 @@ namespace System.Net
|
||||
DecompressionMethods auto_decomp;
|
||||
int maxResponseHeadersLength;
|
||||
static int defaultMaxResponseHeadersLength;
|
||||
static int defaultMaximumErrorResponseLength;
|
||||
static RequestCachePolicy defaultCachePolicy;
|
||||
int readWriteTimeout = 300000; // ms
|
||||
#if SECURITY_DEP
|
||||
MonoTlsProvider tlsProvider;
|
||||
@@ -115,6 +119,11 @@ namespace System.Net
|
||||
#endif
|
||||
ServerCertValidationCallback certValidationCallback;
|
||||
|
||||
// stores the user provided Host header as Uri. If the user specified a default port explicitly we'll lose
|
||||
// that information when converting the host string to a Uri. _HostHasPort will store that information.
|
||||
bool hostHasPort;
|
||||
Uri hostUri;
|
||||
|
||||
enum NtlmAuthState
|
||||
{
|
||||
None,
|
||||
@@ -122,7 +131,6 @@ namespace System.Net
|
||||
Response
|
||||
}
|
||||
AuthorizationState auth_state, proxy_auth_state;
|
||||
string host;
|
||||
|
||||
[NonSerialized]
|
||||
internal Func<Stream, Task> ResendContentFactory;
|
||||
@@ -130,18 +138,15 @@ namespace System.Net
|
||||
// Constructors
|
||||
static HttpWebRequest ()
|
||||
{
|
||||
defaultMaxResponseHeadersLength = 64 * 1024;
|
||||
defaultMaxResponseHeadersLength = 64;
|
||||
defaultMaximumErrorResponseLength = 64;
|
||||
defaultCachePolicy = new RequestCachePolicy (RequestCacheLevel.BypassCache);
|
||||
#if !MOBILE
|
||||
#pragma warning disable 618
|
||||
NetConfig config = ConfigurationSettings.GetConfig ("system.net/settings") as NetConfig;
|
||||
#pragma warning restore 618
|
||||
if (config != null) {
|
||||
int x = config.MaxResponseHeadersLength;
|
||||
if (x != -1)
|
||||
x *= 64;
|
||||
|
||||
defaultMaxResponseHeadersLength = x;
|
||||
}
|
||||
if (config != null)
|
||||
defaultMaxResponseHeadersLength = config.MaxResponseHeadersLength;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -169,32 +174,13 @@ namespace System.Net
|
||||
}
|
||||
#endif
|
||||
|
||||
[Obsolete ("Serialization is obsoleted for this type", false)]
|
||||
[Obsolete ("Serialization is obsoleted for this type. http://go.microsoft.com/fwlink/?linkid=14202")]
|
||||
protected HttpWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||
{
|
||||
SerializationInfo info = serializationInfo;
|
||||
|
||||
requestUri = (Uri)info.GetValue ("requestUri", typeof (Uri));
|
||||
actualUri = (Uri)info.GetValue ("actualUri", typeof (Uri));
|
||||
allowAutoRedirect = info.GetBoolean ("allowAutoRedirect");
|
||||
allowBuffering = info.GetBoolean ("allowBuffering");
|
||||
certificates = (X509CertificateCollection)info.GetValue ("certificates", typeof (X509CertificateCollection));
|
||||
connectionGroup = info.GetString ("connectionGroup");
|
||||
contentLength = info.GetInt64 ("contentLength");
|
||||
webHeaders = (WebHeaderCollection)info.GetValue ("webHeaders", typeof (WebHeaderCollection));
|
||||
keepAlive = info.GetBoolean ("keepAlive");
|
||||
maxAutoRedirect = info.GetInt32 ("maxAutoRedirect");
|
||||
mediaType = info.GetString ("mediaType");
|
||||
method = info.GetString ("method");
|
||||
initialMethod = info.GetString ("initialMethod");
|
||||
pipelined = info.GetBoolean ("pipelined");
|
||||
version = (Version)info.GetValue ("version", typeof (Version));
|
||||
proxy = (IWebProxy)info.GetValue ("proxy", typeof (IWebProxy));
|
||||
sendChunked = info.GetBoolean ("sendChunked");
|
||||
timeout = info.GetInt32 ("timeout");
|
||||
redirects = info.GetInt32 ("redirects");
|
||||
host = info.GetString ("host");
|
||||
ResetAuthorization ();
|
||||
// In CoreFX, attempting to serialize this class fails due to
|
||||
// non-serializable fields, so this constructor never gets called.
|
||||
// They're throwing PlatformNotSupportedException() in here.
|
||||
throw new SerializationException ();
|
||||
}
|
||||
|
||||
#if MONO_WEB_DEBUG
|
||||
@@ -245,11 +231,8 @@ namespace System.Net
|
||||
}
|
||||
|
||||
public virtual bool AllowReadStreamBuffering {
|
||||
get { return false; }
|
||||
set {
|
||||
if (value)
|
||||
throw new InvalidOperationException ();
|
||||
}
|
||||
get { return allowReadStreamBuffering; }
|
||||
set { allowReadStreamBuffering = value; }
|
||||
}
|
||||
|
||||
static Exception GetMustImplement ()
|
||||
@@ -309,19 +292,17 @@ namespace System.Net
|
||||
set {
|
||||
CheckRequestStarted ();
|
||||
|
||||
if (string.IsNullOrEmpty (value)) {
|
||||
if (string.IsNullOrWhiteSpace (value)) {
|
||||
webHeaders.RemoveInternal ("Connection");
|
||||
return;
|
||||
}
|
||||
|
||||
string val = value.ToLowerInvariant ();
|
||||
if (val.Contains ("keep-alive") || val.Contains ("close"))
|
||||
throw new ArgumentException ("Keep-Alive and Close may not be set with this property");
|
||||
throw new ArgumentException (SR.net_connarg, nameof (value));
|
||||
|
||||
if (keepAlive)
|
||||
value = value + ", Keep-Alive";
|
||||
|
||||
webHeaders.CheckUpdate ("Connection", value);
|
||||
string checkedValue = HttpValidationHelpers.CheckBadHeaderValueChars (value);
|
||||
webHeaders.CheckUpdate ("Connection", checkedValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,23 +374,15 @@ namespace System.Net
|
||||
#if !MOBILE
|
||||
[MonoTODO]
|
||||
public static new RequestCachePolicy DefaultCachePolicy {
|
||||
get {
|
||||
throw GetMustImplement ();
|
||||
}
|
||||
set {
|
||||
throw GetMustImplement ();
|
||||
}
|
||||
get { return defaultCachePolicy; }
|
||||
set { defaultCachePolicy = value; }
|
||||
}
|
||||
#endif
|
||||
|
||||
[MonoTODO]
|
||||
public static int DefaultMaximumErrorResponseLength {
|
||||
get {
|
||||
throw GetMustImplement ();
|
||||
}
|
||||
set {
|
||||
throw GetMustImplement ();
|
||||
}
|
||||
get { return defaultMaximumErrorResponseLength; }
|
||||
set { defaultMaximumErrorResponseLength = value; }
|
||||
}
|
||||
|
||||
public string Expect {
|
||||
@@ -461,40 +434,40 @@ namespace System.Net
|
||||
}
|
||||
|
||||
public string Host {
|
||||
|
||||
get {
|
||||
if (host == null)
|
||||
return actualUri.Authority;
|
||||
return host;
|
||||
Uri uri = hostUri ?? Address;
|
||||
return (hostUri == null || !hostHasPort) && Address.IsDefaultPort ?
|
||||
uri.Host : uri.Host + ":" + uri.Port;
|
||||
}
|
||||
set {
|
||||
CheckRequestStarted ();
|
||||
|
||||
if (value == null)
|
||||
throw new ArgumentNullException ("value");
|
||||
throw new ArgumentNullException (nameof (value));
|
||||
|
||||
if (!CheckValidHost (actualUri.Scheme, value))
|
||||
throw new ArgumentException ("Invalid host: " + value);
|
||||
Uri uri;
|
||||
if ((value.IndexOf ('/') != -1) || (!TryGetHostUri (value, out uri)))
|
||||
throw new ArgumentException (SR.net_invalid_host, nameof (value));
|
||||
|
||||
host = value;
|
||||
hostUri = uri;
|
||||
|
||||
// Determine if the user provided string contains a port
|
||||
if (!hostUri.IsDefaultPort) {
|
||||
hostHasPort = true;
|
||||
} else if (value.IndexOf (':') == -1) {
|
||||
hostHasPort = false;
|
||||
} else {
|
||||
int endOfIPv6Address = value.IndexOf (']');
|
||||
hostHasPort = endOfIPv6Address == -1 || value.LastIndexOf (':') > endOfIPv6Address;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool CheckValidHost (string scheme, string val)
|
||||
bool TryGetHostUri (string hostName, out Uri hostUri)
|
||||
{
|
||||
if (val.Length == 0)
|
||||
return false;
|
||||
|
||||
if (val[0] == '.')
|
||||
return false;
|
||||
|
||||
int idx = val.IndexOf ('/');
|
||||
if (idx >= 0)
|
||||
return false;
|
||||
|
||||
IPAddress ipaddr;
|
||||
if (IPAddress.TryParse (val, out ipaddr))
|
||||
return true;
|
||||
|
||||
string u = scheme + "://" + val + "/";
|
||||
return Uri.IsWellFormedUriString (u, UriKind.Absolute);
|
||||
string s = Address.Scheme + "://" + hostName + Address.PathAndQuery;
|
||||
return Uri.TryCreate (s, UriKind.Absolute, out hostUri);
|
||||
}
|
||||
|
||||
public DateTime IfModifiedSince {
|
||||
@@ -539,7 +512,13 @@ namespace System.Net
|
||||
[MonoTODO ("Use this")]
|
||||
public int MaximumResponseHeadersLength {
|
||||
get { return maxResponseHeadersLength; }
|
||||
set { maxResponseHeadersLength = value; }
|
||||
set {
|
||||
CheckRequestStarted ();
|
||||
if (value < 0 && value != System.Threading.Timeout.Infinite)
|
||||
throw new ArgumentOutOfRangeException (nameof (value), SR.net_toosmall);
|
||||
|
||||
maxResponseHeadersLength = value;
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO ("Use this")]
|
||||
@@ -551,11 +530,10 @@ namespace System.Net
|
||||
public int ReadWriteTimeout {
|
||||
get { return readWriteTimeout; }
|
||||
set {
|
||||
if (requestSent)
|
||||
throw new InvalidOperationException ("The request has already been sent.");
|
||||
CheckRequestStarted ();
|
||||
|
||||
if (value < -1)
|
||||
throw new ArgumentOutOfRangeException ("value", "Must be >= -1");
|
||||
if (value <= 0 && value != System.Threading.Timeout.Infinite)
|
||||
throw new ArgumentOutOfRangeException (nameof (value), SR.net_io_timeout_use_gt_zero);
|
||||
|
||||
readWriteTimeout = value;
|
||||
}
|
||||
@@ -563,8 +541,15 @@ namespace System.Net
|
||||
|
||||
[MonoTODO]
|
||||
public int ContinueTimeout {
|
||||
get { throw new NotImplementedException (); }
|
||||
set { throw new NotImplementedException (); }
|
||||
get {
|
||||
return continueTimeout;
|
||||
}
|
||||
set {
|
||||
CheckRequestStarted ();
|
||||
if ((value < 0) && (value != System.Threading.Timeout.Infinite))
|
||||
throw new ArgumentOutOfRangeException (nameof (value), SR.net_io_timeout_use_ge_zero);
|
||||
continueTimeout = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string MediaType {
|
||||
@@ -577,8 +562,10 @@ namespace System.Net
|
||||
public override string Method {
|
||||
get { return this.method; }
|
||||
set {
|
||||
if (value == null || value.Trim () == "")
|
||||
throw new ArgumentException ("not a valid method");
|
||||
if (string.IsNullOrEmpty (value))
|
||||
throw new ArgumentException (SR.net_badmethod, nameof (value));
|
||||
if (HttpValidationHelpers.IsInvalidMethodOrHeaderString (value))
|
||||
throw new ArgumentException (SR.net_badmethod, nameof (value));
|
||||
|
||||
method = value.ToUpperInvariant ();
|
||||
if (method != "HEAD" && method != "GET" && method != "POST" && method != "PUT" &&
|
||||
@@ -603,7 +590,7 @@ namespace System.Net
|
||||
get { return version; }
|
||||
set {
|
||||
if (value != HttpVersion.Version10 && value != HttpVersion.Version11)
|
||||
throw new ArgumentException ("value");
|
||||
throw new ArgumentException (SR.net_wrongversion, nameof (value));
|
||||
|
||||
force_version = true;
|
||||
version = value;
|
||||
@@ -672,22 +659,25 @@ namespace System.Net
|
||||
get { return webHeaders["Transfer-Encoding"]; }
|
||||
set {
|
||||
CheckRequestStarted ();
|
||||
string val = value;
|
||||
if (val != null)
|
||||
val = val.Trim ().ToLower ();
|
||||
|
||||
if (val == null || val.Length == 0) {
|
||||
if (string.IsNullOrWhiteSpace (value)) {
|
||||
webHeaders.RemoveInternal ("Transfer-Encoding");
|
||||
return;
|
||||
}
|
||||
|
||||
if (val == "chunked")
|
||||
throw new ArgumentException ("Chunked encoding must be set with the SendChunked property");
|
||||
string val = value.ToLower ();
|
||||
//
|
||||
// prevent them from adding chunked, or from adding an Encoding without
|
||||
// turning on chunked, the reason is due to the HTTP Spec which prevents
|
||||
// additional encoding types from being used without chunked
|
||||
//
|
||||
if (val.Contains ("chunked"))
|
||||
throw new ArgumentException (SR.net_nochunked, nameof (value));
|
||||
else if (!SendChunked)
|
||||
throw new InvalidOperationException (SR.net_needchunked);
|
||||
|
||||
if (!sendChunked)
|
||||
throw new ArgumentException ("SendChunked must be True", "value");
|
||||
|
||||
webHeaders.CheckUpdate ("Transfer-Encoding", value);
|
||||
string checkedValue = HttpValidationHelpers.CheckBadHeaderValueChars (value);
|
||||
webHeaders.CheckUpdate ("Transfer-Encoding", checkedValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -863,7 +853,7 @@ namespace System.Net
|
||||
}
|
||||
}
|
||||
|
||||
async Task<Stream> MyGetRequestStreamAsync (CancellationToken cancellationToken)
|
||||
Task<Stream> MyGetRequestStreamAsync (CancellationToken cancellationToken)
|
||||
{
|
||||
if (Aborted)
|
||||
throw CreateRequestAbortedException ();
|
||||
@@ -894,14 +884,11 @@ namespace System.Net
|
||||
}
|
||||
}
|
||||
|
||||
return await operation.GetRequestStream ().ConfigureAwait (false);
|
||||
return operation.GetRequestStream ();
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state)
|
||||
{
|
||||
if (Aborted)
|
||||
throw CreateRequestAbortedException ();
|
||||
|
||||
return TaskToApm.Begin (RunWithTimeout (MyGetRequestStreamAsync), callback, state);
|
||||
}
|
||||
|
||||
@@ -932,22 +919,39 @@ namespace System.Net
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
internal static async Task<T> RunWithTimeout<T> (Func<CancellationToken, Task<T>> func, int timeout, Action abort)
|
||||
public override Task<Stream> GetRequestStreamAsync ()
|
||||
{
|
||||
using (var cts = new CancellationTokenSource ()) {
|
||||
var timeoutTask = Task.Delay (timeout);
|
||||
var workerTask = func (cts.Token);
|
||||
var ret = await Task.WhenAny (workerTask, timeoutTask).ConfigureAwait (false);
|
||||
if (ret == timeoutTask) {
|
||||
try {
|
||||
cts.Cancel ();
|
||||
abort ();
|
||||
} catch {
|
||||
// Ignore; we report the timeout.
|
||||
}
|
||||
throw new WebException (SR.net_timeout, WebExceptionStatus.Timeout);
|
||||
return RunWithTimeout (MyGetRequestStreamAsync);
|
||||
}
|
||||
|
||||
internal static Task<T> RunWithTimeout<T> (
|
||||
Func<CancellationToken, Task<T>> func, int timeout, Action abort)
|
||||
{
|
||||
// Call `func` here to propagate any potential exception that it
|
||||
// might throw to our caller rather than returning a faulted task.
|
||||
var cts = new CancellationTokenSource ();
|
||||
var workerTask = func (cts.Token);
|
||||
return RunWithTimeoutWorker (workerTask, timeout, abort, cts);
|
||||
}
|
||||
|
||||
static async Task<T> RunWithTimeoutWorker<T> (
|
||||
Task<T> workerTask, int timeout, Action abort,
|
||||
CancellationTokenSource cts)
|
||||
{
|
||||
try {
|
||||
if (await ServicePointScheduler.WaitAsync (workerTask, timeout).ConfigureAwait (false))
|
||||
return workerTask.Result;
|
||||
try {
|
||||
cts.Cancel ();
|
||||
abort ();
|
||||
} catch {
|
||||
// Ignore; we report the timeout.
|
||||
}
|
||||
return workerTask.Result;
|
||||
throw new WebException (SR.net_timeout, WebExceptionStatus.Timeout);
|
||||
} catch (Exception ex) {
|
||||
throw FlattenException (ex);
|
||||
} finally {
|
||||
cts.Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -968,15 +972,16 @@ namespace System.Net
|
||||
if (!sendChunked && transferEncoding != null && transferEncoding.Trim () != "")
|
||||
throw new ProtocolViolationException ("SendChunked should be true.");
|
||||
|
||||
var myTcs = new TaskCompletionSource<HttpWebResponse> ();
|
||||
var completion = new WebCompletionSource ();
|
||||
WebOperation operation;
|
||||
lock (locker) {
|
||||
getResponseCalled = true;
|
||||
var oldTcs = Interlocked.CompareExchange (ref responseTask, myTcs, null);
|
||||
WebConnection.Debug ($"HWR GET RESPONSE: Req={ID} {oldTcs != null}");
|
||||
if (oldTcs != null) {
|
||||
if (haveResponse && oldTcs.Task.IsCompleted)
|
||||
return oldTcs.Task.Result;
|
||||
var oldCompletion = Interlocked.CompareExchange (ref responseTask, completion, null);
|
||||
WebConnection.Debug ($"HWR GET RESPONSE: Req={ID} {oldCompletion != null}");
|
||||
if (oldCompletion != null) {
|
||||
oldCompletion.ThrowOnError ();
|
||||
if (haveResponse && oldCompletion.Task.IsCompleted)
|
||||
return webResponse;
|
||||
throw new InvalidOperationException ("Cannot re-call start of asynchronous " +
|
||||
"method while a previous call is still in progress.");
|
||||
}
|
||||
@@ -1004,7 +1009,7 @@ namespace System.Net
|
||||
|
||||
WebConnection.Debug ($"HWR GET RESPONSE LOOP: Req={ID} {auth_state.NtlmAuthState}");
|
||||
|
||||
writeStream = await operation.GetRequestStream ();
|
||||
writeStream = await operation.GetRequestStreamInternal ();
|
||||
await writeStream.WriteRequestAsync (cancellationToken).ConfigureAwait (false);
|
||||
|
||||
stream = await operation.GetResponseStream ();
|
||||
@@ -1023,14 +1028,14 @@ namespace System.Net
|
||||
if (throwMe != null) {
|
||||
WebConnection.Debug ($"HWR GET RESPONSE LOOP #1 EX: Req={ID} {throwMe.Status} {throwMe.InnerException?.GetType ()}");
|
||||
haveResponse = true;
|
||||
myTcs.TrySetException (throwMe);
|
||||
completion.TrySetException (throwMe);
|
||||
throw throwMe;
|
||||
}
|
||||
|
||||
if (!redirect) {
|
||||
haveResponse = true;
|
||||
webResponse = response;
|
||||
myTcs.TrySetResult (response);
|
||||
completion.TrySetCompleted ();
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -1044,7 +1049,7 @@ namespace System.Net
|
||||
try {
|
||||
if (mustReadAll)
|
||||
await stream.ReadAllAsync (redirect || ntlm != null, cancellationToken).ConfigureAwait (false);
|
||||
operation.CompleteResponseRead (true);
|
||||
operation.Finish (true);
|
||||
response.Close ();
|
||||
} catch (Exception e) {
|
||||
throwMe = GetWebException (e);
|
||||
@@ -1056,7 +1061,7 @@ namespace System.Net
|
||||
WebConnection.Debug ($"HWR GET RESPONSE LOOP #3 EX: Req={ID} {throwMe.Status} {throwMe.InnerException?.GetType ()}");
|
||||
haveResponse = true;
|
||||
stream?.Close ();
|
||||
myTcs.TrySetException (throwMe);
|
||||
completion.TrySetException (throwMe);
|
||||
throw throwMe;
|
||||
}
|
||||
|
||||
@@ -1228,34 +1233,13 @@ namespace System.Net
|
||||
void ISerializable.GetObjectData (SerializationInfo serializationInfo,
|
||||
StreamingContext streamingContext)
|
||||
{
|
||||
GetObjectData (serializationInfo, streamingContext);
|
||||
throw new SerializationException ();
|
||||
}
|
||||
|
||||
protected override void GetObjectData (SerializationInfo serializationInfo,
|
||||
StreamingContext streamingContext)
|
||||
{
|
||||
SerializationInfo info = serializationInfo;
|
||||
|
||||
info.AddValue ("requestUri", requestUri, typeof (Uri));
|
||||
info.AddValue ("actualUri", actualUri, typeof (Uri));
|
||||
info.AddValue ("allowAutoRedirect", allowAutoRedirect);
|
||||
info.AddValue ("allowBuffering", allowBuffering);
|
||||
info.AddValue ("certificates", certificates, typeof (X509CertificateCollection));
|
||||
info.AddValue ("connectionGroup", connectionGroup);
|
||||
info.AddValue ("contentLength", contentLength);
|
||||
info.AddValue ("webHeaders", webHeaders, typeof (WebHeaderCollection));
|
||||
info.AddValue ("keepAlive", keepAlive);
|
||||
info.AddValue ("maxAutoRedirect", maxAutoRedirect);
|
||||
info.AddValue ("mediaType", mediaType);
|
||||
info.AddValue ("method", method);
|
||||
info.AddValue ("initialMethod", initialMethod);
|
||||
info.AddValue ("pipelined", pipelined);
|
||||
info.AddValue ("version", version, typeof (Version));
|
||||
info.AddValue ("proxy", proxy, typeof (IWebProxy));
|
||||
info.AddValue ("sendChunked", sendChunked);
|
||||
info.AddValue ("timeout", timeout);
|
||||
info.AddValue ("redirects", redirects);
|
||||
info.AddValue ("host", host);
|
||||
throw new SerializationException ();
|
||||
}
|
||||
|
||||
void CheckRequestStarted ()
|
||||
@@ -1384,7 +1368,19 @@ namespace System.Net
|
||||
webHeaders.ChangeInternal (connectionHeader, "close");
|
||||
}
|
||||
|
||||
webHeaders.SetInternal ("Host", Host);
|
||||
string host;
|
||||
if (hostUri != null) {
|
||||
if (hostHasPort)
|
||||
host = hostUri.GetComponents (UriComponents.HostAndPort, UriFormat.Unescaped);
|
||||
else
|
||||
host = hostUri.GetComponents (UriComponents.Host, UriFormat.Unescaped);
|
||||
} else if (Address.IsDefaultPort) {
|
||||
host = Address.GetComponents (UriComponents.Host, UriFormat.Unescaped);
|
||||
} else {
|
||||
host = Address.GetComponents (UriComponents.HostAndPort, UriFormat.Unescaped);
|
||||
}
|
||||
webHeaders.SetInternal ("Host", host);
|
||||
|
||||
if (cookieContainer != null) {
|
||||
string cookieHeader = cookieContainer.GetCookieHeader (actualUri);
|
||||
if (cookieHeader != "")
|
||||
|
||||
@@ -36,6 +36,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
@@ -97,6 +98,16 @@ namespace System.Net
|
||||
this.cookie_container = container;
|
||||
FillCookies ();
|
||||
}
|
||||
|
||||
string content_encoding = webHeaders ["Content-Encoding"];
|
||||
if (content_encoding == "gzip" && (stream.Request.AutomaticDecompression & DecompressionMethods.GZip) != 0) {
|
||||
this.stream = new GZipStream (stream, CompressionMode.Decompress);
|
||||
webHeaders.Remove (HttpRequestHeader.ContentEncoding);
|
||||
}
|
||||
else if (content_encoding == "deflate" && (stream.Request.AutomaticDecompression & DecompressionMethods.Deflate) != 0) {
|
||||
this.stream = new DeflateStream (stream, CompressionMode.Decompress);
|
||||
webHeaders.Remove (HttpRequestHeader.ContentEncoding);
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete ("Serialization is obsoleted for this type", false)]
|
||||
@@ -157,6 +168,8 @@ namespace System.Net
|
||||
|
||||
if (contentType == null)
|
||||
contentType = webHeaders ["Content-Type"];
|
||||
if (contentType == null)
|
||||
contentType = string.Empty;
|
||||
|
||||
return contentType;
|
||||
}
|
||||
|
||||
@@ -1,372 +0,0 @@
|
||||
//
|
||||
// System.Net.MonoChunkParser
|
||||
//
|
||||
// Authors:
|
||||
// Gonzalo Paniagua Javier ([email protected])
|
||||
//
|
||||
// (C) 2003 Ximian, Inc (http://www.ximian.com)
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
class MonoChunkParser
|
||||
{
|
||||
enum State {
|
||||
None,
|
||||
PartialSize,
|
||||
Body,
|
||||
BodyFinished,
|
||||
Trailer
|
||||
}
|
||||
|
||||
class Chunk {
|
||||
public byte [] Bytes;
|
||||
public int Offset;
|
||||
|
||||
public Chunk (byte [] chunk)
|
||||
{
|
||||
this.Bytes = chunk;
|
||||
}
|
||||
|
||||
public int Read (byte [] buffer, int offset, int size)
|
||||
{
|
||||
int nread = (size > Bytes.Length - Offset) ? Bytes.Length - Offset : size;
|
||||
Buffer.BlockCopy (Bytes, Offset, buffer, offset, nread);
|
||||
Offset += nread;
|
||||
return nread;
|
||||
}
|
||||
}
|
||||
|
||||
internal WebHeaderCollection headers;
|
||||
int chunkSize;
|
||||
int chunkRead;
|
||||
int totalWritten;
|
||||
State state;
|
||||
//byte [] waitBuffer;
|
||||
StringBuilder saved;
|
||||
bool sawCR;
|
||||
bool gotit;
|
||||
int trailerState;
|
||||
ArrayList chunks;
|
||||
|
||||
public MonoChunkParser (byte [] buffer, int offset, int size, WebHeaderCollection headers)
|
||||
: this (headers)
|
||||
{
|
||||
Write (buffer, offset, size);
|
||||
}
|
||||
|
||||
public MonoChunkParser (WebHeaderCollection headers)
|
||||
{
|
||||
this.headers = headers;
|
||||
saved = new StringBuilder ();
|
||||
chunks = new ArrayList ();
|
||||
chunkSize = -1;
|
||||
totalWritten = 0;
|
||||
}
|
||||
|
||||
public void ResetBuffer ()
|
||||
{
|
||||
chunkSize = -1;
|
||||
chunkRead = 0;
|
||||
totalWritten = 0;
|
||||
chunks.Clear ();
|
||||
}
|
||||
|
||||
public void WriteAndReadBack (byte [] buffer, int offset, int size, ref int read)
|
||||
{
|
||||
if (offset + read > 0)
|
||||
Write (buffer, offset, offset+read);
|
||||
read = Read (buffer, offset, size);
|
||||
}
|
||||
|
||||
public int Read (byte [] buffer, int offset, int size)
|
||||
{
|
||||
return ReadFromChunks (buffer, offset, size);
|
||||
}
|
||||
|
||||
int ReadFromChunks (byte [] buffer, int offset, int size)
|
||||
{
|
||||
int count = chunks.Count;
|
||||
int nread = 0;
|
||||
|
||||
var chunksForRemoving = new List<Chunk>(count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Chunk chunk = (Chunk) chunks [i];
|
||||
|
||||
if (chunk.Offset == chunk.Bytes.Length) {
|
||||
chunksForRemoving.Add(chunk);
|
||||
continue;
|
||||
}
|
||||
|
||||
nread += chunk.Read (buffer, offset + nread, size - nread);
|
||||
if (nread == size)
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (var chunk in chunksForRemoving)
|
||||
chunks.Remove(chunk);
|
||||
|
||||
return nread;
|
||||
}
|
||||
|
||||
public void Write (byte [] buffer, int offset, int size)
|
||||
{
|
||||
if (offset < size)
|
||||
InternalWrite (buffer, ref offset, size);
|
||||
}
|
||||
|
||||
void InternalWrite (byte [] buffer, ref int offset, int size)
|
||||
{
|
||||
if (state == State.None || state == State.PartialSize) {
|
||||
state = GetChunkSize (buffer, ref offset, size);
|
||||
if (state == State.PartialSize)
|
||||
return;
|
||||
|
||||
saved.Length = 0;
|
||||
sawCR = false;
|
||||
gotit = false;
|
||||
}
|
||||
|
||||
if (state == State.Body && offset < size) {
|
||||
state = ReadBody (buffer, ref offset, size);
|
||||
if (state == State.Body)
|
||||
return;
|
||||
}
|
||||
|
||||
if (state == State.BodyFinished && offset < size) {
|
||||
state = ReadCRLF (buffer, ref offset, size);
|
||||
if (state == State.BodyFinished)
|
||||
return;
|
||||
|
||||
sawCR = false;
|
||||
}
|
||||
|
||||
if (state == State.Trailer && offset < size) {
|
||||
state = ReadTrailer (buffer, ref offset, size);
|
||||
if (state == State.Trailer)
|
||||
return;
|
||||
|
||||
saved.Length = 0;
|
||||
sawCR = false;
|
||||
gotit = false;
|
||||
}
|
||||
|
||||
if (offset < size)
|
||||
InternalWrite (buffer, ref offset, size);
|
||||
}
|
||||
|
||||
public bool WantMore {
|
||||
get { return (chunkRead != chunkSize || chunkSize != 0 || state != State.None); }
|
||||
}
|
||||
|
||||
public bool DataAvailable {
|
||||
get {
|
||||
int count = chunks.Count;
|
||||
for (int i = 0; i < count; i++) {
|
||||
Chunk ch = (Chunk) chunks [i];
|
||||
if (ch == null || ch.Bytes == null)
|
||||
continue;
|
||||
if (ch.Bytes.Length > 0 && ch.Offset < ch.Bytes.Length)
|
||||
return (state != State.Body);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int TotalDataSize {
|
||||
get { return totalWritten; }
|
||||
}
|
||||
|
||||
public int ChunkLeft {
|
||||
get { return chunkSize - chunkRead; }
|
||||
}
|
||||
|
||||
State ReadBody (byte [] buffer, ref int offset, int size)
|
||||
{
|
||||
if (chunkSize == 0)
|
||||
return State.BodyFinished;
|
||||
|
||||
int diff = size - offset;
|
||||
if (diff + chunkRead > chunkSize)
|
||||
diff = chunkSize - chunkRead;
|
||||
|
||||
byte [] chunk = new byte [diff];
|
||||
Buffer.BlockCopy (buffer, offset, chunk, 0, diff);
|
||||
chunks.Add (new Chunk (chunk));
|
||||
offset += diff;
|
||||
chunkRead += diff;
|
||||
totalWritten += diff;
|
||||
return (chunkRead == chunkSize) ? State.BodyFinished : State.Body;
|
||||
|
||||
}
|
||||
|
||||
State GetChunkSize (byte [] buffer, ref int offset, int size)
|
||||
{
|
||||
chunkRead = 0;
|
||||
chunkSize = 0;
|
||||
char c = '\0';
|
||||
while (offset < size) {
|
||||
c = (char) buffer [offset++];
|
||||
if (c == '\r') {
|
||||
if (sawCR)
|
||||
ThrowProtocolViolation ("2 CR found");
|
||||
|
||||
sawCR = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sawCR && c == '\n')
|
||||
break;
|
||||
|
||||
if (c == ' ')
|
||||
gotit = true;
|
||||
|
||||
if (!gotit)
|
||||
saved.Append (c);
|
||||
|
||||
if (saved.Length > 20)
|
||||
ThrowProtocolViolation ("chunk size too long.");
|
||||
}
|
||||
|
||||
if (!sawCR || c != '\n') {
|
||||
if (offset < size)
|
||||
ThrowProtocolViolation ("Missing \\n");
|
||||
|
||||
try {
|
||||
if (saved.Length > 0) {
|
||||
chunkSize = Int32.Parse (RemoveChunkExtension (saved.ToString ()), NumberStyles.HexNumber);
|
||||
}
|
||||
} catch (Exception) {
|
||||
ThrowProtocolViolation ("Cannot parse chunk size.");
|
||||
}
|
||||
|
||||
return State.PartialSize;
|
||||
}
|
||||
|
||||
chunkRead = 0;
|
||||
try {
|
||||
chunkSize = Int32.Parse (RemoveChunkExtension (saved.ToString ()), NumberStyles.HexNumber);
|
||||
} catch (Exception) {
|
||||
ThrowProtocolViolation ("Cannot parse chunk size.");
|
||||
}
|
||||
|
||||
if (chunkSize == 0) {
|
||||
trailerState = 2;
|
||||
return State.Trailer;
|
||||
}
|
||||
|
||||
return State.Body;
|
||||
}
|
||||
|
||||
static string RemoveChunkExtension (string input)
|
||||
{
|
||||
int idx = input.IndexOf (';');
|
||||
if (idx == -1)
|
||||
return input;
|
||||
return input.Substring (0, idx);
|
||||
}
|
||||
|
||||
State ReadCRLF (byte [] buffer, ref int offset, int size)
|
||||
{
|
||||
if (!sawCR) {
|
||||
if ((char) buffer [offset++] != '\r')
|
||||
ThrowProtocolViolation ("Expecting \\r");
|
||||
|
||||
sawCR = true;
|
||||
if (offset == size)
|
||||
return State.BodyFinished;
|
||||
}
|
||||
|
||||
if (sawCR && (char) buffer [offset++] != '\n')
|
||||
ThrowProtocolViolation ("Expecting \\n");
|
||||
|
||||
return State.None;
|
||||
}
|
||||
|
||||
State ReadTrailer (byte [] buffer, ref int offset, int size)
|
||||
{
|
||||
char c = '\0';
|
||||
|
||||
// short path
|
||||
if (trailerState == 2 && (char) buffer [offset] == '\r' && saved.Length == 0) {
|
||||
offset++;
|
||||
if (offset < size && (char) buffer [offset] == '\n') {
|
||||
offset++;
|
||||
return State.None;
|
||||
}
|
||||
offset--;
|
||||
}
|
||||
|
||||
int st = trailerState;
|
||||
string stString = "\r\n\r";
|
||||
while (offset < size && st < 4) {
|
||||
c = (char) buffer [offset++];
|
||||
if ((st == 0 || st == 2) && c == '\r') {
|
||||
st++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((st == 1 || st == 3) && c == '\n') {
|
||||
st++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (st > 0) {
|
||||
saved.Append (stString.Substring (0, saved.Length == 0? st-2: st));
|
||||
st = 0;
|
||||
if (saved.Length > 4196)
|
||||
ThrowProtocolViolation ("Error reading trailer (too long).");
|
||||
}
|
||||
}
|
||||
|
||||
if (st < 4) {
|
||||
trailerState = st;
|
||||
if (offset < size)
|
||||
ThrowProtocolViolation ("Error reading trailer.");
|
||||
|
||||
return State.Trailer;
|
||||
}
|
||||
|
||||
StringReader reader = new StringReader (saved.ToString ());
|
||||
string line;
|
||||
while ((line = reader.ReadLine ()) != null && line != "")
|
||||
headers.Add (line);
|
||||
|
||||
return State.None;
|
||||
}
|
||||
|
||||
static void ThrowProtocolViolation (string message)
|
||||
{
|
||||
WebException we = new WebException (message, null, WebExceptionStatus.ServerProtocolViolation, null);
|
||||
throw we;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,94 +1,371 @@
|
||||
//
|
||||
// MonoChunkStream.cs
|
||||
// System.Net.MonoChunkStream
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <mabaul@microsoft.com>
|
||||
// Authors:
|
||||
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
|
||||
//
|
||||
// Copyright (c) 2018 Xamarin Inc. (http://www.xamarin.com)
|
||||
// (C) 2003 Ximian, Inc (http://www.ximian.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
// 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.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
class MonoChunkStream : WebReadStream
|
||||
class MonoChunkStream
|
||||
{
|
||||
protected WebHeaderCollection Headers {
|
||||
get;
|
||||
enum State {
|
||||
None,
|
||||
PartialSize,
|
||||
Body,
|
||||
BodyFinished,
|
||||
Trailer
|
||||
}
|
||||
|
||||
protected MonoChunkParser Decoder {
|
||||
get;
|
||||
}
|
||||
class Chunk {
|
||||
public byte [] Bytes;
|
||||
public int Offset;
|
||||
|
||||
public MonoChunkStream (WebOperation operation, Stream innerStream,
|
||||
WebHeaderCollection headers)
|
||||
: base (operation, innerStream)
|
||||
{
|
||||
Headers = headers;
|
||||
|
||||
Decoder = new MonoChunkParser (headers);
|
||||
}
|
||||
|
||||
public override async Task<int> ReadAsync (byte[] buffer, int offset, int size,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested ();
|
||||
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
|
||||
int length = buffer.Length;
|
||||
if (offset < 0 || length < offset)
|
||||
throw new ArgumentOutOfRangeException (nameof (offset));
|
||||
if (size < 0 || (length - offset) < size)
|
||||
throw new ArgumentOutOfRangeException (nameof (size));
|
||||
|
||||
if (Decoder.DataAvailable)
|
||||
return Decoder.Read (buffer, offset, size);
|
||||
|
||||
int ret = 0;
|
||||
byte[] moreBytes = null;
|
||||
while (ret == 0 && Decoder.WantMore) {
|
||||
int localSize = Decoder.ChunkLeft;
|
||||
if (localSize <= 0) // not read chunk size yet
|
||||
localSize = 1024;
|
||||
else if (localSize > 16384)
|
||||
localSize = 16384;
|
||||
|
||||
if (moreBytes == null || moreBytes.Length < localSize)
|
||||
moreBytes = new byte[localSize];
|
||||
|
||||
ret = await InnerStream.ReadAsync (
|
||||
moreBytes, 0, localSize, cancellationToken).ConfigureAwait (false);
|
||||
|
||||
if (ret <= 0)
|
||||
return ret;
|
||||
|
||||
Decoder.Write (moreBytes, 0, ret);
|
||||
ret = Decoder.Read (buffer, offset, size);
|
||||
public Chunk (byte [] chunk)
|
||||
{
|
||||
this.Bytes = chunk;
|
||||
}
|
||||
|
||||
return ret;
|
||||
public int Read (byte [] buffer, int offset, int size)
|
||||
{
|
||||
int nread = (size > Bytes.Length - Offset) ? Bytes.Length - Offset : size;
|
||||
Buffer.BlockCopy (Bytes, Offset, buffer, offset, nread);
|
||||
Offset += nread;
|
||||
return nread;
|
||||
}
|
||||
}
|
||||
|
||||
internal WebHeaderCollection headers;
|
||||
int chunkSize;
|
||||
int chunkRead;
|
||||
int totalWritten;
|
||||
State state;
|
||||
//byte [] waitBuffer;
|
||||
StringBuilder saved;
|
||||
bool sawCR;
|
||||
bool gotit;
|
||||
int trailerState;
|
||||
ArrayList chunks;
|
||||
|
||||
public MonoChunkStream (byte [] buffer, int offset, int size, WebHeaderCollection headers)
|
||||
: this (headers)
|
||||
{
|
||||
Write (buffer, offset, size);
|
||||
}
|
||||
|
||||
public MonoChunkStream (WebHeaderCollection headers)
|
||||
{
|
||||
this.headers = headers;
|
||||
saved = new StringBuilder ();
|
||||
chunks = new ArrayList ();
|
||||
chunkSize = -1;
|
||||
totalWritten = 0;
|
||||
}
|
||||
|
||||
public void ResetBuffer ()
|
||||
{
|
||||
chunkSize = -1;
|
||||
chunkRead = 0;
|
||||
totalWritten = 0;
|
||||
chunks.Clear ();
|
||||
}
|
||||
|
||||
public void WriteAndReadBack (byte [] buffer, int offset, int size, ref int read)
|
||||
{
|
||||
if (offset + read > 0)
|
||||
Write (buffer, offset, offset+read);
|
||||
read = Read (buffer, offset, size);
|
||||
}
|
||||
|
||||
public int Read (byte [] buffer, int offset, int size)
|
||||
{
|
||||
return ReadFromChunks (buffer, offset, size);
|
||||
}
|
||||
|
||||
int ReadFromChunks (byte [] buffer, int offset, int size)
|
||||
{
|
||||
int count = chunks.Count;
|
||||
int nread = 0;
|
||||
|
||||
var chunksForRemoving = new List<Chunk>(count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Chunk chunk = (Chunk) chunks [i];
|
||||
|
||||
if (chunk.Offset == chunk.Bytes.Length) {
|
||||
chunksForRemoving.Add(chunk);
|
||||
continue;
|
||||
}
|
||||
|
||||
nread += chunk.Read (buffer, offset + nread, size - nread);
|
||||
if (nread == size)
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (var chunk in chunksForRemoving)
|
||||
chunks.Remove(chunk);
|
||||
|
||||
return nread;
|
||||
}
|
||||
|
||||
public void Write (byte [] buffer, int offset, int size)
|
||||
{
|
||||
if (offset < size)
|
||||
InternalWrite (buffer, ref offset, size);
|
||||
}
|
||||
|
||||
void InternalWrite (byte [] buffer, ref int offset, int size)
|
||||
{
|
||||
if (state == State.None || state == State.PartialSize) {
|
||||
state = GetChunkSize (buffer, ref offset, size);
|
||||
if (state == State.PartialSize)
|
||||
return;
|
||||
|
||||
saved.Length = 0;
|
||||
sawCR = false;
|
||||
gotit = false;
|
||||
}
|
||||
|
||||
if (state == State.Body && offset < size) {
|
||||
state = ReadBody (buffer, ref offset, size);
|
||||
if (state == State.Body)
|
||||
return;
|
||||
}
|
||||
|
||||
if (state == State.BodyFinished && offset < size) {
|
||||
state = ReadCRLF (buffer, ref offset, size);
|
||||
if (state == State.BodyFinished)
|
||||
return;
|
||||
|
||||
sawCR = false;
|
||||
}
|
||||
|
||||
if (state == State.Trailer && offset < size) {
|
||||
state = ReadTrailer (buffer, ref offset, size);
|
||||
if (state == State.Trailer)
|
||||
return;
|
||||
|
||||
saved.Length = 0;
|
||||
sawCR = false;
|
||||
gotit = false;
|
||||
}
|
||||
|
||||
if (offset < size)
|
||||
InternalWrite (buffer, ref offset, size);
|
||||
}
|
||||
|
||||
public bool WantMore {
|
||||
get { return (chunkRead != chunkSize || chunkSize != 0 || state != State.None); }
|
||||
}
|
||||
|
||||
public bool DataAvailable {
|
||||
get {
|
||||
int count = chunks.Count;
|
||||
for (int i = 0; i < count; i++) {
|
||||
Chunk ch = (Chunk) chunks [i];
|
||||
if (ch == null || ch.Bytes == null)
|
||||
continue;
|
||||
if (ch.Bytes.Length > 0 && ch.Offset < ch.Bytes.Length)
|
||||
return (state != State.Body);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int TotalDataSize {
|
||||
get { return totalWritten; }
|
||||
}
|
||||
|
||||
public int ChunkLeft {
|
||||
get { return chunkSize - chunkRead; }
|
||||
}
|
||||
|
||||
State ReadBody (byte [] buffer, ref int offset, int size)
|
||||
{
|
||||
if (chunkSize == 0)
|
||||
return State.BodyFinished;
|
||||
|
||||
int diff = size - offset;
|
||||
if (diff + chunkRead > chunkSize)
|
||||
diff = chunkSize - chunkRead;
|
||||
|
||||
byte [] chunk = new byte [diff];
|
||||
Buffer.BlockCopy (buffer, offset, chunk, 0, diff);
|
||||
chunks.Add (new Chunk (chunk));
|
||||
offset += diff;
|
||||
chunkRead += diff;
|
||||
totalWritten += diff;
|
||||
return (chunkRead == chunkSize) ? State.BodyFinished : State.Body;
|
||||
|
||||
}
|
||||
|
||||
State GetChunkSize (byte [] buffer, ref int offset, int size)
|
||||
{
|
||||
chunkRead = 0;
|
||||
chunkSize = 0;
|
||||
char c = '\0';
|
||||
while (offset < size) {
|
||||
c = (char) buffer [offset++];
|
||||
if (c == '\r') {
|
||||
if (sawCR)
|
||||
ThrowProtocolViolation ("2 CR found");
|
||||
|
||||
sawCR = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sawCR && c == '\n')
|
||||
break;
|
||||
|
||||
if (c == ' ')
|
||||
gotit = true;
|
||||
|
||||
if (!gotit)
|
||||
saved.Append (c);
|
||||
|
||||
if (saved.Length > 20)
|
||||
ThrowProtocolViolation ("chunk size too long.");
|
||||
}
|
||||
|
||||
if (!sawCR || c != '\n') {
|
||||
if (offset < size)
|
||||
ThrowProtocolViolation ("Missing \\n");
|
||||
|
||||
try {
|
||||
if (saved.Length > 0) {
|
||||
chunkSize = Int32.Parse (RemoveChunkExtension (saved.ToString ()), NumberStyles.HexNumber);
|
||||
}
|
||||
} catch (Exception) {
|
||||
ThrowProtocolViolation ("Cannot parse chunk size.");
|
||||
}
|
||||
|
||||
return State.PartialSize;
|
||||
}
|
||||
|
||||
chunkRead = 0;
|
||||
try {
|
||||
chunkSize = Int32.Parse (RemoveChunkExtension (saved.ToString ()), NumberStyles.HexNumber);
|
||||
} catch (Exception) {
|
||||
ThrowProtocolViolation ("Cannot parse chunk size.");
|
||||
}
|
||||
|
||||
if (chunkSize == 0) {
|
||||
trailerState = 2;
|
||||
return State.Trailer;
|
||||
}
|
||||
|
||||
return State.Body;
|
||||
}
|
||||
|
||||
static string RemoveChunkExtension (string input)
|
||||
{
|
||||
int idx = input.IndexOf (';');
|
||||
if (idx == -1)
|
||||
return input;
|
||||
return input.Substring (0, idx);
|
||||
}
|
||||
|
||||
State ReadCRLF (byte [] buffer, ref int offset, int size)
|
||||
{
|
||||
if (!sawCR) {
|
||||
if ((char) buffer [offset++] != '\r')
|
||||
ThrowProtocolViolation ("Expecting \\r");
|
||||
|
||||
sawCR = true;
|
||||
if (offset == size)
|
||||
return State.BodyFinished;
|
||||
}
|
||||
|
||||
if (sawCR && (char) buffer [offset++] != '\n')
|
||||
ThrowProtocolViolation ("Expecting \\n");
|
||||
|
||||
return State.None;
|
||||
}
|
||||
|
||||
State ReadTrailer (byte [] buffer, ref int offset, int size)
|
||||
{
|
||||
char c = '\0';
|
||||
|
||||
// short path
|
||||
if (trailerState == 2 && (char) buffer [offset] == '\r' && saved.Length == 0) {
|
||||
offset++;
|
||||
if (offset < size && (char) buffer [offset] == '\n') {
|
||||
offset++;
|
||||
return State.None;
|
||||
}
|
||||
offset--;
|
||||
}
|
||||
|
||||
int st = trailerState;
|
||||
string stString = "\r\n\r";
|
||||
while (offset < size && st < 4) {
|
||||
c = (char) buffer [offset++];
|
||||
if ((st == 0 || st == 2) && c == '\r') {
|
||||
st++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((st == 1 || st == 3) && c == '\n') {
|
||||
st++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (st > 0) {
|
||||
saved.Append (stString.Substring (0, saved.Length == 0? st-2: st));
|
||||
st = 0;
|
||||
if (saved.Length > 4196)
|
||||
ThrowProtocolViolation ("Error reading trailer (too long).");
|
||||
}
|
||||
}
|
||||
|
||||
if (st < 4) {
|
||||
trailerState = st;
|
||||
if (offset < size)
|
||||
ThrowProtocolViolation ("Error reading trailer.");
|
||||
|
||||
return State.Trailer;
|
||||
}
|
||||
|
||||
StringReader reader = new StringReader (saved.ToString ());
|
||||
string line;
|
||||
while ((line = reader.ReadLine ()) != null && line != "")
|
||||
headers.Add (line);
|
||||
|
||||
return State.None;
|
||||
}
|
||||
|
||||
static void ThrowProtocolViolation (string message)
|
||||
{
|
||||
WebException we = new WebException (message, null, WebExceptionStatus.ServerProtocolViolation, null);
|
||||
throw we;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace System.Net
|
||||
|
||||
taskList.Add (schedulerEvent.WaitAsync (maxIdleTime));
|
||||
foreach (var item in operationArray)
|
||||
taskList.Add (item.Item2.WaitForCompletion (true));
|
||||
taskList.Add (item.Item2.Finished.Task);
|
||||
foreach (var item in idleArray)
|
||||
taskList.Add (item.Item3);
|
||||
}
|
||||
@@ -170,32 +170,42 @@ namespace System.Net
|
||||
var ret = await Task.WhenAny (taskList).ConfigureAwait (false);
|
||||
|
||||
lock (ServicePoint) {
|
||||
if (ret == taskList[0]) {
|
||||
RunSchedulerIteration ();
|
||||
continue;
|
||||
}
|
||||
bool runMaster = false;
|
||||
if (ret == taskList[0])
|
||||
runMaster = true;
|
||||
|
||||
int idx = -1;
|
||||
/*
|
||||
* We discard the `taskList` at this point as it is only used to wake us up.
|
||||
*
|
||||
* The `WebCompletionSource<T>` assigns its `CurrentResult` property prior
|
||||
* to completing the `Task` instance, so whenever a task is finished we will
|
||||
* also get a non-null `CurrentResult`.
|
||||
*
|
||||
*/
|
||||
for (int i = 0; i < operationArray.Length; i++) {
|
||||
if (ret == taskList[i + 1]) {
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var item = operationArray[i];
|
||||
var result = item.Item2.Finished.CurrentResult;
|
||||
if (result == null)
|
||||
continue;
|
||||
|
||||
if (idx >= 0) {
|
||||
var item = operationArray[idx];
|
||||
Debug ($"MAIN LOOP #2: {idx} group={item.Item1.ID} Op={item.Item2.ID}");
|
||||
Debug ($"MAIN LOOP #2: {i} group={item.Item1.ID} Op={item.Item2.ID} Status={result.Status}");
|
||||
operations.Remove (item);
|
||||
|
||||
var opTask = (Task<ValueTuple<bool, WebOperation>>)ret;
|
||||
var runLoop = OperationCompleted (item.Item1, item.Item2, opTask);
|
||||
Debug ($"MAIN LOOP #2 DONE: {idx} {runLoop}");
|
||||
if (runLoop)
|
||||
RunSchedulerIteration ();
|
||||
continue;
|
||||
var runLoop = OperationCompleted (item.Item1, item.Item2);
|
||||
Debug ($"MAIN LOOP #2 DONE: {i} {runLoop}");
|
||||
runMaster |= runLoop;
|
||||
}
|
||||
|
||||
/*
|
||||
* This needs to be called after we deal with pending completions to
|
||||
* ensure that connections are properly recognized as being idle.
|
||||
*
|
||||
*/
|
||||
Debug ($"MAIN LOOP #3: runMaster={runMaster}");
|
||||
if (runMaster)
|
||||
RunSchedulerIteration ();
|
||||
|
||||
int idx = -1;
|
||||
for (int i = 0; i < idleArray.Length; i++) {
|
||||
if (ret == taskList[i + 1 + operationArray.Length]) {
|
||||
idx = i;
|
||||
@@ -205,7 +215,7 @@ namespace System.Net
|
||||
|
||||
if (idx >= 0) {
|
||||
var item = idleArray[idx];
|
||||
Debug ($"MAIN LOOP #3: {idx} group={item.Item1.ID} Cnc={item.Item2.ID}");
|
||||
Debug ($"MAIN LOOP #4: {idx} group={item.Item1.ID} Cnc={item.Item2.ID}");
|
||||
idleConnections.Remove (item);
|
||||
CloseIdleConnection (item.Item1, item.Item2);
|
||||
}
|
||||
@@ -242,7 +252,7 @@ namespace System.Net
|
||||
|
||||
repeat = SchedulerIteration (defaultGroup);
|
||||
|
||||
Debug ($"ITERATION #1: repeat={repeat} groups={groups?.Count}");
|
||||
Debug ($"ITERATION #1: {repeat} {groups != null}");
|
||||
|
||||
if (groups != null) {
|
||||
foreach (var group in groups) {
|
||||
@@ -251,11 +261,11 @@ namespace System.Net
|
||||
}
|
||||
}
|
||||
|
||||
Debug ($"ITERATION #3: repeat={repeat}");
|
||||
Debug ($"ITERATION #3: {repeat}");
|
||||
} while (repeat);
|
||||
}
|
||||
|
||||
bool OperationCompleted (ConnectionGroup group, WebOperation operation, Task<(bool, WebOperation)> task)
|
||||
bool OperationCompleted (ConnectionGroup group, WebOperation operation)
|
||||
{
|
||||
#if MONO_WEB_DEBUG
|
||||
var me = $"{nameof (OperationCompleted)}(group={group.ID}, Op={operation.ID}, Cnc={operation.Connection.ID})";
|
||||
@@ -263,8 +273,10 @@ namespace System.Net
|
||||
string me = null;
|
||||
#endif
|
||||
|
||||
var (ok, next) = task.Status == TaskStatus.RanToCompletion ? task.Result : (false, null);
|
||||
Debug ($"{me}: {task.Status} {ok} {next?.ID}");
|
||||
var result = operation.Finished.CurrentResult;
|
||||
var (ok, next) = result.Success ? result.Argument : (false, null);
|
||||
|
||||
Debug ($"{me}: {operation.Finished.CurrentStatus} {ok} {next?.ID}");
|
||||
|
||||
if (!ok || !operation.Connection.Continue (next)) {
|
||||
group.RemoveConnection (operation.Connection);
|
||||
@@ -324,10 +336,9 @@ namespace System.Net
|
||||
|
||||
// Is there anything in the queue?
|
||||
var next = group.GetNextOperation ();
|
||||
if (next == null) {
|
||||
Debug ($"{me} no pending operations.");
|
||||
Debug ($"{me} no pending operations.");
|
||||
if (next == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
Debug ($"{me} found pending operation Op={next.ID}");
|
||||
|
||||
@@ -431,6 +442,19 @@ namespace System.Net
|
||||
Interlocked.Decrement (ref currentConnections);
|
||||
}
|
||||
|
||||
public static async Task<bool> WaitAsync (Task workerTask, int millisecondTimeout)
|
||||
{
|
||||
var cts = new CancellationTokenSource ();
|
||||
try {
|
||||
var timeoutTask = Task.Delay (millisecondTimeout, cts.Token);
|
||||
var ret = await Task.WhenAny (workerTask, timeoutTask).ConfigureAwait (false);
|
||||
return ret != timeoutTask;
|
||||
} finally {
|
||||
cts.Cancel ();
|
||||
cts.Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
class ConnectionGroup
|
||||
{
|
||||
public ServicePointScheduler Scheduler {
|
||||
@@ -557,7 +581,9 @@ namespace System.Net
|
||||
|
||||
public (WebConnection connection, bool created) CreateOrReuseConnection (WebOperation operation, bool force)
|
||||
{
|
||||
Scheduler.Debug ($"CREATE OR REUSE: group={ID} OP={operation.ID} force={force}");
|
||||
var connection = FindIdleConnection (operation);
|
||||
Scheduler.Debug ($"CREATE OR REUSE #1: group={ID} OP={operation.ID} force={force} - connection={connection?.ID}");
|
||||
if (connection != null)
|
||||
return (connection, false);
|
||||
|
||||
@@ -587,11 +613,9 @@ namespace System.Net
|
||||
return m_tcs.Task.Wait (millisecondTimeout);
|
||||
}
|
||||
|
||||
public async Task<bool> WaitAsync (int millisecondTimeout)
|
||||
public Task<bool> WaitAsync (int millisecondTimeout)
|
||||
{
|
||||
var timeoutTask = Task.Delay (millisecondTimeout);
|
||||
var ret = await Task.WhenAny (m_tcs.Task, timeoutTask).ConfigureAwait (false);
|
||||
return ret != timeoutTask;
|
||||
return ServicePointScheduler.WaitAsync (m_tcs.Task, millisecondTimeout);
|
||||
}
|
||||
|
||||
public void Set ()
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
//
|
||||
// WebCompletionSource.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2018 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;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.ExceptionServices;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
class WebCompletionSource<T>
|
||||
{
|
||||
TaskCompletionSource<Result> completion;
|
||||
Result currentResult;
|
||||
|
||||
public WebCompletionSource (bool runAsync = true)
|
||||
{
|
||||
completion = new TaskCompletionSource<Result> (
|
||||
runAsync ?
|
||||
TaskCreationOptions.RunContinuationsAsynchronously :
|
||||
TaskCreationOptions.None);
|
||||
}
|
||||
|
||||
/*
|
||||
* Provide a non-blocking way of getting the current status.
|
||||
*
|
||||
* We are using `TaskCreationOptions.RunContinuationsAsynchronously`
|
||||
* to prevent any user continuations from being run during the
|
||||
* `TrySet*()` methods - to make these safe to be called while holding
|
||||
* internal locks.
|
||||
*
|
||||
*/
|
||||
internal Result CurrentResult => currentResult;
|
||||
|
||||
internal Status CurrentStatus => currentResult?.Status ?? Status.Running;
|
||||
|
||||
internal Task Task => completion.Task;
|
||||
|
||||
public bool TrySetCompleted (T argument)
|
||||
{
|
||||
var result = new Result (argument);
|
||||
if (Interlocked.CompareExchange (ref currentResult, result, null) != null)
|
||||
return false;
|
||||
return completion.TrySetResult (result);
|
||||
}
|
||||
|
||||
public bool TrySetCompleted ()
|
||||
{
|
||||
var result = new Result (Status.Completed, null);
|
||||
if (Interlocked.CompareExchange (ref currentResult, result, null) != null)
|
||||
return false;
|
||||
return completion.TrySetResult (result);
|
||||
}
|
||||
|
||||
public bool TrySetCanceled ()
|
||||
{
|
||||
return TrySetCanceled (new OperationCanceledException ());
|
||||
}
|
||||
|
||||
public bool TrySetCanceled (OperationCanceledException error)
|
||||
{
|
||||
var result = new Result (Status.Canceled, ExceptionDispatchInfo.Capture (error));
|
||||
if (Interlocked.CompareExchange (ref currentResult, result, null) != null)
|
||||
return false;
|
||||
return completion.TrySetResult (result);
|
||||
}
|
||||
|
||||
public bool TrySetException (Exception error)
|
||||
{
|
||||
var result = new Result (Status.Faulted, ExceptionDispatchInfo.Capture (error));
|
||||
if (Interlocked.CompareExchange (ref currentResult, result, null) != null)
|
||||
return false;
|
||||
return completion.TrySetResult (result);
|
||||
}
|
||||
|
||||
public void ThrowOnError ()
|
||||
{
|
||||
if (!completion.Task.IsCompleted)
|
||||
return;
|
||||
completion.Task.Result.Error?.Throw ();
|
||||
}
|
||||
|
||||
public async Task<T> WaitForCompletion ()
|
||||
{
|
||||
var result = await completion.Task.ConfigureAwait (false);
|
||||
if (result.Status == Status.Completed)
|
||||
return (T)result.Argument;
|
||||
// This will always throw once we get here.
|
||||
result.Error.Throw ();
|
||||
throw new InvalidOperationException ("Should never happen.");
|
||||
}
|
||||
|
||||
internal enum Status : int {
|
||||
Running,
|
||||
Completed,
|
||||
Canceled,
|
||||
Faulted
|
||||
}
|
||||
|
||||
internal class Result
|
||||
{
|
||||
public Status Status {
|
||||
get;
|
||||
}
|
||||
|
||||
public bool Success => Status == Status.Completed;
|
||||
|
||||
public ExceptionDispatchInfo Error {
|
||||
get;
|
||||
}
|
||||
|
||||
public T Argument {
|
||||
get;
|
||||
}
|
||||
|
||||
public Result (T argument)
|
||||
{
|
||||
Status = Status.Completed;
|
||||
Argument = argument;
|
||||
}
|
||||
|
||||
public Result (Status state, ExceptionDispatchInfo error)
|
||||
{
|
||||
Status = state;
|
||||
Error = error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class WebCompletionSource : WebCompletionSource<object>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -141,6 +141,8 @@ namespace System.Net
|
||||
#endif
|
||||
}
|
||||
|
||||
Exception connectException = null;
|
||||
|
||||
foreach (IPAddress address in hostEntry.AddressList) {
|
||||
operation.ThrowIfDisposed (cancellationToken);
|
||||
|
||||
@@ -169,7 +171,10 @@ namespace System.Net
|
||||
throw;
|
||||
} catch (Exception exc) {
|
||||
Interlocked.Exchange (ref socket, null)?.Close ();
|
||||
throw GetException (WebExceptionStatus.ConnectFailure, exc);
|
||||
// Something went wrong, but we might have multiple IP Addresses
|
||||
// and need to probe them all.
|
||||
connectException = GetException (WebExceptionStatus.ConnectFailure, exc);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +182,10 @@ namespace System.Net
|
||||
return;
|
||||
}
|
||||
|
||||
throw GetException (WebExceptionStatus.ConnectFailure, null);
|
||||
if (connectException == null)
|
||||
connectException = GetException (WebExceptionStatus.ConnectFailure, null);
|
||||
|
||||
throw connectException;
|
||||
}
|
||||
|
||||
#if MONO_WEB_DEBUG
|
||||
@@ -265,6 +273,8 @@ namespace System.Net
|
||||
goto retry;
|
||||
}
|
||||
|
||||
networkStream.ReadTimeout = operation.Request.ReadWriteTimeout;
|
||||
|
||||
return new WebRequestStream (this, operation, networkStream, tunnel);
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace System.Net
|
||||
return e;
|
||||
}
|
||||
|
||||
public override int Read (byte[] buffer, int offset, int size)
|
||||
public override int Read (byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (!CanRead)
|
||||
throw new NotSupportedException (SR.net_writeonlystream);
|
||||
@@ -127,17 +127,17 @@ namespace System.Net
|
||||
int length = buffer.Length;
|
||||
if (offset < 0 || length < offset)
|
||||
throw new ArgumentOutOfRangeException (nameof (offset));
|
||||
if (size < 0 || (length - offset) < size)
|
||||
throw new ArgumentOutOfRangeException (nameof (size));
|
||||
if (count < 0 || (length - offset) < count)
|
||||
throw new ArgumentOutOfRangeException (nameof (count));
|
||||
|
||||
try {
|
||||
return ReadAsync (buffer, offset, size, CancellationToken.None).Result;
|
||||
return ReadAsync (buffer, offset, count, CancellationToken.None).Result;
|
||||
} catch (Exception e) {
|
||||
throw GetException (e);
|
||||
}
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginRead (byte[] buffer, int offset, int size,
|
||||
public override IAsyncResult BeginRead (byte[] buffer, int offset, int count,
|
||||
AsyncCallback cb, object state)
|
||||
{
|
||||
if (!CanRead)
|
||||
@@ -150,10 +150,10 @@ namespace System.Net
|
||||
int length = buffer.Length;
|
||||
if (offset < 0 || length < offset)
|
||||
throw new ArgumentOutOfRangeException (nameof (offset));
|
||||
if (size < 0 || (length - offset) < size)
|
||||
throw new ArgumentOutOfRangeException (nameof (size));
|
||||
if (count < 0 || (length - offset) < count)
|
||||
throw new ArgumentOutOfRangeException (nameof (count));
|
||||
|
||||
var task = ReadAsync (buffer, offset, size, CancellationToken.None);
|
||||
var task = ReadAsync (buffer, offset, count, CancellationToken.None);
|
||||
return TaskToApm.Begin (task, cb, state);
|
||||
}
|
||||
|
||||
@@ -169,23 +169,23 @@ namespace System.Net
|
||||
}
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int size,
|
||||
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count,
|
||||
AsyncCallback cb, object state)
|
||||
{
|
||||
if (!CanWrite)
|
||||
throw new NotSupportedException (SR.net_readonlystream);
|
||||
Operation.ThrowIfClosedOrDisposed ();
|
||||
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
|
||||
int length = buffer.Length;
|
||||
if (offset < 0 || length < offset)
|
||||
throw new ArgumentOutOfRangeException (nameof (offset));
|
||||
if (size < 0 || (length - offset) < size)
|
||||
throw new ArgumentOutOfRangeException (nameof (size));
|
||||
if (count < 0 || (length - offset) < count)
|
||||
throw new ArgumentOutOfRangeException (nameof (count));
|
||||
|
||||
var task = WriteAsync (buffer, offset, size, CancellationToken.None);
|
||||
if (!CanWrite)
|
||||
throw new NotSupportedException (SR.net_readonlystream);
|
||||
Operation.ThrowIfClosedOrDisposed ();
|
||||
|
||||
var task = WriteAsync (buffer, offset, count, CancellationToken.None);
|
||||
return TaskToApm.Begin (task, cb, state);
|
||||
}
|
||||
|
||||
@@ -201,23 +201,23 @@ namespace System.Net
|
||||
}
|
||||
}
|
||||
|
||||
public override void Write (byte[] buffer, int offset, int size)
|
||||
public override void Write (byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (!CanWrite)
|
||||
throw new NotSupportedException (SR.net_readonlystream);
|
||||
Operation.ThrowIfClosedOrDisposed ();
|
||||
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
|
||||
int length = buffer.Length;
|
||||
if (offset < 0 || length < offset)
|
||||
throw new ArgumentOutOfRangeException (nameof (offset));
|
||||
if (size < 0 || (length - offset) < size)
|
||||
throw new ArgumentOutOfRangeException (nameof (size));
|
||||
if (count < 0 || (length - offset) < count)
|
||||
throw new ArgumentOutOfRangeException (nameof (count));
|
||||
|
||||
if (!CanWrite)
|
||||
throw new NotSupportedException (SR.net_readonlystream);
|
||||
Operation.ThrowIfClosedOrDisposed ();
|
||||
|
||||
try {
|
||||
WriteAsync (buffer, offset, size).Wait ();
|
||||
WriteAsync (buffer, offset, count).Wait ();
|
||||
} catch (Exception e) {
|
||||
throw GetException (e);
|
||||
}
|
||||
@@ -227,6 +227,13 @@ namespace System.Net
|
||||
{
|
||||
}
|
||||
|
||||
public override Task FlushAsync (CancellationToken cancellationToken)
|
||||
{
|
||||
return cancellationToken.IsCancellationRequested ?
|
||||
Task.FromCancellation (cancellationToken) :
|
||||
Task.CompletedTask;
|
||||
}
|
||||
|
||||
internal void InternalClose ()
|
||||
{
|
||||
disposed = true;
|
||||
|
||||
@@ -60,8 +60,10 @@ namespace System.Net
|
||||
#if MONO_WEB_DEBUG
|
||||
static int nextID;
|
||||
internal readonly int ID = ++nextID;
|
||||
string ME => $"WO({ID},{Connection?.ID ?? -1})";
|
||||
#else
|
||||
internal readonly int ID;
|
||||
string ME;
|
||||
#endif
|
||||
|
||||
public WebOperation (HttpWebRequest request, BufferOffsetSize writeBuffer, bool isNtlmChallenge, CancellationToken cancellationToken)
|
||||
@@ -70,26 +72,24 @@ namespace System.Net
|
||||
WriteBuffer = writeBuffer;
|
||||
IsNtlmChallenge = isNtlmChallenge;
|
||||
cts = CancellationTokenSource.CreateLinkedTokenSource (cancellationToken);
|
||||
requestTask = new TaskCompletionSource<WebRequestStream> ();
|
||||
requestWrittenTask = new TaskCompletionSource<WebRequestStream> ();
|
||||
completeResponseReadTask = new TaskCompletionSource<bool> ();
|
||||
responseTask = new TaskCompletionSource<WebResponseStream> ();
|
||||
finishedTask = new TaskCompletionSource<(bool, WebOperation)> ();
|
||||
requestTask = new WebCompletionSource<WebRequestStream> ();
|
||||
requestWrittenTask = new WebCompletionSource<WebRequestStream> ();
|
||||
responseTask = new WebCompletionSource<WebResponseStream> ();
|
||||
finishedTask = new WebCompletionSource<(bool, WebOperation)> ();
|
||||
}
|
||||
|
||||
CancellationTokenSource cts;
|
||||
TaskCompletionSource<WebRequestStream> requestTask;
|
||||
TaskCompletionSource<WebRequestStream> requestWrittenTask;
|
||||
TaskCompletionSource<WebResponseStream> responseTask;
|
||||
TaskCompletionSource<bool> completeResponseReadTask;
|
||||
TaskCompletionSource<(bool, WebOperation)> finishedTask;
|
||||
WebCompletionSource<WebRequestStream> requestTask;
|
||||
WebCompletionSource<WebRequestStream> requestWrittenTask;
|
||||
WebCompletionSource<WebResponseStream> responseTask;
|
||||
WebCompletionSource<(bool, WebOperation)> finishedTask;
|
||||
WebRequestStream writeStream;
|
||||
WebResponseStream responseStream;
|
||||
ExceptionDispatchInfo disposedInfo;
|
||||
ExceptionDispatchInfo closedInfo;
|
||||
WebOperation priorityRequest;
|
||||
volatile bool finishedReading;
|
||||
int requestSent;
|
||||
int finished;
|
||||
|
||||
public bool Aborted {
|
||||
get {
|
||||
@@ -133,18 +133,23 @@ namespace System.Net
|
||||
|
||||
void SetCanceled ()
|
||||
{
|
||||
requestTask.TrySetCanceled ();
|
||||
requestWrittenTask.TrySetCanceled ();
|
||||
responseTask.TrySetCanceled ();
|
||||
completeResponseReadTask.TrySetCanceled ();
|
||||
WebConnection.Debug ($"{ME} SET CANCELED");
|
||||
|
||||
var error = new OperationCanceledException ();
|
||||
requestTask.TrySetCanceled (error);
|
||||
requestWrittenTask.TrySetCanceled (error);
|
||||
responseTask.TrySetCanceled (error);
|
||||
Finish (false, error);
|
||||
}
|
||||
|
||||
void SetError (Exception error)
|
||||
{
|
||||
WebConnection.Debug ($"{ME} SET ERROR: error={error.GetType ().Name}");
|
||||
|
||||
requestTask.TrySetException (error);
|
||||
requestWrittenTask.TrySetException (error);
|
||||
responseTask.TrySetException (error);
|
||||
completeResponseReadTask.TrySetException (error);
|
||||
Finish (false, error);
|
||||
}
|
||||
|
||||
(ExceptionDispatchInfo, bool) SetDisposed (ref ExceptionDispatchInfo field)
|
||||
@@ -155,6 +160,13 @@ namespace System.Net
|
||||
return (old ?? exception, old == null);
|
||||
}
|
||||
|
||||
internal ExceptionDispatchInfo CheckDisposed (CancellationToken cancellationToken)
|
||||
{
|
||||
if (Aborted || cancellationToken.IsCancellationRequested)
|
||||
return CheckThrowDisposed (false, ref disposedInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
internal void ThrowIfDisposed ()
|
||||
{
|
||||
ThrowIfDisposed (CancellationToken.None);
|
||||
@@ -163,7 +175,7 @@ namespace System.Net
|
||||
internal void ThrowIfDisposed (CancellationToken cancellationToken)
|
||||
{
|
||||
if (Aborted || cancellationToken.IsCancellationRequested)
|
||||
ThrowDisposed (ref disposedInfo);
|
||||
CheckThrowDisposed (true, ref disposedInfo);
|
||||
}
|
||||
|
||||
internal void ThrowIfClosedOrDisposed ()
|
||||
@@ -174,15 +186,17 @@ namespace System.Net
|
||||
internal void ThrowIfClosedOrDisposed (CancellationToken cancellationToken)
|
||||
{
|
||||
if (Closed || cancellationToken.IsCancellationRequested)
|
||||
ThrowDisposed (ref closedInfo);
|
||||
CheckThrowDisposed (true, ref closedInfo);
|
||||
}
|
||||
|
||||
void ThrowDisposed (ref ExceptionDispatchInfo field)
|
||||
ExceptionDispatchInfo CheckThrowDisposed (bool throwIt, ref ExceptionDispatchInfo field)
|
||||
{
|
||||
var (exception, disposed) = SetDisposed (ref field);
|
||||
if (disposed)
|
||||
cts?.Cancel ();
|
||||
exception.Throw ();
|
||||
if (throwIt)
|
||||
exception.Throw ();
|
||||
return exception;
|
||||
}
|
||||
|
||||
internal void RegisterRequest (ServicePoint servicePoint, WebConnection connection)
|
||||
@@ -208,21 +222,26 @@ namespace System.Net
|
||||
public void SetPriorityRequest (WebOperation operation)
|
||||
{
|
||||
lock (this) {
|
||||
if (requestSent != 1 || ServicePoint == null || finishedReading)
|
||||
if (requestSent != 1 || ServicePoint == null || finished != 0)
|
||||
throw new InvalidOperationException ("Should never happen.");
|
||||
if (Interlocked.CompareExchange (ref priorityRequest, operation, null) != null)
|
||||
throw new InvalidOperationException ("Invalid nested request.");
|
||||
}
|
||||
}
|
||||
|
||||
public Task<WebRequestStream> GetRequestStream ()
|
||||
public async Task<Stream> GetRequestStream ()
|
||||
{
|
||||
return requestTask.Task;
|
||||
return await requestTask.WaitForCompletion ().ConfigureAwait (false);
|
||||
}
|
||||
|
||||
internal Task<WebRequestStream> GetRequestStreamInternal ()
|
||||
{
|
||||
return requestTask.WaitForCompletion ();
|
||||
}
|
||||
|
||||
public Task WaitUntilRequestWritten ()
|
||||
{
|
||||
return requestWrittenTask.Task;
|
||||
return requestWrittenTask.WaitForCompletion ();
|
||||
}
|
||||
|
||||
public WebRequestStream WriteStream {
|
||||
@@ -234,24 +253,15 @@ namespace System.Net
|
||||
|
||||
public Task<WebResponseStream> GetResponseStream ()
|
||||
{
|
||||
return responseTask.Task;
|
||||
return responseTask.WaitForCompletion ();
|
||||
}
|
||||
|
||||
internal async Task<(bool, WebOperation)> WaitForCompletion (bool ignoreErrors)
|
||||
{
|
||||
try {
|
||||
return await finishedTask.Task.ConfigureAwait (false);
|
||||
} catch {
|
||||
if (ignoreErrors)
|
||||
return (false, null);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
internal WebCompletionSource<(bool, WebOperation)> Finished => finishedTask;
|
||||
|
||||
internal async void Run ()
|
||||
{
|
||||
try {
|
||||
FinishReading ();
|
||||
WebConnection.Debug ($"{ME} RUN");
|
||||
|
||||
ThrowIfClosedOrDisposed ();
|
||||
|
||||
@@ -265,37 +275,51 @@ namespace System.Net
|
||||
|
||||
ThrowIfClosedOrDisposed ();
|
||||
|
||||
requestTask.TrySetResult (requestStream);
|
||||
requestTask.TrySetCompleted (requestStream);
|
||||
|
||||
var stream = new WebResponseStream (requestStream);
|
||||
responseStream = stream;
|
||||
|
||||
await stream.InitReadAsync (cts.Token).ConfigureAwait (false);
|
||||
|
||||
responseTask.TrySetResult (stream);
|
||||
WebConnection.Debug ($"{ME} RUN COMPLETE");
|
||||
|
||||
responseTask.TrySetCompleted (stream);
|
||||
} catch (OperationCanceledException) {
|
||||
WebConnection.Debug ($"{ME} RUN CANCELED");
|
||||
SetCanceled ();
|
||||
} catch (Exception e) {
|
||||
WebConnection.Debug ($"{ME} RUN ERROR: {e.GetType ().Name}");
|
||||
SetError (e);
|
||||
}
|
||||
}
|
||||
|
||||
async void FinishReading ()
|
||||
internal void CompleteRequestWritten (WebRequestStream stream, Exception error = null)
|
||||
{
|
||||
bool ok = false;
|
||||
Exception error = null;
|
||||
WebConnection.Debug ($"{ME} COMPLETE REQUEST WRITTEN: {error != null}");
|
||||
|
||||
try {
|
||||
ok = await completeResponseReadTask.Task.ConfigureAwait (false);
|
||||
} catch (Exception e) {
|
||||
error = e;
|
||||
}
|
||||
if (error != null)
|
||||
SetError (error);
|
||||
else
|
||||
requestWrittenTask.TrySetCompleted (stream);
|
||||
}
|
||||
|
||||
internal void Finish (bool ok, Exception error = null)
|
||||
{
|
||||
if (Interlocked.CompareExchange (ref finished, 1, 0) != 0)
|
||||
return;
|
||||
|
||||
#if MONO_WEB_DEBUG
|
||||
var me = $"{ME} FINISH";
|
||||
#else
|
||||
string me = null;
|
||||
#endif
|
||||
WebConnection.Debug ($"{me}: ok={ok} error={error?.GetType ()}");
|
||||
|
||||
WebResponseStream stream;
|
||||
WebOperation next;
|
||||
|
||||
lock (this) {
|
||||
finishedReading = true;
|
||||
stream = Interlocked.Exchange (ref responseStream, null);
|
||||
next = Interlocked.Exchange (ref priorityRequest, null);
|
||||
Request.FinishedReading = true;
|
||||
@@ -304,11 +328,12 @@ namespace System.Net
|
||||
if (error != null) {
|
||||
if (next != null)
|
||||
next.SetError (error);
|
||||
WebConnection.Debug ($"{me} SET ERROR: {error.GetType ().Name}");
|
||||
finishedTask.TrySetException (error);
|
||||
return;
|
||||
}
|
||||
|
||||
WebConnection.Debug ($"WO FINISH READING: Cnc={Connection?.ID} Op={ID} ok={ok} error={error != null} stream={stream != null} next={next != null}");
|
||||
WebConnection.Debug ($"{me}: ok={ok} stream={stream != null} next={next != null}");
|
||||
|
||||
var keepAlive = !Aborted && ok && (stream?.KeepAlive ?? false);
|
||||
if (next != null && next.Aborted) {
|
||||
@@ -316,29 +341,9 @@ namespace System.Net
|
||||
keepAlive = false;
|
||||
}
|
||||
|
||||
finishedTask.TrySetResult ((keepAlive, next));
|
||||
finishedTask.TrySetCompleted ((keepAlive, next));
|
||||
|
||||
WebConnection.Debug ($"WO FINISH READING DONE: Cnc={Connection.ID} Op={ID} - {keepAlive} next={next?.ID}");
|
||||
}
|
||||
|
||||
internal void CompleteRequestWritten (WebRequestStream stream, Exception error = null)
|
||||
{
|
||||
WebConnection.Debug ($"WO COMPLETE REQUEST WRITTEN: Op={ID} {error != null}");
|
||||
|
||||
if (error != null)
|
||||
SetError (error);
|
||||
else
|
||||
requestWrittenTask.TrySetResult (stream);
|
||||
}
|
||||
|
||||
internal void CompleteResponseRead (bool ok, Exception error = null)
|
||||
{
|
||||
WebConnection.Debug ($"WO COMPLETE RESPONSE READ: Op={ID} {ok} {error?.GetType ()}");
|
||||
|
||||
if (error != null)
|
||||
completeResponseReadTask.TrySetException (error);
|
||||
else
|
||||
completeResponseReadTask.TrySetResult (ok);
|
||||
WebConnection.Debug ($"{me} DONE: {keepAlive} next={next?.ID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
//
|
||||
// WebReadStream.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <[email protected]>
|
||||
//
|
||||
// Copyright (c) 2018 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;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
abstract class WebReadStream : Stream
|
||||
{
|
||||
public WebOperation Operation {
|
||||
get;
|
||||
}
|
||||
|
||||
protected Stream InnerStream {
|
||||
get;
|
||||
}
|
||||
|
||||
public WebReadStream (WebOperation operation, Stream innerStream)
|
||||
{
|
||||
Operation = operation;
|
||||
InnerStream = innerStream;
|
||||
}
|
||||
|
||||
Exception NotSupported => new NotSupportedException ();
|
||||
|
||||
public override long Length => throw NotSupported;
|
||||
|
||||
public override long Position {
|
||||
get => throw NotSupported;
|
||||
set => throw NotSupported;
|
||||
}
|
||||
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void SetLength (long value)
|
||||
{
|
||||
throw NotSupported;
|
||||
}
|
||||
|
||||
public override long Seek (long offset, SeekOrigin origin)
|
||||
{
|
||||
throw NotSupported;
|
||||
}
|
||||
|
||||
public override void Write (byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw NotSupported;
|
||||
}
|
||||
|
||||
public override void Flush ()
|
||||
{
|
||||
throw NotSupported;
|
||||
}
|
||||
|
||||
protected Exception GetException (Exception e)
|
||||
{
|
||||
e = HttpWebRequest.FlattenException (e);
|
||||
if (e is WebException)
|
||||
return e;
|
||||
if (Operation.Aborted || e is OperationCanceledException || e is ObjectDisposedException)
|
||||
return HttpWebRequest.CreateRequestAbortedException ();
|
||||
return e;
|
||||
}
|
||||
|
||||
public override int Read (byte[] buffer, int offset, int size)
|
||||
{
|
||||
if (!CanRead)
|
||||
throw new NotSupportedException (SR.net_writeonlystream);
|
||||
Operation.ThrowIfClosedOrDisposed ();
|
||||
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
|
||||
int length = buffer.Length;
|
||||
if (offset < 0 || length < offset)
|
||||
throw new ArgumentOutOfRangeException (nameof (offset));
|
||||
if (size < 0 || (length - offset) < size)
|
||||
throw new ArgumentOutOfRangeException (nameof (size));
|
||||
|
||||
try {
|
||||
return ReadAsync (buffer, offset, size, CancellationToken.None).Result;
|
||||
} catch (Exception e) {
|
||||
throw GetException (e);
|
||||
}
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginRead (byte[] buffer, int offset, int size,
|
||||
AsyncCallback cb, object state)
|
||||
{
|
||||
if (!CanRead)
|
||||
throw new NotSupportedException (SR.net_writeonlystream);
|
||||
Operation.ThrowIfClosedOrDisposed ();
|
||||
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
|
||||
int length = buffer.Length;
|
||||
if (offset < 0 || length < offset)
|
||||
throw new ArgumentOutOfRangeException (nameof (offset));
|
||||
if (size < 0 || (length - offset) < size)
|
||||
throw new ArgumentOutOfRangeException (nameof (size));
|
||||
|
||||
var task = ReadAsync (buffer, offset, size, CancellationToken.None);
|
||||
return TaskToApm.Begin (task, cb, state);
|
||||
}
|
||||
|
||||
public override int EndRead (IAsyncResult r)
|
||||
{
|
||||
if (r == null)
|
||||
throw new ArgumentNullException (nameof (r));
|
||||
|
||||
try {
|
||||
return TaskToApm.End<int> (r);
|
||||
} catch (Exception e) {
|
||||
throw GetException (e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace System.Net
|
||||
bool requestWritten;
|
||||
bool allowBuffering;
|
||||
bool sendChunked;
|
||||
TaskCompletionSource<int> pendingWrite;
|
||||
WebCompletionSource pendingWrite;
|
||||
long totalWritten;
|
||||
byte[] headers;
|
||||
bool headersSent;
|
||||
@@ -131,28 +131,38 @@ namespace System.Net
|
||||
Operation.CompleteRequestWritten (this);
|
||||
}
|
||||
|
||||
public override async Task WriteAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
|
||||
public override Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
|
||||
{
|
||||
WebConnection.Debug ($"{ME} WRITE ASYNC: {buffer.Length}/{offset}/{size}");
|
||||
|
||||
Operation.ThrowIfClosedOrDisposed (cancellationToken);
|
||||
|
||||
if (Operation.WriteBuffer != null)
|
||||
throw new InvalidOperationException ();
|
||||
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
|
||||
int length = buffer.Length;
|
||||
if (offset < 0 || length < offset)
|
||||
throw new ArgumentOutOfRangeException (nameof (offset));
|
||||
if (size < 0 || (length - offset) < size)
|
||||
throw new ArgumentOutOfRangeException (nameof (size));
|
||||
if (count < 0 || (length - offset) < count)
|
||||
throw new ArgumentOutOfRangeException (nameof (count));
|
||||
|
||||
var myWriteTcs = new TaskCompletionSource<int> ();
|
||||
if (Interlocked.CompareExchange (ref pendingWrite, myWriteTcs, null) != null)
|
||||
WebConnection.Debug ($"{ME} WRITE ASYNC: {buffer.Length}/{offset}/{count}");
|
||||
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
return Task.FromCanceled (cancellationToken);
|
||||
|
||||
Operation.ThrowIfClosedOrDisposed (cancellationToken);
|
||||
|
||||
if (Operation.WriteBuffer != null)
|
||||
throw new InvalidOperationException ();
|
||||
|
||||
var completion = new WebCompletionSource ();
|
||||
if (Interlocked.CompareExchange (ref pendingWrite, completion, null) != null)
|
||||
throw new InvalidOperationException (SR.GetString (SR.net_repcall));
|
||||
|
||||
return WriteAsyncInner (buffer, offset, count, completion, cancellationToken);
|
||||
}
|
||||
|
||||
async Task WriteAsyncInner (byte[] buffer, int offset, int size,
|
||||
WebCompletionSource completion,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
try {
|
||||
await ProcessWrite (buffer, offset, size, cancellationToken).ConfigureAwait (false);
|
||||
|
||||
@@ -162,20 +172,26 @@ namespace System.Net
|
||||
await FinishWriting (cancellationToken);
|
||||
|
||||
pendingWrite = null;
|
||||
myWriteTcs.TrySetResult (0);
|
||||
completion.TrySetCompleted ();
|
||||
} catch (Exception ex) {
|
||||
KillBuffer ();
|
||||
closed = true;
|
||||
|
||||
WebConnection.Debug ($"{ME} WRITE ASYNC EX: {ex.Message}");
|
||||
|
||||
if (ex is SocketException)
|
||||
var oldError = Operation.CheckDisposed (cancellationToken);
|
||||
if (oldError != null)
|
||||
ex = oldError.SourceException;
|
||||
else if (ex is SocketException)
|
||||
ex = new IOException ("Error writing request", ex);
|
||||
|
||||
Operation.CompleteRequestWritten (this, ex);
|
||||
|
||||
pendingWrite = null;
|
||||
myWriteTcs.TrySetException (ex);
|
||||
completion.TrySetException (ex);
|
||||
|
||||
if (oldError != null)
|
||||
oldError.Throw ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@@ -227,12 +243,7 @@ namespace System.Net
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await InnerStream.WriteAsync (buffer, offset, size, cancellationToken).ConfigureAwait (false);
|
||||
} catch {
|
||||
if (!IgnoreIOErrors)
|
||||
throw;
|
||||
}
|
||||
await InnerStream.WriteAsync (buffer, offset, size, cancellationToken).ConfigureAwait (false);
|
||||
}
|
||||
|
||||
void CheckWriteOverflow (long contentLength, long totalWritten, long size)
|
||||
@@ -360,26 +371,28 @@ namespace System.Net
|
||||
|
||||
async Task WriteChunkTrailer ()
|
||||
{
|
||||
using (var cts = new CancellationTokenSource ()) {
|
||||
var cts = new CancellationTokenSource ();
|
||||
try {
|
||||
cts.CancelAfter (WriteTimeout);
|
||||
var timeoutTask = Task.Delay (WriteTimeout);
|
||||
var timeoutTask = Task.Delay (WriteTimeout, cts.Token);
|
||||
while (true) {
|
||||
var myWriteTcs = new TaskCompletionSource<int> ();
|
||||
var oldTcs = Interlocked.CompareExchange (ref pendingWrite, myWriteTcs, null);
|
||||
if (oldTcs == null)
|
||||
var completion = new WebCompletionSource ();
|
||||
var oldCompletion = Interlocked.CompareExchange (ref pendingWrite, completion, null);
|
||||
if (oldCompletion == null)
|
||||
break;
|
||||
var ret = await Task.WhenAny (timeoutTask, oldTcs.Task).ConfigureAwait (false);
|
||||
var oldWriteTask = oldCompletion.WaitForCompletion ();
|
||||
var ret = await Task.WhenAny (timeoutTask, oldWriteTask).ConfigureAwait (false);
|
||||
if (ret == timeoutTask)
|
||||
throw new WebException ("The operation has timed out.", WebExceptionStatus.Timeout);
|
||||
}
|
||||
|
||||
try {
|
||||
await WriteChunkTrailer_inner (cts.Token).ConfigureAwait (false);
|
||||
} catch {
|
||||
// Intentionally eating exceptions.
|
||||
} finally {
|
||||
pendingWrite = null;
|
||||
}
|
||||
await WriteChunkTrailer_inner (cts.Token).ConfigureAwait (false);
|
||||
} catch {
|
||||
// Intentionally eating exceptions.
|
||||
} finally {
|
||||
pendingWrite = null;
|
||||
cts.Cancel ();
|
||||
cts.Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -37,12 +36,12 @@ namespace System.Net
|
||||
{
|
||||
class WebResponseStream : WebConnectionStream
|
||||
{
|
||||
Stream innerStreamWrapper;
|
||||
BufferOffsetSize readBuffer;
|
||||
long contentLength;
|
||||
long totalRead;
|
||||
bool nextReadCalled;
|
||||
int stream_length; // -1 when CL not present
|
||||
TaskCompletionSource<int> readTcs;
|
||||
WebCompletionSource pendingRead;
|
||||
object locker = new object ();
|
||||
int nestedRead;
|
||||
bool read_eof;
|
||||
@@ -82,7 +81,6 @@ namespace System.Net
|
||||
: base (request.Connection, request.Operation, request.InnerStream)
|
||||
{
|
||||
RequestStream = request;
|
||||
request.InnerStream.ReadTimeout = ReadTimeout;
|
||||
|
||||
#if MONO_WEB_DEBUG
|
||||
ME = $"WRP(Cnc={Connection.ID}, Op={Operation.ID})";
|
||||
@@ -99,11 +97,17 @@ namespace System.Net
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
||||
bool ChunkedRead {
|
||||
get; set;
|
||||
protected bool ChunkedRead {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public override async Task<int> ReadAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
|
||||
protected MonoChunkStream ChunkStream {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public override async Task<int> ReadAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
|
||||
{
|
||||
WebConnection.Debug ($"{ME} READ ASYNC");
|
||||
|
||||
@@ -115,33 +119,33 @@ namespace System.Net
|
||||
int length = buffer.Length;
|
||||
if (offset < 0 || length < offset)
|
||||
throw new ArgumentOutOfRangeException (nameof (offset));
|
||||
if (size < 0 || (length - offset) < size)
|
||||
throw new ArgumentOutOfRangeException (nameof (size));
|
||||
if (count < 0 || (length - offset) < count)
|
||||
throw new ArgumentOutOfRangeException (nameof (count));
|
||||
|
||||
if (Interlocked.CompareExchange (ref nestedRead, 1, 0) != 0)
|
||||
throw new InvalidOperationException ("Invalid nested call.");
|
||||
|
||||
var myReadTcs = new TaskCompletionSource<int> ();
|
||||
var completion = new WebCompletionSource ();
|
||||
while (!cancellationToken.IsCancellationRequested) {
|
||||
/*
|
||||
* 'readTcs' is set by ReadAllAsync().
|
||||
* 'currentRead' is set by ReadAllAsync().
|
||||
*/
|
||||
var oldReadTcs = Interlocked.CompareExchange (ref readTcs, myReadTcs, null);
|
||||
WebConnection.Debug ($"{ME} READ ASYNC #1: {oldReadTcs != null}");
|
||||
if (oldReadTcs == null)
|
||||
var oldCompletion = Interlocked.CompareExchange (ref pendingRead, completion, null);
|
||||
WebConnection.Debug ($"{ME} READ ASYNC #1: {oldCompletion != null}");
|
||||
if (oldCompletion == null)
|
||||
break;
|
||||
await oldReadTcs.Task.ConfigureAwait (false);
|
||||
await oldCompletion.WaitForCompletion ().ConfigureAwait (false);
|
||||
}
|
||||
|
||||
WebConnection.Debug ($"{ME} READ ASYNC #2: {totalRead} {contentLength}");
|
||||
|
||||
int nbytes = 0;
|
||||
int oldBytes = 0, nbytes = 0;
|
||||
Exception throwMe = null;
|
||||
|
||||
try {
|
||||
// FIXME: NetworkStream.ReadAsync() does not support cancellation.
|
||||
nbytes = await HttpWebRequest.RunWithTimeout (
|
||||
ct => ProcessRead (buffer, offset, size, ct),
|
||||
(oldBytes, nbytes) = await HttpWebRequest.RunWithTimeout (
|
||||
ct => ProcessRead (buffer, offset, count, ct),
|
||||
ReadTimeout, () => {
|
||||
Operation.Abort ();
|
||||
InnerStream.Dispose ();
|
||||
@@ -150,80 +154,148 @@ namespace System.Net
|
||||
throwMe = GetReadException (WebExceptionStatus.ReceiveFailure, e, "ReadAsync");
|
||||
}
|
||||
|
||||
WebConnection.Debug ($"{ME} READ ASYNC #3: {totalRead} {contentLength} - {nbytes} {throwMe?.Message}");
|
||||
WebConnection.Debug ($"{ME} READ ASYNC #3: {totalRead} {contentLength} - {oldBytes} {nbytes} {throwMe?.Message}");
|
||||
|
||||
if (throwMe != null) {
|
||||
lock (locker) {
|
||||
myReadTcs.TrySetException (throwMe);
|
||||
readTcs = null;
|
||||
completion.TrySetException (throwMe);
|
||||
pendingRead = null;
|
||||
nestedRead = 0;
|
||||
}
|
||||
|
||||
closed = true;
|
||||
Operation.CompleteResponseRead (false, throwMe);
|
||||
Operation.Finish (false, throwMe);
|
||||
throw throwMe;
|
||||
}
|
||||
|
||||
lock (locker) {
|
||||
readTcs.TrySetResult (nbytes);
|
||||
readTcs = null;
|
||||
pendingRead.TrySetCompleted ();
|
||||
pendingRead = null;
|
||||
nestedRead = 0;
|
||||
}
|
||||
|
||||
if (totalRead >= contentLength && !nextReadCalled) {
|
||||
WebConnection.Debug ($"{ME} READ ASYNC - READ COMPLETE: {nbytes} - {totalRead} {contentLength} {nextReadCalled}");
|
||||
WebConnection.Debug ($"{ME} READ ASYNC - READ COMPLETE: {oldBytes} {nbytes} - {totalRead} {contentLength} {nextReadCalled}");
|
||||
if (!nextReadCalled) {
|
||||
nextReadCalled = true;
|
||||
Operation.CompleteResponseRead (true);
|
||||
Operation.Finish (true);
|
||||
}
|
||||
}
|
||||
|
||||
return nbytes;
|
||||
return oldBytes + nbytes;
|
||||
}
|
||||
|
||||
async Task<int> ProcessRead (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
|
||||
async Task<(int, int)> ProcessRead (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
|
||||
{
|
||||
WebConnection.Debug ($"{ME} PROCESS READ: {totalRead} {contentLength}");
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested ();
|
||||
if (read_eof || totalRead >= contentLength) {
|
||||
if (totalRead >= contentLength) {
|
||||
read_eof = true;
|
||||
contentLength = totalRead;
|
||||
return 0;
|
||||
return (0, 0);
|
||||
}
|
||||
|
||||
int oldBytes = 0;
|
||||
int remaining = readBuffer?.Size ?? 0;
|
||||
if (remaining > 0) {
|
||||
int copy = (remaining > size) ? size : remaining;
|
||||
Buffer.BlockCopy (readBuffer.Buffer, readBuffer.Offset, buffer, offset, copy);
|
||||
readBuffer.Offset += copy;
|
||||
readBuffer.Size -= copy;
|
||||
offset += copy;
|
||||
size -= copy;
|
||||
totalRead += copy;
|
||||
if (totalRead >= contentLength) {
|
||||
contentLength = totalRead;
|
||||
read_eof = true;
|
||||
}
|
||||
if (size == 0 || totalRead >= contentLength)
|
||||
return (0, copy);
|
||||
oldBytes = copy;
|
||||
}
|
||||
|
||||
if (contentLength != Int64.MaxValue && contentLength - totalRead < size)
|
||||
size = (int)(contentLength - totalRead);
|
||||
|
||||
WebConnection.Debug ($"{ME} PROCESS READ #1: {size} {read_eof}");
|
||||
WebConnection.Debug ($"{ME} PROCESS READ #1: {oldBytes} {size} {read_eof}");
|
||||
|
||||
if (read_eof) {
|
||||
contentLength = totalRead;
|
||||
return (oldBytes, 0);
|
||||
}
|
||||
|
||||
var ret = await InnerReadAsync (buffer, offset, size, cancellationToken).ConfigureAwait (false);
|
||||
|
||||
if (ret <= 0) {
|
||||
read_eof = true;
|
||||
contentLength = totalRead;
|
||||
return ret;
|
||||
return (oldBytes, 0);
|
||||
}
|
||||
|
||||
totalRead += ret;
|
||||
return ret;
|
||||
return (oldBytes, ret);
|
||||
}
|
||||
|
||||
async Task<int> InnerReadAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
|
||||
internal async Task<int> InnerReadAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
|
||||
{
|
||||
WebConnection.Debug ($"{ME} INNER READ ASYNC");
|
||||
|
||||
Operation.ThrowIfDisposed (cancellationToken);
|
||||
|
||||
WebConnection.Debug ($"{ME} INNER READ ASYNC: stream={innerStreamWrapper}");
|
||||
int nbytes = 0;
|
||||
bool done = false;
|
||||
|
||||
if (!ChunkedRead || (!ChunkStream.DataAvailable && ChunkStream.WantMore)) {
|
||||
nbytes = await InnerStream.ReadAsync (buffer, offset, size, cancellationToken).ConfigureAwait (false);
|
||||
WebConnection.Debug ($"{ME} INNER READ ASYNC #1: {nbytes} {ChunkedRead}");
|
||||
if (!ChunkedRead)
|
||||
return nbytes;
|
||||
done = nbytes == 0;
|
||||
}
|
||||
|
||||
try {
|
||||
var ret = await innerStreamWrapper.ReadAsync (
|
||||
buffer, offset, size, cancellationToken).ConfigureAwait (false);
|
||||
WebConnection.Debug ($"{ME} INNER READ ASYNC DONE: {ret}");
|
||||
return ret;
|
||||
} catch (Exception ex) {
|
||||
WebConnection.Debug ($"{ME} INNER READ ASYNC EX: {ex.Message}");
|
||||
throw;
|
||||
ChunkStream.WriteAndReadBack (buffer, offset, size, ref nbytes);
|
||||
WebConnection.Debug ($"{ME} INNER READ ASYNC #1: {done} {nbytes} {ChunkStream.WantMore}");
|
||||
if (!done && nbytes == 0 && ChunkStream.WantMore)
|
||||
nbytes = await EnsureReadAsync (buffer, offset, size, cancellationToken).ConfigureAwait (false);
|
||||
} catch (Exception e) {
|
||||
if (e is WebException || e is OperationCanceledException)
|
||||
throw;
|
||||
throw new WebException ("Invalid chunked data.", e, WebExceptionStatus.ServerProtocolViolation, null);
|
||||
}
|
||||
|
||||
if ((done || nbytes == 0) && ChunkStream.ChunkLeft != 0) {
|
||||
// HandleError (WebExceptionStatus.ReceiveFailure, null, "chunked EndRead");
|
||||
throw new WebException ("Read error", null, WebExceptionStatus.ReceiveFailure, null);
|
||||
}
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
async Task<int> EnsureReadAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
|
||||
{
|
||||
byte[] morebytes = null;
|
||||
int nbytes = 0;
|
||||
while (nbytes == 0 && ChunkStream.WantMore && !cancellationToken.IsCancellationRequested) {
|
||||
int localsize = ChunkStream.ChunkLeft;
|
||||
if (localsize <= 0) // not read chunk size yet
|
||||
localsize = 1024;
|
||||
else if (localsize > 16384)
|
||||
localsize = 16384;
|
||||
|
||||
if (morebytes == null || morebytes.Length < localsize)
|
||||
morebytes = new byte[localsize];
|
||||
|
||||
int nread = await InnerStream.ReadAsync (morebytes, 0, localsize, cancellationToken).ConfigureAwait (false);
|
||||
if (nread <= 0)
|
||||
return 0; // Error
|
||||
|
||||
ChunkStream.Write (morebytes, 0, nread);
|
||||
nbytes += ChunkStream.Read (buffer, offset + nbytes, size - nbytes);
|
||||
}
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
bool CheckAuthHeader (string headerName)
|
||||
@@ -248,7 +320,7 @@ namespace System.Net
|
||||
}
|
||||
}
|
||||
|
||||
void Initialize (BufferOffsetSize buffer)
|
||||
async Task Initialize (BufferOffsetSize buffer, CancellationToken cancellationToken)
|
||||
{
|
||||
WebConnection.Debug ($"{ME} INIT: status={(int)StatusCode} bos={buffer.Offset}/{buffer.Size}");
|
||||
|
||||
@@ -277,28 +349,35 @@ namespace System.Net
|
||||
if (!Int32.TryParse (clength, out stream_length))
|
||||
stream_length = -1;
|
||||
|
||||
string me = "WebResponseStream.Initialize()";
|
||||
string tencoding = null;
|
||||
if (ExpectContent)
|
||||
tencoding = Headers["Transfer-Encoding"];
|
||||
|
||||
ChunkedRead = (tencoding != null && tencoding.IndexOf ("chunked", StringComparison.OrdinalIgnoreCase) != -1);
|
||||
|
||||
if (ChunkedRead) {
|
||||
innerStreamWrapper = new MonoChunkStream (
|
||||
Operation, CreateStreamWrapper (buffer), Headers);
|
||||
} else if (!IsNtlmAuth () && contentLength > 0 && buffer.Size >= contentLength) {
|
||||
innerStreamWrapper = new BufferedReadStream (Operation, null, buffer);
|
||||
if (!ChunkedRead) {
|
||||
readBuffer = buffer;
|
||||
try {
|
||||
if (contentLength > 0 && readBuffer.Size >= contentLength) {
|
||||
if (!IsNtlmAuth ())
|
||||
await ReadAllAsync (false, cancellationToken).ConfigureAwait (false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw GetReadException (WebExceptionStatus.ReceiveFailure, e, me);
|
||||
}
|
||||
} else if (ChunkStream == null) {
|
||||
try {
|
||||
ChunkStream = new MonoChunkStream (buffer.Buffer, buffer.Offset, buffer.Offset + buffer.Size, Headers);
|
||||
} catch (Exception e) {
|
||||
throw GetReadException (WebExceptionStatus.ServerProtocolViolation, e, me);
|
||||
}
|
||||
} else {
|
||||
innerStreamWrapper = CreateStreamWrapper (buffer);
|
||||
}
|
||||
|
||||
string content_encoding = Headers["Content-Encoding"];
|
||||
if (content_encoding == "gzip" && (Request.AutomaticDecompression & DecompressionMethods.GZip) != 0) {
|
||||
innerStreamWrapper = new GZipStream (innerStreamWrapper, CompressionMode.Decompress);
|
||||
Headers.Remove (HttpRequestHeader.ContentEncoding);
|
||||
} else if (content_encoding == "deflate" && (Request.AutomaticDecompression & DecompressionMethods.Deflate) != 0) {
|
||||
innerStreamWrapper = new DeflateStream (innerStreamWrapper, CompressionMode.Decompress);
|
||||
Headers.Remove (HttpRequestHeader.ContentEncoding);
|
||||
ChunkStream.ResetBuffer ();
|
||||
try {
|
||||
ChunkStream.Write (buffer.Buffer, buffer.Offset, buffer.Size);
|
||||
} catch (Exception e) {
|
||||
throw GetReadException (WebExceptionStatus.ServerProtocolViolation, e, me);
|
||||
}
|
||||
}
|
||||
|
||||
WebConnection.Debug ($"{ME} INIT #1: - {ExpectContent} {closed} {nextReadCalled}");
|
||||
@@ -309,17 +388,10 @@ namespace System.Net
|
||||
contentLength = 0;
|
||||
nextReadCalled = true;
|
||||
}
|
||||
Operation.CompleteResponseRead (true);
|
||||
Operation.Finish (true);
|
||||
}
|
||||
}
|
||||
|
||||
Stream CreateStreamWrapper (BufferOffsetSize buffer)
|
||||
{
|
||||
if (buffer == null || buffer.Size == 0)
|
||||
return InnerStream;
|
||||
return new BufferedReadStream (Operation, InnerStream, buffer);
|
||||
}
|
||||
|
||||
internal async Task ReadAllAsync (bool resending, CancellationToken cancellationToken)
|
||||
{
|
||||
WebConnection.Debug ($"{ME} READ ALL ASYNC: resending={resending} eof={read_eof} total={totalRead} " +
|
||||
@@ -327,26 +399,33 @@ namespace System.Net
|
||||
if (read_eof || totalRead >= contentLength || nextReadCalled) {
|
||||
if (!nextReadCalled) {
|
||||
nextReadCalled = true;
|
||||
Operation.CompleteResponseRead (true);
|
||||
Operation.Finish (true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var timeoutTask = Task.Delay (ReadTimeout);
|
||||
var myReadTcs = new TaskCompletionSource<int> ();
|
||||
while (true) {
|
||||
/*
|
||||
* 'readTcs' is set by ReadAsync().
|
||||
*/
|
||||
cancellationToken.ThrowIfCancellationRequested ();
|
||||
var oldReadTcs = Interlocked.CompareExchange (ref readTcs, myReadTcs, null);
|
||||
if (oldReadTcs == null)
|
||||
break;
|
||||
var completion = new WebCompletionSource ();
|
||||
var timeoutCts = new CancellationTokenSource ();
|
||||
try {
|
||||
var timeoutTask = Task.Delay (ReadTimeout, timeoutCts.Token);
|
||||
while (true) {
|
||||
/*
|
||||
* 'currentRead' is set by ReadAsync().
|
||||
*/
|
||||
cancellationToken.ThrowIfCancellationRequested ();
|
||||
var oldCompletion = Interlocked.CompareExchange (ref pendingRead, completion, null);
|
||||
if (oldCompletion == null)
|
||||
break;
|
||||
|
||||
// ReadAsync() is in progress.
|
||||
var anyTask = await Task.WhenAny (oldReadTcs.Task, timeoutTask).ConfigureAwait (false);
|
||||
if (anyTask == timeoutTask)
|
||||
throw new WebException ("The operation has timed out.", WebExceptionStatus.Timeout);
|
||||
// ReadAsync() is in progress.
|
||||
var oldReadTask = oldCompletion.WaitForCompletion ();
|
||||
var anyTask = await Task.WhenAny (oldReadTask, timeoutTask).ConfigureAwait (false);
|
||||
if (anyTask == timeoutTask)
|
||||
throw new WebException ("The operation has timed out.", WebExceptionStatus.Timeout);
|
||||
}
|
||||
} finally {
|
||||
timeoutCts.Cancel ();
|
||||
timeoutCts.Dispose ();
|
||||
}
|
||||
|
||||
WebConnection.Debug ($"{ME} READ ALL ASYNC #1");
|
||||
@@ -357,6 +436,7 @@ namespace System.Net
|
||||
if (totalRead >= contentLength)
|
||||
return;
|
||||
|
||||
byte[] b = null;
|
||||
int new_size;
|
||||
|
||||
if (contentLength == Int64.MaxValue && !ChunkedRead) {
|
||||
@@ -377,10 +457,19 @@ namespace System.Net
|
||||
KeepAlive = false;
|
||||
}
|
||||
|
||||
BufferOffsetSize bos;
|
||||
if (contentLength == Int64.MaxValue) {
|
||||
var ms = new MemoryStream ();
|
||||
var buffer = new BufferOffsetSize (new byte[8192], false);
|
||||
MemoryStream ms = new MemoryStream ();
|
||||
BufferOffsetSize buffer = null;
|
||||
if (readBuffer != null && readBuffer.Size > 0) {
|
||||
ms.Write (readBuffer.Buffer, readBuffer.Offset, readBuffer.Size);
|
||||
readBuffer.Offset = 0;
|
||||
readBuffer.Size = readBuffer.Buffer.Length;
|
||||
if (readBuffer.Buffer.Length >= 8192)
|
||||
buffer = readBuffer;
|
||||
}
|
||||
|
||||
if (buffer == null)
|
||||
buffer = new BufferOffsetSize (new byte[8192], false);
|
||||
|
||||
int read;
|
||||
while ((read = await InnerReadAsync (buffer.Buffer, buffer.Offset, buffer.Size, cancellationToken)) != 0)
|
||||
@@ -388,39 +477,45 @@ namespace System.Net
|
||||
|
||||
new_size = (int)ms.Length;
|
||||
contentLength = new_size;
|
||||
bos = new BufferOffsetSize (ms.GetBuffer (), 0, new_size, false);
|
||||
readBuffer = new BufferOffsetSize (ms.GetBuffer (), 0, new_size, false);
|
||||
} else {
|
||||
new_size = (int)(contentLength - totalRead);
|
||||
var b = new byte[new_size];
|
||||
b = new byte[new_size];
|
||||
int readSize = 0;
|
||||
int remaining = new_size;
|
||||
if (readBuffer != null && readBuffer.Size > 0) {
|
||||
readSize = readBuffer.Size;
|
||||
if (readSize > new_size)
|
||||
readSize = new_size;
|
||||
|
||||
Buffer.BlockCopy (readBuffer.Buffer, readBuffer.Offset, b, 0, readSize);
|
||||
}
|
||||
|
||||
int remaining = new_size - readSize;
|
||||
int r = -1;
|
||||
while (remaining > 0 && r != 0) {
|
||||
r = await InnerReadAsync (b, readSize, remaining, cancellationToken).ConfigureAwait (false);
|
||||
r = await InnerReadAsync (b, readSize, remaining, cancellationToken);
|
||||
remaining -= r;
|
||||
readSize += r;
|
||||
}
|
||||
bos = new BufferOffsetSize (b, 0, new_size, false);
|
||||
}
|
||||
|
||||
innerStreamWrapper = new BufferedReadStream (Operation, null, bos);
|
||||
|
||||
readBuffer = new BufferOffsetSize (b, 0, new_size, false);
|
||||
totalRead = 0;
|
||||
nextReadCalled = true;
|
||||
myReadTcs.TrySetResult (new_size);
|
||||
completion.TrySetCompleted ();
|
||||
} catch (Exception ex) {
|
||||
WebConnection.Debug ($"{ME} READ ALL ASYNC EX: {ex.Message}");
|
||||
myReadTcs.TrySetException (ex);
|
||||
completion.TrySetException (ex);
|
||||
throw;
|
||||
} finally {
|
||||
WebConnection.Debug ($"{ME} READ ALL ASYNC #2");
|
||||
readTcs = null;
|
||||
pendingRead = null;
|
||||
}
|
||||
|
||||
Operation.CompleteResponseRead (true);
|
||||
Operation.Finish (true);
|
||||
}
|
||||
|
||||
public override Task WriteAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
|
||||
public override Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromException (new NotSupportedException (SR.net_readonlystream));
|
||||
}
|
||||
@@ -432,12 +527,12 @@ namespace System.Net
|
||||
nextReadCalled = true;
|
||||
if (totalRead >= contentLength) {
|
||||
disposed = true;
|
||||
Operation.CompleteResponseRead (true);
|
||||
Operation.Finish (true);
|
||||
} else {
|
||||
// If we have not read all the contents
|
||||
closed = true;
|
||||
disposed = true;
|
||||
Operation.CompleteResponseRead (false);
|
||||
Operation.Finish (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -516,7 +611,8 @@ namespace System.Net
|
||||
WebConnection.Debug ($"{ME} INIT READ ASYNC LOOP DONE: {buffer.Offset} {buffer.Size}");
|
||||
|
||||
try {
|
||||
Initialize (buffer);
|
||||
Operation.ThrowIfDisposed (cancellationToken);
|
||||
await Initialize (buffer, cancellationToken).ConfigureAwait (false);
|
||||
} catch (Exception e) {
|
||||
throw GetReadException (WebExceptionStatus.ReceiveFailure, e, "ReadDoneAsync6");
|
||||
}
|
||||
@@ -637,5 +733,7 @@ namespace System.Net
|
||||
|
||||
throw GetReadException (WebExceptionStatus.ServerProtocolViolation, null, "GetResponse");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ System/RemoteExecutorTests.cs
|
||||
../../../external/corefx/src/Common/tests/System/Net/Configuration.cs
|
||||
../../../external/corefx/src/Common/tests/System/Net/Configuration.Http.cs
|
||||
../../../external/corefx/src/Common/tests/System/Net/Configuration.Certificates.cs
|
||||
#../../../external/corefx/src/System.Net.Requests/tests/*.cs
|
||||
#../../../external/corefx/src/System.Net.Requests/tests/*.cs:AuthenticationManagerTest.cs,FtpWebRequestTest.cs
|
||||
|
||||
# System.Net.WebHeaderCollection
|
||||
#../../../external/corefx/src/System.Net.WebHeaderCollection/tests/*.cs
|
||||
@@ -34,13 +34,13 @@ System/RemoteExecutorTests.cs
|
||||
#../../../external/corefx/src/System.Net.NameResolution/tests/FunctionalTests/*.cs
|
||||
|
||||
# System.Net.WebClient
|
||||
../../../external/corefx/src/System.Net.WebClient/tests/*.cs
|
||||
../../../external/corefx/src/System.Net.WebClient/tests/*.cs:WebClientTest.cs
|
||||
|
||||
# System.Net.Security
|
||||
../../../external/corefx/src/Common/tests/System/Net/SslProtocolSupport.cs
|
||||
#../../../external/corefx/src/System.Net.Security/tests/UnitTests/*.cs:TlsAlertsMatchWindowsInterop.cs
|
||||
#../../../external/corefx/src/System.Net.Security/tests/UnitTests/System/Security/Authentication/ExtendedProtection/*.cs
|
||||
../../../external/corefx/src/System.Net.Security/tests/UnitTests/Fakes/*.cs:FakeSslState.cs,FakeLazyAsyncResult.cs
|
||||
#../../../external/corefx/src/System.Net.Security/tests/UnitTests/Fakes/*.cs:FakeSslState.cs,FakeLazyAsyncResult.cs
|
||||
../../../external/corefx/src/Common/src/System/Net/Logging/NetEventSource.Common.cs
|
||||
../../../external/corefx/src/Common/src/System/Net/InternalException.cs
|
||||
../../../external/corefx/src/System.Net.Security/src/System/Net/Security/TlsAlertMessage.cs
|
||||
@@ -53,7 +53,7 @@ System/RemoteExecutorTests.cs
|
||||
#../../../external/corefx/src/System.Net.Ping/tests/FunctionalTests/*.cs
|
||||
|
||||
# System.Net.WebSockets
|
||||
../../../external/corefx/src/System.Net.WebSockets/tests/*.cs
|
||||
#../../../external/corefx/src/System.Net.WebSockets/tests/*.cs
|
||||
|
||||
# System.Net.WebProxy
|
||||
#../../../external/corefx/src/System.Net.WebProxy/tests/*.cs
|
||||
|
||||
@@ -163,6 +163,7 @@ namespace MonoTests.System.Net.Sockets
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
[Ignore ("https://github.com/mono/mono/issues/6513")] // frequently fails on ARM
|
||||
public void AcceptBlockingStatus()
|
||||
{
|
||||
bool block;
|
||||
@@ -253,12 +254,11 @@ namespace MonoTests.System.Net.Sockets
|
||||
{
|
||||
Socket srv = CreateServer (NetworkHelpers.FindFreePort ());
|
||||
ClientSocket clnt = new ClientSocket (srv.LocalEndPoint);
|
||||
Thread th = new Thread (new ThreadStart (clnt.ConnectSleepClose));
|
||||
Socket acc = null;
|
||||
try {
|
||||
th.Start ();
|
||||
acc = srv.Accept ();
|
||||
clnt.Connect ();
|
||||
clnt.Write ();
|
||||
acc = srv.Accept ();
|
||||
ArrayList list = new ArrayList ();
|
||||
ArrayList empty = new ArrayList ();
|
||||
list.Add (acc);
|
||||
@@ -278,6 +278,7 @@ namespace MonoTests.System.Net.Sockets
|
||||
if (acc != null)
|
||||
acc.Close ();
|
||||
srv.Close ();
|
||||
clnt.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,10 +300,13 @@ namespace MonoTests.System.Net.Sockets
|
||||
sock = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
}
|
||||
|
||||
public void ConnectSleepClose ()
|
||||
public void Connect ()
|
||||
{
|
||||
sock.Connect (ep);
|
||||
Thread.Sleep (2000);
|
||||
}
|
||||
|
||||
public void Close ()
|
||||
{
|
||||
sock.Close ();
|
||||
}
|
||||
|
||||
|
||||
@@ -209,6 +209,13 @@ namespace MonoTests.System.Net
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("NotOnWindows")]
|
||||
public void GetHostAddresses_IPv6 ()
|
||||
{
|
||||
var address = Dns.GetHostAddresses("ipv6.google.com");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetHostName ()
|
||||
{
|
||||
|
||||
@@ -293,9 +293,6 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
#if MONOTOUCH
|
||||
[Ignore ("On device sometimes hangs in the call to listener.GetContext (). See bug #60542.")]
|
||||
#endif
|
||||
public void HttpRequestIgnoreBadCookies ()
|
||||
{
|
||||
|
||||
@@ -2621,7 +2621,8 @@ namespace MonoTests.System.Net
|
||||
var hwr = (HttpWebRequest)WebRequest.Create (uri);
|
||||
|
||||
hwr.Host = address2;
|
||||
Assert.AreEqual (address2, hwr.Host, "#1");
|
||||
var expected = "[2001::1:1:1:157:0]";
|
||||
Assert.AreEqual (expected, hwr.Host, "#1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -2642,21 +2643,6 @@ namespace MonoTests.System.Net
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
public void AllowReadStreamBuffering ()
|
||||
{
|
||||
var hr = WebRequest.CreateHttp ("http://www.google.com");
|
||||
Assert.IsFalse (hr.AllowReadStreamBuffering, "#1");
|
||||
try {
|
||||
hr.AllowReadStreamBuffering = true;
|
||||
Assert.Fail ("#2");
|
||||
} catch (InvalidOperationException) {
|
||||
}
|
||||
}
|
||||
|
||||
class ListenerScope : IDisposable {
|
||||
EventWaitHandle completed;
|
||||
public HttpListener listener;
|
||||
@@ -3253,7 +3239,7 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#A2");
|
||||
Assert.IsNull (ex.InnerException, "#A3");
|
||||
Assert.IsNotNull (ex.Message, "#A4");
|
||||
Assert.AreEqual ("size", ex.ParamName, "#A5");
|
||||
Assert.AreEqual ("count", ex.ParamName, "#A5");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3284,7 +3270,7 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
|
||||
Assert.IsNull (ex.InnerException, "#3");
|
||||
Assert.IsNotNull (ex.Message, "#4");
|
||||
Assert.AreEqual ("size", ex.ParamName, "#5");
|
||||
Assert.AreEqual ("count", ex.ParamName, "#5");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3471,6 +3457,7 @@ namespace MonoTests.System.Net
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
[Category ("MobileNotWorking")] // https://github.com/xamarin/xamarin-macios/issues/3827
|
||||
// Bug6737
|
||||
// This test is supposed to fail prior to .NET 4.0
|
||||
public void Post_EmptyRequestStream ()
|
||||
|
||||
@@ -875,7 +875,7 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#A2");
|
||||
Assert.IsNull (ex.InnerException, "#A3");
|
||||
Assert.IsNotNull (ex.Message, "#A4");
|
||||
Assert.AreEqual ("size", ex.ParamName, "#A5");
|
||||
Assert.AreEqual ("count", ex.ParamName, "#A5");
|
||||
}
|
||||
|
||||
// read full response
|
||||
@@ -890,7 +890,7 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#B2");
|
||||
Assert.IsNull (ex.InnerException, "#B3");
|
||||
Assert.IsNotNull (ex.Message, "#B4");
|
||||
Assert.AreEqual ("size", ex.ParamName, "#B5");
|
||||
Assert.AreEqual ("count", ex.ParamName, "#B5");
|
||||
}
|
||||
} finally {
|
||||
rs.Close ();
|
||||
@@ -928,7 +928,7 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#A2");
|
||||
Assert.IsNull (ex.InnerException, "#A3");
|
||||
Assert.IsNotNull (ex.Message, "#A4");
|
||||
Assert.AreEqual ("size", ex.ParamName, "#A5");
|
||||
Assert.AreEqual ("count", ex.ParamName, "#A5");
|
||||
}
|
||||
|
||||
// read full response
|
||||
@@ -943,7 +943,7 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#B2");
|
||||
Assert.IsNull (ex.InnerException, "#B3");
|
||||
Assert.IsNotNull (ex.Message, "#B4");
|
||||
Assert.AreEqual ("size", ex.ParamName, "#B5");
|
||||
Assert.AreEqual ("count", ex.ParamName, "#B5");
|
||||
}
|
||||
} finally {
|
||||
rs.Close ();
|
||||
@@ -1221,6 +1221,7 @@ namespace MonoTests.System.Net
|
||||
|
||||
[Test]
|
||||
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
|
||||
[Category ("MobileNotWorking")] // https://github.com/xamarin/xamarin-macios/issues/3827
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
|
||||
@@ -241,9 +241,6 @@ public class IPAddressTest
|
||||
[Test]
|
||||
public void IsLoopbackV6 ()
|
||||
{
|
||||
// if (!Socket.SupportsIPv6)
|
||||
// Assert.Ignore ("IPv6 must be enabled in machine.config");
|
||||
|
||||
IPAddress ip = IPAddress.IPv6Loopback;
|
||||
Assert.IsTrue (IPAddress.IsLoopback (ip), "#1");
|
||||
|
||||
@@ -612,9 +609,6 @@ public class IPAddressTest
|
||||
[Test]
|
||||
public void ParseWrongV6 ()
|
||||
{
|
||||
//if (!Socket.SupportsIPv6)
|
||||
// Assert.Ignore ("IPv6 must be enabled in machine.config");
|
||||
|
||||
for (int i = 0; i < ipv6ParseWrong.Length; i++) {
|
||||
string ipAddress = ipv6ParseWrong [i];
|
||||
|
||||
|
||||
@@ -1685,10 +1685,12 @@ namespace MonoTests.System.Net
|
||||
// We throw a PlatformNotSupportedException deeper, which is caught and re-thrown as WebException
|
||||
[ExpectedException (typeof (WebException))]
|
||||
#endif
|
||||
[Category ("MobileNotWorking")] // https://github.com/xamarin/xamarin-macios/issues/3827
|
||||
[Category ("InetAccess")]
|
||||
public void GetWebRequestOverriding ()
|
||||
{
|
||||
GetWebRequestOverridingTestClass testObject = new GetWebRequestOverridingTestClass ();
|
||||
testObject.DownloadData ("http://www.mono-project.com");
|
||||
testObject.DownloadData ("http://www.example.com");
|
||||
|
||||
Assert.IsTrue (testObject.overridedCodeRan, "Overrided code wasn't called");
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace MonoTests.System.Net
|
||||
WebClient wc = new WebClient ();
|
||||
string filename = Path.GetTempFileName ();
|
||||
|
||||
var task = wc.DownloadFileTaskAsync ("http://www.mono-project.com/", filename);
|
||||
var task = wc.DownloadFileTaskAsync ("http://www.example.com/", filename);
|
||||
Assert.IsTrue (task.Wait (15000));
|
||||
Assert.IsTrue (task.IsCompleted);
|
||||
|
||||
|
||||
Loaded 100 of 326 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user