mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 01:41:17 -10:00
* BindingContext.cs: Copy elements from the original binding only when creating it, never when cloning it. This way, CanBuildInnerChannel can work recursively as it should. 2010-05-14 Atsushi Enomoto <[email protected]> * CustomBinding.cs : return clone collection. * BindingContext.cs : Simply use RemainingBindingElements in builder methods. Clone() should be deep copying (as documented). * BinaryMessageEncodingBindingElement.cs MtomMessageEncodingBindingElement.cs TextMessageEncodingBindingElement.cs HttpCookieContainerBindingElement.cs : do not add itself to RemainingBindingElements. * HttpChannelFactory.cs HttpChannelListener.cs TcpChannelFactory.cs TcpChannelListener.cs MsmqChannelFactory.cs MsmqChannelListener.cs NamedPipeChannelFactory.cs NamedPipeChannelListener.cs PeerChannelFactory.cs PeerChannelListener.cs : do not iterate RemainingBindingElements. Instead, iterate all binding elements in the CustomBinding. svn path=/trunk/mcs/; revision=157345
60 lines
1.5 KiB
C#
60 lines
1.5 KiB
C#
using System;
|
|
using System.Net;
|
|
using System.ServiceModel;
|
|
|
|
namespace System.ServiceModel.Channels
|
|
{
|
|
public class HttpCookieContainerBindingElement : BindingElement
|
|
{
|
|
HttpCookieContainerManager manager;
|
|
|
|
public HttpCookieContainerBindingElement ()
|
|
{
|
|
manager = new HttpCookieContainerManager ();
|
|
}
|
|
|
|
protected HttpCookieContainerBindingElement (HttpCookieContainerBindingElement elementToBeCloned)
|
|
{
|
|
if (elementToBeCloned == null)
|
|
throw new ArgumentNullException ("elementToBeCloned");
|
|
|
|
manager = new HttpCookieContainerManager (elementToBeCloned.manager);
|
|
}
|
|
|
|
public override IChannelFactory<TChannel> BuildChannelFactory<TChannel> (BindingContext context)
|
|
{
|
|
if (context == null)
|
|
throw new ArgumentNullException ("context");
|
|
//context.RemainingBindingElements.Add (this);
|
|
return base.BuildChannelFactory<TChannel> (context);
|
|
}
|
|
|
|
public override BindingElement Clone ()
|
|
{
|
|
return new HttpCookieContainerBindingElement (this);
|
|
}
|
|
|
|
public override T GetProperty<T> (BindingContext context)
|
|
{
|
|
if (manager is T)
|
|
return (T) (object) manager;
|
|
return context.GetInnerProperty<T> ();
|
|
}
|
|
}
|
|
|
|
class HttpCookieContainerManager : IHttpCookieContainerManager
|
|
{
|
|
public HttpCookieContainerManager ()
|
|
{
|
|
CookieContainer = new CookieContainer ();
|
|
}
|
|
|
|
public HttpCookieContainerManager (HttpCookieContainerManager original)
|
|
{
|
|
CookieContainer = original.CookieContainer;
|
|
}
|
|
|
|
public CookieContainer CookieContainer { get; set; }
|
|
}
|
|
}
|