public virtual CookieSpec NewInstance(HttpParams @params) { if (@params != null) { string[] patterns = null; ICollection <object> param = (ICollection <object>)@params.GetParameter(CookieSpecPNames .DatePatterns); if (param != null) { patterns = new string[param.Count]; patterns = Sharpen.Collections.ToArray(param, patterns); } bool singleHeader = @params.GetBooleanParameter(CookieSpecPNames.SingleCookieHeader , false); return(new BestMatchSpec(patterns, singleHeader)); } else { return(new BestMatchSpec()); } }
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()); }
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()); }