Skip to content

Commit

Permalink
downgrade http 1 when keepalive = false
Browse files Browse the repository at this point in the history
only tls1.2
add dns refresh timeout
  • Loading branch information
vharseko committed Dec 15, 2017
1 parent 004beb2 commit 2c74734
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions ru.org.openam.sdk/pll/Request.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ public enum type
public abstract class Request
{
static Request(){
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
ServicePointManager.DefaultConnectionLimit = 128;
ServicePointManager.Expect100Continue = false;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
ServicePointManager.DefaultConnectionLimit = 128;
ServicePointManager.DnsRefreshTimeout = 60*1000;
//ServicePointManager.EnableDnsRoundRobin = true;
ServicePointManager.Expect100Continue = false;
ServicePointManager.SetTcpKeepAlive(true,15*1000,5*1000);
ServicePointManager.MaxServicePointIdleTime = 14 * 1000; //https://support.microsoft.com/ru-ru/help/2017977/the-underlying-connection-was-closed-a-connection-that-was-expected-to
if ("true".Equals(ConfigurationManager.AppSettings["com.sun.identity.agents.config.trust.server.certs"]))
ServicePointManager.MaxServicePoints = 0;
ServicePointManager.MaxServicePointIdleTime = 10*1000;
if ("true".Equals(ConfigurationManager.AppSettings["com.sun.identity.agents.config.trust.server.certs"]))
ServicePointManager.ServerCertificateValidationCallback +=
delegate(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate,
System.Security.Cryptography.X509Certificates.X509Chain chain,
Expand Down Expand Up @@ -82,11 +86,13 @@ HttpWebRequest getHttpWebRequest()
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(getUrl());
request.KeepAlive =KeepAlive();
request.AutomaticDecompression = DecompressionMethods.None; //TODO configure
request.ProtocolVersion = (request.KeepAlive) ? HttpVersion.Version11 : HttpVersion.Version10;
request.AutomaticDecompression = DecompressionMethods.None; //TODO configure
request.Method = getMethod();
request.ContentType = getContentType();
request.UserAgent = UserAgent;
request.CookieContainer = getCookieContainer();
request.Proxy = null;
int connect_timeout=5000,receive_timeout=15000;
if (Agent.Instance.HasConfig()) {
int.TryParse (Agent.Instance.GetSingle ("com.sun.identity.agents.config.connect.timeout"), out connect_timeout);
Expand Down

0 comments on commit 2c74734

Please sign in to comment.