Imported Upstream version 4.3.2.467

Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
Xamarin Public Jenkins
2016-02-22 11:00:01 -05:00
parent f302175246
commit f3e3aab35a
4097 changed files with 122406 additions and 82300 deletions

View File

@ -35,6 +35,7 @@ namespace System.ServiceModel.Channels
{
static bool httpWebRequestWebPermissionDenied = false;
static RequestCachePolicy requestCachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache);
static long connectionGroupNamePrefix = 0;
readonly ClientWebSocketFactory clientWebSocketFactory;
@ -65,6 +66,7 @@ namespace System.ServiceModel.Channels
WebSocketTransportSettings webSocketSettings;
ConnectionBufferPool bufferPool;
Lazy<string> webSocketSoapContentType;
string uniqueConnectionGroupNamePrefix;
internal HttpChannelFactory(HttpTransportBindingElement bindingElement, BindingContext context)
: base(bindingElement, context, HttpTransportDefaults.GetDefaultMessageEncoderFactory())
@ -183,6 +185,15 @@ namespace System.ServiceModel.Channels
}
this.webSocketSoapContentType = new Lazy<string>(() => { return this.MessageEncoderFactory.CreateSessionEncoder().ContentType; }, LazyThreadSafetyMode.ExecutionAndPublication);
if (ServiceModelAppSettings.HttpTransportPerFactoryConnectionPool)
{
this.uniqueConnectionGroupNamePrefix = Interlocked.Increment(ref connectionGroupNamePrefix).ToString();
}
else
{
this.uniqueConnectionGroupNamePrefix = string.Empty;
}
}
public bool AllowCookies
@ -665,7 +676,7 @@ namespace System.ServiceModel.Channels
}
string prefix = this.OnGetConnectionGroupPrefix(httpWebRequest, clientCertificateToken);
inputString = string.Concat(prefix, inputString);
inputString = string.Concat(this.uniqueConnectionGroupNamePrefix, prefix, inputString);
string credentialHash = null;
@ -1170,6 +1181,7 @@ namespace System.ServiceModel.Channels
ChannelBinding channelBinding;
int webRequestCompleted;
EventTraceActivity eventTraceActivity;
const string ConnectionGroupPrefixMessagePropertyName = "HttpTransportConnectionGroupNamePrefix";
public HttpChannelRequest(HttpRequestChannel channel, HttpChannelFactory<IRequestChannel> factory)
{
@ -1179,11 +1191,27 @@ namespace System.ServiceModel.Channels
this.factory = factory;
}
private string GetConnectionGroupPrefix(Message message)
{
object property;
if (message.Properties.TryGetValue(ConnectionGroupPrefixMessagePropertyName, out property))
{
string prefix = property as string;
if (prefix != null)
{
return prefix;
}
}
return string.Empty;
}
public void SendRequest(Message message, TimeSpan timeout)
{
TimeoutHelper timeoutHelper = new TimeoutHelper(timeout);
factory.ApplyManualAddressing(ref this.to, ref this.via, message);
this.webRequest = channel.GetWebRequest(this.to, this.via, ref timeoutHelper);
this.webRequest.ConnectionGroupName = GetConnectionGroupPrefix(message) + this.webRequest.ConnectionGroupName;
Message request = message;