Esempio n. 1
0
 public static SocketConfig GetSocketConfig(HttpParams @params)
 {
     return(SocketConfig.Custom().SetSoTimeout(@params.GetIntParameter(CoreConnectionPNames
                                                                       .SoTimeout, 0)).SetSoReuseAddress(@params.GetBooleanParameter(CoreConnectionPNames
                                                                                                                                     .SoReuseaddr, false)).SetSoKeepAlive(@params.GetBooleanParameter(CoreConnectionPNames
                                                                                                                                                                                                      .SoKeepalive, false)).SetSoLinger(@params.GetIntParameter(CoreConnectionPNames.SoLinger
                                                                                                                                                                                                                                                                , -1)).SetTcpNoDelay(@params.GetBooleanParameter(CoreConnectionPNames.TcpNodelay
                                                                                                                                                                                                                                                                                                                 , true)).Build());
 }
        /// <exception cref="System.IO.IOException"></exception>		[System.ObsoleteAttribute(@"(4.3) no longer used.")]
        protected internal virtual HttpClientConnection Create(Socket socket, HttpParams
                                                               @params)
        {
            int bufsize = @params.GetIntParameter(CoreConnectionPNames.SocketBufferSize, 8 *
                                                  1024);
            DefaultBHttpClientConnection conn = new DefaultBHttpClientConnection(bufsize);

            conn.Bind(socket);
            return(conn);
        }
 public BasicConnFactory(SSLSocketFactory sslfactory, HttpParams @params) : base()
 {
     Args.NotNull(@params, "HTTP params");
     this.plainfactory   = null;
     this.sslfactory     = sslfactory;
     this.connectTimeout = @params.GetIntParameter(CoreConnectionPNames.ConnectionTimeout
                                                   , 0);
     this.sconfig     = HttpParamConfig.GetSocketConfig(@params);
     this.connFactory = new DefaultBHttpClientConnectionFactory(HttpParamConfig.GetConnectionConfig
                                                                    (@params));
 }
 public static RequestConfig GetRequestConfig(HttpParams @params)
 {
     return(RequestConfig.Custom().SetSocketTimeout(@params.GetIntParameter(CoreConnectionPNames
                                                                            .SoTimeout, 0)).SetStaleConnectionCheckEnabled(@params.GetBooleanParameter(CoreConnectionPNames
                                                                                                                                                       .StaleConnectionCheck, true)).SetConnectTimeout(@params.GetIntParameter(CoreConnectionPNames
                                                                                                                                                                                                                               .ConnectionTimeout, 0)).SetExpectContinueEnabled(@params.GetBooleanParameter(CoreProtocolPNames
                                                                                                                                                                                                                                                                                                            .UseExpectContinue, false)).SetProxy((HttpHost)@params.GetParameter(ConnRoutePNames
                                                                                                                                                                                                                                                                                                                                                                                .DefaultProxy)).SetLocalAddress((IPAddress)@params.GetParameter(ConnRoutePNames.
                                                                                                                                                                                                                                                                                                                                                                                                                                                LocalAddress)).SetProxyPreferredAuthSchemes((ICollection <string>)@params.GetParameter
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (AuthPNames.ProxyAuthPref)).SetTargetPreferredAuthSchemes((ICollection <string>)@params
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          .GetParameter(AuthPNames.TargetAuthPref)).SetAuthenticationEnabled(@params.GetBooleanParameter
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 (ClientPNames.HandleAuthentication, true)).SetCircularRedirectsAllowed(@params.GetBooleanParameter
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            (ClientPNames.AllowCircularRedirects, false)).SetConnectionRequestTimeout((int)@params
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      .GetLongParameter(ClientPNames.ConnManagerTimeout, 0)).SetCookieSpec((string)@params
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           .GetParameter(ClientPNames.CookiePolicy)).SetMaxRedirects(@params.GetIntParameter
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         (ClientPNames.MaxRedirects, 50)).SetRedirectsEnabled(@params.GetBooleanParameter
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  (ClientPNames.HandleRedirects, true)).SetRelativeRedirectsAllowed([email protected]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        (ClientPNames.RejectRelativeRedirect, false)).Build());
 }
Esempio n. 5
0
 public static MessageConstraints GetMessageConstraints(HttpParams @params)
 {
     return(MessageConstraints.Custom().SetMaxHeaderCount(@params.GetIntParameter(CoreConnectionPNames
                                                                                  .MaxHeaderCount, -1)).SetMaxLineLength(@params.GetIntParameter(CoreConnectionPNames
                                                                                                                                                 .MaxLineLength, -1)).Build());
 }