@@ -23,12 +23,16 @@ public enum type
23
23
public abstract class Request
24
24
{
25
25
static Request ( ) {
26
- ServicePointManager . SecurityProtocol = SecurityProtocolType . Tls12 | SecurityProtocolType . Tls11 | SecurityProtocolType . Tls ;
27
- ServicePointManager . DefaultConnectionLimit = 128 ;
28
- ServicePointManager . Expect100Continue = false ;
26
+ ServicePointManager . SecurityProtocol = SecurityProtocolType . Tls12 ;
27
+ ServicePointManager . DefaultConnectionLimit = 128 ;
28
+ ServicePointManager . DnsRefreshTimeout = 60 * 1000 ;
29
+ //ServicePointManager.EnableDnsRoundRobin = true;
30
+ ServicePointManager . Expect100Continue = false ;
29
31
ServicePointManager . SetTcpKeepAlive ( true , 15 * 1000 , 5 * 1000 ) ;
30
32
ServicePointManager . MaxServicePointIdleTime = 14 * 1000 ; //https://support.microsoft.com/ru-ru/help/2017977/the-underlying-connection-was-closed-a-connection-that-was-expected-to
31
- if ( "true" . Equals ( ConfigurationManager . AppSettings [ "com.sun.identity.agents.config.trust.server.certs" ] ) )
33
+ ServicePointManager . MaxServicePoints = 0 ;
34
+ ServicePointManager . MaxServicePointIdleTime = 10 * 1000 ;
35
+ if ( "true" . Equals ( ConfigurationManager . AppSettings [ "com.sun.identity.agents.config.trust.server.certs" ] ) )
32
36
ServicePointManager . ServerCertificateValidationCallback +=
33
37
delegate ( object sender , System . Security . Cryptography . X509Certificates . X509Certificate certificate ,
34
38
System . Security . Cryptography . X509Certificates . X509Chain chain ,
@@ -82,11 +86,13 @@ HttpWebRequest getHttpWebRequest()
82
86
{
83
87
HttpWebRequest request = ( HttpWebRequest ) WebRequest . Create ( getUrl ( ) ) ;
84
88
request . KeepAlive = KeepAlive ( ) ;
85
- request . AutomaticDecompression = DecompressionMethods . None ; //TODO configure
89
+ request . ProtocolVersion = ( request . KeepAlive ) ? HttpVersion . Version11 : HttpVersion . Version10 ;
90
+ request . AutomaticDecompression = DecompressionMethods . None ; //TODO configure
86
91
request . Method = getMethod ( ) ;
87
92
request . ContentType = getContentType ( ) ;
88
93
request . UserAgent = UserAgent ;
89
94
request . CookieContainer = getCookieContainer ( ) ;
95
+ request . Proxy = null ;
90
96
int connect_timeout = 5000 , receive_timeout = 15000 ;
91
97
if ( Agent . Instance . HasConfig ( ) ) {
92
98
int . TryParse ( Agent . Instance . GetSingle ( "com.sun.identity.agents.config.connect.timeout" ) , out connect_timeout ) ;
0 commit comments