public Maybe <IWebProxy> Visit(UseCustomProxySettings proxySettings) { IWebProxy proxy = new WebProxy(new UriBuilder("http", proxySettings.Host, proxySettings.Port).Uri); proxy.Credentials = string.IsNullOrWhiteSpace(proxySettings.Username) ? new NetworkCredential() : new NetworkCredential(proxySettings.Username, proxySettings.Password); return(proxy.AsSome()); }
public Maybe <IWebProxy> CreateProxy() { var proxy = new WebProxy(new UriBuilder("http", Host, Port).Uri) { Credentials = string.IsNullOrWhiteSpace(Username) ? new NetworkCredential() : new NetworkCredential(Username, Password) }; return(proxy.AsSome <IWebProxy>()); }
public Maybe <IWebProxy> Visit(BypassProxySettings proxySettings) { IWebProxy emptyProxy = new WebProxy(); return(emptyProxy.AsSome()); }