Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -82,9 +82,7 @@ namespace System.ServiceModel.Channels
public XmlDictionaryReaderQuotas ReaderQuotas {
get { return quotas; }
#if NET_4_0
set { quotas = value; }
#endif
}
public override IChannelFactory<TChannel> BuildChannelFactory<TChannel> (
@@ -156,12 +154,10 @@ namespace System.ServiceModel.Channels
}
#endif
#if NET_4_5
[MonoTODO]
public CompressionFormat CompressionFormat {
get { throw new NotImplementedException (); }
set { throw new NotImplementedException (); }
}
#endif
}
}

View File

@@ -33,7 +33,6 @@ namespace System.ServiceModel.Channels
public class BindingParameterCollection
: KeyedByTypeCollection<object>
{
#if NET_4_5
protected override Type GetKeyForItem (object item)
{
return base.GetKeyForItem (item);
@@ -48,6 +47,5 @@ namespace System.ServiceModel.Channels
{
base.SetItem (index, item);
}
#endif
}
}

View File

@@ -38,9 +38,7 @@ namespace System.ServiceModel.Channels
{
internal class HttpChannelFactory<TChannel> : TransportChannelFactoryBase<TChannel>
{
#if NET_2_1 || NET_4_0
IHttpCookieContainerManager cookie_manager;
#endif
public HttpChannelFactory (HttpTransportBindingElement source, BindingContext ctx)
: base (source, ctx)
@@ -52,11 +50,9 @@ namespace System.ServiceModel.Channels
MessageEncoder = CreateEncoder<TChannel> (mbe);
continue;
}
#if NET_2_1 || NET_4_0
var tbe = be as HttpTransportBindingElement;
if (tbe != null)
cookie_manager = tbe.GetProperty<IHttpCookieContainerManager> (ctx);
#endif
}
if (MessageEncoder == null)
MessageEncoder = new TextMessageEncoder (MessageVersion.Default, Encoding.UTF8);
@@ -109,10 +105,8 @@ namespace System.ServiceModel.Channels
public override T GetProperty<T> ()
{
#if NET_2_1 || NET_4_0
if (cookie_manager is T)
return (T) (object) cookie_manager;
#endif
return base.GetProperty<T> ();
}
}

View File

