Browse Source

Do not use cookies for c# client proxies.

pull/13845/head
Halil İbrahim Kalkan 4 years ago
parent
commit
206642d412
  1. 11
      framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionHttpClientProxyExtensions.cs
  2. 3
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/AbpHttpClientBuilderOptions.cs

11
framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionHttpClientProxyExtensions.cs

@ -1,5 +1,6 @@
using System;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using Castle.DynamicProxy;
using JetBrains.Annotations;
@ -196,6 +197,16 @@ public static class ServiceCollectionHttpClientProxyExtensions
{
clientBuildAction(remoteServiceConfigurationName, provider, client);
}
}).ConfigurePrimaryHttpMessageHandler((provider) =>
{
var handler = new HttpClientHandler { UseCookies = false };
foreach (var handlerAction in preOptions.ProxyClientHandlerActions)
{
handlerAction(remoteServiceConfigurationName, provider, handler);
}
return handler;
});
foreach (var clientBuildAction in preOptions.ProxyClientBuildActions)

3
framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/AbpHttpClientBuilderOptions.cs

@ -12,11 +12,14 @@ public class AbpHttpClientBuilderOptions
internal HashSet<string> ConfiguredProxyClients { get; }
public List<Action<string, IServiceProvider, HttpClient>> ProxyClientActions { get; }
public List<Action<string, IServiceProvider, HttpClientHandler>> ProxyClientHandlerActions { get; }
public AbpHttpClientBuilderOptions()
{
ProxyClientBuildActions = new List<Action<string, IHttpClientBuilder>>();
ConfiguredProxyClients = new HashSet<string>();
ProxyClientActions = new List<Action<string, IServiceProvider, HttpClient>>();
ProxyClientHandlerActions = new List<Action<string, IServiceProvider, HttpClientHandler>>();
}
}

Loading…
Cancel
Save