@@ -4,9 +4,7 @@ using System.ServiceModel;
namespace System.ServiceModel.Channels
{
#if NET_4_0
[Obsolete ("Use AllowCookies.")]
#endif
public class HttpCookieContainerBindingElement : BindingElement
{
HttpCookieContainerManager manager;

View File

@@ -90,12 +90,10 @@ namespace System.ServiceModel.Channels
result.WebRequest = web_request;
web_request.Method = "POST";
web_request.ContentType = Encoder.ContentType;
#if NET_2_1 || NET_4_0
HttpWebRequest hwr = (web_request as HttpWebRequest);
var cmgr = source.GetProperty<IHttpCookieContainerManager> ();
if (cmgr != null)
hwr.CookieContainer = cmgr.CookieContainer;
#endif
// client authentication (while SL3 has NetworkCredential class, it is not implemented yet. So, it is non-SL only.)
var httpbe = (HttpTransportBindingElement) source.Transport;
@@ -167,11 +165,9 @@ namespace System.ServiceModel.Channels
case "Expect":
web_request.Expect = hp.Headers [key];
break;
#if NET_4_0
case "Host":
web_request.Host = hp.Headers [key];
break;
#endif
//case "If-Modified-Since":
// web_request.IfModifiedSince = hp.Headers [key];
// break;

View File

@@ -31,9 +31,7 @@ using System.ServiceModel;
namespace System.ServiceModel.Channels
{
public sealed class HttpRequestMessageProperty
#if NET_4_5
: IMessageProperty
#endif
{
public static string Name {
get { return "httpRequest"; }
@@ -67,7 +65,6 @@ namespace System.ServiceModel.Channels
}
#if NET_4_5
IMessageProperty IMessageProperty.CreateCopy ()
{
var copy = new HttpRequestMessageProperty ();
@@ -78,6 +75,5 @@ namespace System.ServiceModel.Channels
copy.suppress_entity = suppress_entity;
return copy;
}
#endif
}
}

View File

@@ -31,9 +31,7 @@ using System.ServiceModel;
namespace System.ServiceModel.Channels
{
public sealed class HttpResponseMessageProperty
#if NET_4_5
: IMessageProperty
#endif
{
public static string Name {
get { return "httpResponse"; }
@@ -67,7 +65,6 @@ namespace System.ServiceModel.Channels
set { suppress_entity = value; }
}
#if NET_4_5
IMessageProperty IMessageProperty.CreateCopy ()
{
var copy = new HttpResponseMessageProperty ();
@@ -78,6 +75,5 @@ namespace System.ServiceModel.Channels
copy.suppress_entity = suppress_entity;
return copy;
}
#endif
}
}

View File

@@ -30,9 +30,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Net;
using System.Net.Security;
#if NET_4_0
using System.Security.Authentication.ExtendedProtection;
#endif
using System.ServiceModel.Channels;
#if !NET_2_1
using System.ServiceModel.Channels.Http;
@@ -62,9 +60,7 @@ namespace System.ServiceModel.Channels
AuthenticationSchemes proxy_auth_scheme =
AuthenticationSchemes.Anonymous;
// If you add fields, do not forget them in copy constructor.
#if NET_4_0
HttpCookieContainerManager cookie_manager;
#endif
public HttpTransportBindingElement ()
{
@@ -89,88 +85,66 @@ namespace System.ServiceModel.Channels
auth_scheme = other.auth_scheme;
proxy_auth_scheme = other.proxy_auth_scheme;
#if NET_4_0
DecompressionEnabled = other.DecompressionEnabled;
LegacyExtendedProtectionPolicy = other.LegacyExtendedProtectionPolicy;
ExtendedProtectionPolicy = other.ExtendedProtectionPolicy;
cookie_manager = other.cookie_manager;
#endif
}
#if NET_4_0
[DefaultValue (AuthenticationSchemes.Anonymous)]
#endif
public AuthenticationSchemes AuthenticationScheme {
get { return auth_scheme; }
set { auth_scheme = value; }
}
#if NET_4_0
[DefaultValue (AuthenticationSchemes.Anonymous)]
#endif
public AuthenticationSchemes ProxyAuthenticationScheme {
get { return proxy_auth_scheme; }
set { proxy_auth_scheme = value; }
}
#if NET_4_0
[DefaultValue (false)]
#endif
public bool AllowCookies {
get { return allow_cookies; }
set { allow_cookies = value; }
}
#if NET_4_0
[DefaultValue (false)]
#endif
public bool BypassProxyOnLocal {
get { return bypass_proxy_on_local; }
set { bypass_proxy_on_local = value; }
}
#if NET_4_0
[DefaultValue (false)]
[MonoTODO]
public bool DecompressionEnabled { get; set; }
#endif
#if NET_4_0
[DefaultValue (HostNameComparisonMode.StrongWildcard)]
#endif
public HostNameComparisonMode HostNameComparisonMode {
get { return host_cmp_mode; }
set { host_cmp_mode = value; }
}
#if NET_4_0
[DefaultValue (true)]
#endif
public bool KeepAliveEnabled {
get { return keep_alive_enabled; }
set { keep_alive_enabled = value; }
}
#if NET_4_0
[DefaultValue (0x10000)]
#endif
public int MaxBufferSize {
get { return max_buffer_size; }
set { max_buffer_size = value; }
}
#if NET_4_0
[DefaultValue (null)]
[TypeConverter (typeof (UriTypeConverter))]
#endif
public Uri ProxyAddress {
get { return proxy_address; }
set { proxy_address = value; }
}
#if NET_4_0
[DefaultValue ("")]
#endif
public string Realm {
get { return realm; }
set { realm = value; }
@@ -180,38 +154,30 @@ namespace System.ServiceModel.Channels
get { return Uri.UriSchemeHttp; }
}
#if NET_4_0
[DefaultValue (TransferMode.Buffered)]
#endif
public TransferMode TransferMode {
get { return transfer_mode; }
set { transfer_mode = value; }
}
#if NET_4_0
[DefaultValue (false)]
#endif
public bool UnsafeConnectionNtlmAuthentication {
get { return unsafe_ntlm_auth; }
set { unsafe_ntlm_auth = value; }
}
#if NET_4_0
[DefaultValue (true)]
#endif
public bool UseDefaultWebProxy {
get { return use_default_proxy; }
set { use_default_proxy = value; }
}
#if NET_4_0
[Obsolete ("Use ExtendedProtectionPolicy")]
[MonoTODO]
public object LegacyExtendedProtectionPolicy { get; set; }
[MonoTODO]
public ExtendedProtectionPolicy ExtendedProtectionPolicy { get; set; }
#endif
public override bool CanBuildChannelFactory<TChannel> (
BindingContext context)
@@ -261,7 +227,6 @@ namespace System.ServiceModel.Channels
return (T) (object) new HttpBindingProperties (this);
if (typeof (T) == typeof (TransferMode))
return (T) (object) TransferMode;
#if NET_4_0
if (typeof(T) == typeof(IHttpCookieContainerManager)) {
if (!AllowCookies)
return null;
@@ -269,16 +234,13 @@ namespace System.ServiceModel.Channels
cookie_manager = new HttpCookieContainerManager ();
return (T) (object) cookie_manager;
}
#endif
return base.GetProperty<T> (context);
}
#if NET_4_5
public WebSocketTransportSettings WebSocketSettings {
get { throw new NotImplementedException (); }
set { throw new NotImplementedException (); }
}
#endif
#if !NET_2_1
void IPolicyExportExtension.ExportPolicy (

View File

@@ -1,4 +1,3 @@
#if NET_2_1 || NET_4_0
using System;
using System.Net;
@@ -10,4 +9,3 @@ namespace System.ServiceModel.Channels
CookieContainer CookieContainer { get; set; }
}
}
#endif

View File

@@ -94,7 +94,6 @@ namespace System.ServiceModel.Channels
Close ();
}
#if NET_4_5
public T GetBody<T> ()
{
return OnGetBody<T> (GetReaderAtBodyContents ());
@@ -111,17 +110,6 @@ namespace System.ServiceModel.Channels
var xmlFormatter = new DataContractSerializer (typeof (T));
return (T)xmlFormatter.ReadObject (reader);
}
#else
public T GetBody<T> ()
{
return GetBody<T> (new DataContractSerializer (typeof (T)));
}
public T GetBody<T> (XmlObjectSerializer xmlFormatter)
{
return (T) xmlFormatter.ReadObject (GetReaderAtBodyContents ());
}
#endif
public string GetBodyAttribute (string localName, string ns)
{
@@ -180,7 +168,8 @@ namespace System.ServiceModel.Channels
if (!IsEmpty) {
if (copied_message != null)
copied_message.WriteBodyContents (writer);
OnWriteBodyContents (writer);
else
OnWriteBodyContents (writer);
}
else if (Version.Envelope == EnvelopeVersion.None)
WriteXsiNil (writer);

View File

@@ -29,11 +29,13 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Net.Security;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Security;
using System.Threading;
using System.Xml;
namespace System.ServiceModel.Channels
{
@@ -124,12 +126,29 @@ namespace System.ServiceModel.Channels
}
try {
return TryReceiveRequest (tout, out ctx);
} catch (XmlException ex) {
Console.WriteLine ("Xml Exception (Dropped Connection?):" + ex.Message);
//on dropped connection,
//whatever you do don't crash
//the whole app. Ignore for now
} catch (SocketException ex) {
Console.WriteLine ("Socket Exception (Dropped Connection?):" + ex.Message);
//on dropped connection,
//whatever you do don't crash
//the whole app. Ignore for now
} catch (IOException ex) {
Console.WriteLine ("I/O Exception (Dropped Connection?):" + ex.Message);
//on dropped connection,
//whatever you do don't crash
//the whole app. Ignore for now
} finally {
lock (async_result_lock) {
CurrentAsyncResult = null;
CurrentAsyncThread = null;
}
}
ctx = null;
return false;
});
RequestContext dummy;
IAsyncResult result;

View File

@@ -88,9 +88,7 @@ namespace System.ServiceModel.Channels
public XmlDictionaryReaderQuotas ReaderQuotas {
get { return quotas; }
#if NET_4_0
set { quotas = value; }
#endif
}
public Encoding WriteEncoding {

View File

@@ -23,7 +23,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
namespace System.ServiceModel.Channels {
@@ -64,4 +63,3 @@ namespace System.ServiceModel.Channels {
}
}
#endif

View File

@@ -23,7 +23,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
namespace System.ServiceModel.Channels {
public enum WebSocketTransportUsage {
WhenDuplex,
@@ -31,4 +30,3 @@ namespace System.ServiceModel.Channels {
Never
}
}
#endif