protected WebDriverFactoryBase(WebBrowserId webBrowserId, IHttpWebRequestFactory httpWebRequestFactory, IWebDriverOptions webDriverOptions, IWebDriverFactoryOptions webDriverFactoryOptions) { this.webBrowserId = webBrowserId; this.httpWebRequestFactory = httpWebRequestFactory; this.webDriverOptions = webDriverOptions; this.webDriverFactoryOptions = webDriverFactoryOptions; }
public Object QueryDuoApi(IHttpWebRequestFactory webRequestFactory, string protocol, string path, HttpWebRequestMethod method, IEnumerable<KeyValuePair<string, string>> queryValues) { var duoWebRequest = CreateSignedDuoWebRequest(webRequestFactory, protocol, path, method, queryValues); try { var duoResponse = duoWebRequest.GetResponse(); if (duoResponse != null) { var responseStream = duoResponse.GetResponseStream(); if (responseStream != null) { using (var reader = new StreamReader(responseStream)) { var js = new JavaScriptSerializer(); var objText = reader.ReadToEnd(); return js.DeserializeObject(objText); } } } } catch (WebException exception) { return null; } return null; }
public MirthConnectRequest(IHttpWebRequestFactory httpRequestFactory, string url) { this.httpRequestFactory = httpRequestFactory; this.url = url; this.postData = new Dictionary <string, string>(); this.UrlParameters = new Dictionary <string, string>(); }
/// <summary> /// Initializes a new instance of the <see cref="ExchangeListenerManager"/> class. /// </summary> /// <param name="userConnection"><see cref="UserConnection"/> instance.</param> public ExchangeListenerManager(UserConnection userConnection) { UserConnection = userConnection; _requestFactory = ClassFactory.Get <IHttpWebRequestFactory>(); _mailboxService = ClassFactory.Get <IMailboxService>(new ConstructorArgument("uc", userConnection)); _log = ClassFactory.Get <ISynchronizationLogger>(new ConstructorArgument("userId", userConnection.CurrentUser.Id)); }
public SolrCore(string id, Type documentType, string url, IHttpWebRequestFactory httpWebRequestFactory) { Id = id; DocumentType = documentType; Url = url; HttpWebRequestFactory = httpWebRequestFactory; }
// Protected members protected override Uri GetWebDriverUri(IWebBrowserInfo webBrowserInfo, IHttpWebRequestFactory webRequestFactory) { // Note that Edge and EdgeHTML use different web drivers-- MicrosoftEdgeDriver.exe and msedgedriver.exe, respectively. // The latest version of EdgeHTML is 18.19041, so that can be used to determine which web driver to download. // Currently, this method only gets web driver URIs for Edge, and not EdgeHTML. string edgeMajorVersionStr = webBrowserInfo.Version.Major.ToString(CultureInfo.InvariantCulture); // We'll get an XML document listing all web driver versions available for this version of Edge. // There might not be one for this specific version, so we'll pick the closest. using (IWebClient client = webRequestFactory.CreateWebClient()) { int maxResults = 999; string responseXml = client.DownloadString($"https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver?prefix={edgeMajorVersionStr}&delimiter=%2F&maxresults={maxResults}&restype=container&comp=list"); string webDriverVersionStr = Regex.Matches(responseXml, @"<Name>([\d.]+)", RegexOptions.IgnoreCase).Cast <Match>() .Select(m => m.Groups[1].Value) // version strings .OrderByDescending(versionString => CountMatchingRevisions(versionString, edgeMajorVersionStr)) .ThenByDescending(versionString => versionString, new NaturalSortComparer()) .FirstOrDefault(); if (string.IsNullOrWhiteSpace(webDriverVersionStr)) { webDriverVersionStr = edgeMajorVersionStr; } return(new Uri($"https://msedgedriver.azureedge.net/{webDriverVersionStr}/edgedriver_{GetPlatformOS()}.zip")); } }
// Protected members protected override Uri GetWebDriverUri(IWebBrowserInfo webBrowserInfo, IHttpWebRequestFactory webRequestFactory) { Uri versionUri = new Uri("https://chromedriver.storage.googleapis.com/LATEST_RELEASE"); // If we can get the current version of Google Chrome, we can select an exact web driver version. Version browserVersion = webBrowserInfo?.Version; if (browserVersion is object) { versionUri = new Uri(versionUri.AbsoluteUri + $"_{browserVersion.Major}.{browserVersion.Minor}.{browserVersion.Build}"); } using (IWebClient webClient = webRequestFactory.ToWebClientFactory().Create()) { // Get the latest web driver version. string latestVersionString = webClient.DownloadString(versionUri); // Create a download URL for this version. if (!string.IsNullOrWhiteSpace(latestVersionString)) { Uri downloadUri = new Uri(versionUri, $"/{latestVersionString}/chromedriver_{GetPlatformOS()}.zip"); return(downloadUri); } } // We weren't able to get information on the latest web driver. return(null); }
/// <summary> /// Manages HTTP connection with Solr /// </summary> /// <param name="serverURL">URL to Solr</param> public SolrConnection(string serverURL) { ServerURL = serverURL; Timeout = -1; Cache = new NullCache(); HttpWebRequestFactory = new HttpWebRequestFactory(); }
public OAuthHttpWebRequest(IHttpWebRequestFactory httpWebRequestFactory, OAuthWebRequestSigner signer) { _httpWebRequestFactory = httpWebRequestFactory; _signer = signer; Timeout = int.MinValue; Compression = DecompressionMethods.None; }
public TargetedNotificationsProvider(RemoteSettingsInitializer initializer) : base(initializer.CacheableRemoteSettingsStorageHandler, initializer) { webRequestFactory = initializer.HttpWebRequestFactory; notificationsParser = initializer.TargetedNotificationsParser; remoteSettingsFilterProvider = initializer.FilterProvider; }
protected WebClientBase(IHttpWebRequestFactory webRequestFactory) { this.webRequestFactory = webRequestFactory; // Replace the default proxy with a placeholder, so we can detect if the user has changed the proxy property. // This would not be necessary if we could override the Proxy property, but alas, we cannot. Proxy = new PlaceholderWebProxy(Proxy); }
// Public members public RedirectHandler(IHttpWebRequestFactory httpWebRequestFactory) { if (httpWebRequestFactory is null) { throw new ArgumentNullException(nameof(httpWebRequestFactory)); } this.httpWebRequestFactory = httpWebRequestFactory; }
public WebClientFactory(IHttpWebRequestFactory webRequestFactory, WebRequestHandler webRequestHandler) : this(webRequestFactory) { if (webRequestHandler is null) { throw new ArgumentNullException(nameof(webRequestHandler)); } this.webRequestHandler = webRequestHandler; }
public WebClientFactory(IHttpWebRequestFactory webRequestFactory) { if (webRequestFactory is null) { throw new ArgumentNullException(nameof(webRequestFactory)); } this.webRequestFactory = webRequestFactory; }
public OAuthHttpWebRequest() { _httpWebRequestFactory = new StandardHttpWebRequestFactory(); _signer = new OAuthWebRequestSigner(new HmacSha1SignatureGenerator()); TimestampGenerator = new StandardTimestampGenerator(); NonceGenerator = new GuidNonceGenerator(); Timeout = int.MinValue; Compression = DecompressionMethods.None; }
// Protected members protected WebClientBase(IHttpWebRequestFactory webRequestFactory) { this.webRequestFactory = webRequestFactory; // The Proxy property is non-null by default, and we want to know if the user set the proxy to a blank proxy intentionally. // Instead of trying to figure that out, we'll set the Proxy property here, and assume that whatever the property is from hereon out is what the user wants. webRequestFactory.GetOptions().CopyTo(this); }
/// <summary> /// Constructor. /// </summary> /// <param name="encodingfactory"></param> /// <param name="httpWebRequestFactory"></param> /// <param name="transmissionLogger"></param> public HttpTransmitter(IEncodingFactory encodingfactory, IHttpWebRequestFactory httpWebRequestFactory, ITransmissionLogger transmissionLogger) { ParameterCheck.ParameterRequired(encodingfactory, "encodingfactory"); ParameterCheck.ParameterRequired(httpWebRequestFactory, "httpWebRequestFactory"); ParameterCheck.ParameterRequired(transmissionLogger, "transmissionLogger"); this.encodingfactory = encodingfactory; this.httpWebRequestFactory = httpWebRequestFactory; this.transmissionLogger = transmissionLogger; }
public EncodingHelper(IHttpWebRequestFactory webRequestFactory) { if (webRequestFactory == null) { throw new ArgumentNullException(nameof(webRequestFactory)); } _webRequestFactory = webRequestFactory; }
public AFDFlightsProvider(IKeyValueStorage keyValueStorage, string flightsKey, IFlightsStreamParser flightsStreamParser, IExperimentationFilterProvider filterProvider, IHttpWebRequestFactory httpWebRequestFactory) : base(keyValueStorage, flightsStreamParser, 1800000) { CodeContract.RequiresArgumentNotNullAndNotEmpty(flightsKey, "flightsKey"); CodeContract.RequiresArgumentNotNull <IExperimentationFilterProvider>(filterProvider, "filterProvider"); CodeContract.RequiresArgumentNotNull <IHttpWebRequestFactory>(httpWebRequestFactory, "httpWebRequestFactory"); this.filterProvider = filterProvider; this.flightsKey = flightsKey; this.httpWebRequestFactory = httpWebRequestFactory; }
public RandomOrgApiService(ISettingsManager settingsManager = null, IHttpWebRequestFactory httpWebRequestFactory = null) { _httpWebRequestFactory = httpWebRequestFactory ?? new HttpWebRequestFactory(); if (settingsManager == null) settingsManager = new SettingsManager(new ConfigurationManagerWrap()); _url = settingsManager.GetUrl(); _httpRequestTimeout = settingsManager.GetHttpRequestTimeout(); _httpReadWriteTimeout = settingsManager.GetHttpReadWriteTimeout(); }
public Client(string accessID, string secretKey, IHttpWebRequestFactory _httpWebRequestFactory = null) { Client.AccessID = accessID; Client.SecretKey = secretKey; if (_httpWebRequestFactory == null) { Client.httpWebRequestFactory = new PayabbhiHttpWebRequestFactory(); } else { Client.httpWebRequestFactory = _httpWebRequestFactory; } }
public DeliciousQueryProviderTest() { delayer = mocks.StrictMock<IDelayer>(); translatorFactory = mocks.StrictMock<IQueryTranslatorFactory>(); translator = mocks.StrictMock<IQueryTranslator>(); requestFactory = mocks.StrictMock<IHttpWebRequestFactory>(); request = mocks.StrictMock<HttpWebRequest>(); response = mocks.StrictMock<HttpWebResponse>(); stream.Write(documentBytes, 0, documentBytes.Length); stream.Seek(0, SeekOrigin.Begin); provider = new DeliciousQueryProvider(requestFactory, delayer, translatorFactory); }
public OssReportService(IReportRepository reportRepository, IComponentRepository componentRepository, IOssIndexRepository ossIndexRepository, IReportLinesRepository reportLinesRepository, ICoordinatesService coordinatesService, IHttpWebRequestFactory httpWebRequestFactory, IJsonConvertService jsonConvertService, IOssIndexVulnerabilitiesRepository ossIndexVulnerabilitiesRepository) { _reportRepository = reportRepository; _componentRepository = componentRepository; _ossIndexRepository = ossIndexRepository; _reportLinesRepository = reportLinesRepository; _coordinatesService = coordinatesService; _httpWebRequestFactory = httpWebRequestFactory; _jsonConvertService = jsonConvertService; _ossIndexVulnerabilitiesRepository = ossIndexVulnerabilitiesRepository; }
public SkillsHealthCheckService(IOptions <ShcSettings> settings, IHttpWebRequestFactory requestFactory) { Throw.IfNull(settings, nameof(settings)); Throw.IfNullOrEmpty(settings.Value.Url, nameof(settings.Value.Url)); Throw.IfNullOrEmpty(settings.Value.FindDocumentsAction, nameof(settings.Value.FindDocumentsAction)); Throw.IfNullOrEmpty(settings.Value.SHCDocType, nameof(settings.Value.SHCDocType)); Throw.IfNullOrEmpty(settings.Value.ServiceName, nameof(settings.Value.ServiceName)); Throw.IfNullOrEmpty(settings.Value.LinkUrl, nameof(settings.Value.LinkUrl)); Throw.IfNull(requestFactory, nameof(requestFactory)); _settings = settings; _factory = requestFactory; }
public YouTrackBugService(IHttpWebRequestFactory httpFactory, string youtrackURL, string userName, string password) { _httpFactory = httpFactory; YOUTRACKURL = youtrackURL.TrimEnd('\\').TrimEnd('/'); LOGINURL = YOUTRACKURL + "/rest/user/login"; PROJECTLISTURL = YOUTRACKURL + "/rest/project/all"; BUGLISTURL = YOUTRACKURL + "/rest/issue/byproject/{0}?after={1}&max={2}"; COUNTURL = YOUTRACKURL + "/rest/issue/count"; COUNTBYPROJECTURL = YOUTRACKURL + "/rest/issue/count?filter=project:{{{0}}}"; BUGLISTWITHFILTERURL = YOUTRACKURL + "/rest/issue/byproject/{0}?after={1}&max={2}&filter={3}"; APPLYCOMMANDURL = YOUTRACKURL + "/rest/issue/{0}/execute"; APPLYCOMMANDBODY = "command={0}&disableNotifications={1}"; _userName = userName; _password = password; }
public YouTrackBugService(IHttpWebRequestFactory httpFactory, string youtrackURL, string userName, string password) { _httpFactory = httpFactory; YOUTRACKURL = youtrackURL.TrimEnd('\\').TrimEnd('/'); LOGINURL = YOUTRACKURL + "/rest/user/login"; PROJECTLISTURL = YOUTRACKURL + "/rest/project/all"; BUGLISTURL = YOUTRACKURL + "/rest/issue/byproject/{0}?after={1}&max={2}"; COUNTURL = YOUTRACKURL + "/rest/issue/count"; COUNTBYPROJECTURL = YOUTRACKURL + "/rest/issue/count?filter=project:{{{0}}}"; BUGLISTWITHFILTERURL = YOUTRACKURL + "/rest/issue/byproject/{0}?after={1}&max={2}&filter={3}:{4}"; APPLYCOMMANDURL = YOUTRACKURL + "/rest/issue/{0}/execute"; APPLYCOMMANDBODY = "command={0}&disableNotifications={1}"; _userName = userName; _password = password; }
// Protected members protected override Uri GetWebDriverUri(IWebBrowserInfo webBrowserInfo, IHttpWebRequestFactory webRequestFactory) { string releasesUrl = "https://github.com/mozilla/geckodriver/releases/latest"; IGitHubClient gitHubClient = new GitHubWebClient(webRequestFactory); IRelease release = gitHubClient.GetLatestRelease(releasesUrl); IReleaseAsset asset = release.Assets.Where(a => a.Name.Contains(GetPlatformOS())) .FirstOrDefault(); if (!string.IsNullOrWhiteSpace(asset?.DownloadUrl)) { return(new Uri(asset.DownloadUrl)); } // We weren't able to get information on the latest web driver. return(null); }
/// <summary> /// Manages HTTP connection with Solr /// </summary> /// <param name="serverURL">URL to Solr</param> public SolrConnection(string serverURL) { ServerURL = serverURL; Timeout = -1; Cache = new NullCache(); HttpWebRequestFactory = new HttpWebRequestFactory(); if (ConfigurationManager.AppSettings["UseHttp"] == null || (ConfigurationManager.AppSettings["UseHttp"] != null && ConfigurationManager.AppSettings["UseHttp"].ToLower() != "true")) { var certificatePath = ConfigurationManager.AppSettings["CertificatePath"]; var certificatePassword = ConfigurationManager.AppSettings["CertificatePass"]; if (string.IsNullOrEmpty(certificatePath)) { throw new ArgumentException("Path to certificate not set in web.config"); } Certificate = new X509Certificate2(certificatePath, certificatePassword); } }
public WebDriverFactory(IHttpWebRequestFactory webRequestFactory, IWebDriverOptions webDriverOptions, IWebDriverFactoryOptions webDriverFactoryOptions) { if (webDriverOptions is null) { throw new ArgumentNullException(nameof(webDriverOptions)); } if (webDriverFactoryOptions is null) { throw new ArgumentNullException(nameof(webDriverFactoryOptions)); } if (webRequestFactory is null) { throw new ArgumentNullException(nameof(webRequestFactory)); } this.webRequestFactory = webRequestFactory; this.webDriverOptions = webDriverOptions; this.webDriverFactoryOptions = webDriverFactoryOptions; }
public void Initialize() { _httpWebRequestFactory = new HttpWebRequestFactory(); _streamReaderFactory = new StreamReaderFactory(); _httpWebProcessor = new HttpWebProcessor(_streamReaderFactory); _httpWebProxyRequestFactory = new HttpWebProxyRequestFactory(_httpWebRequestFactory, _httpWebProcessor); _httpWebResponseFactory = new HttpWebResponseFactory(); _httpWebProxy = new HttpWebProxy(_httpWebProxyRequestFactory, _httpWebResponseFactory, _httpWebProcessor); _httpWebRequestParametersGet = new HttpWebRequestParameters() { RequestUri = new Uri("http://httpbin.org/get"), ContentType = "*/*", Method = HttpMethod.Get, ReadWriteTimeout = 30000, Timeout = 30000, ResponseCallback = ResponseCallbackGet }; var encoding = new ASCIIEncoding(); _httpWebRequestParametersPost = new HttpWebRequestParameters() { RequestUri = new Uri("http://httpbin.org/post"), RequestData = POST_DATA_TEST, Encoding = encoding, ContentLength = POST_DATA_TEST.Length, ContentType = "*/*", Method = HttpMethod.Post, ReadWriteTimeout = 30000, Timeout = 30000, ResponseCallback = ResponseCallbackPost }; _manualResetEventGet = new ManualResetEvent(false); _manualResetEventPost = new ManualResetEvent(false); }
private IHttpWebRequest CreateSignedDuoWebRequest(IHttpWebRequestFactory webRequestFactory, string protocol, string path, HttpWebRequestMethod method, IEnumerable<KeyValuePair<string, string>> queryValues) { var duoWebRequest = CreateDuoWebRequest(webRequestFactory, protocol, path, method); var safeQueryString = CreateSafeQueryString(queryValues); var reg = new Regex(@"%[a-f0-9]{2}"); var upperUrl = reg.Replace(safeQueryString, m => m.Value.ToUpperInvariant()); SignWebRequest(duoWebRequest, method, path, upperUrl); if (method == HttpWebRequestMethod.POST) SetFormValuesForQuery(duoWebRequest, upperUrl); return duoWebRequest; }
private IHttpWebRequest CreateDuoWebRequest(IHttpWebRequestFactory webRequestFactory, string protocol, string path, HttpWebRequestMethod method) { var duoWebRequest = webRequestFactory.Create(new Uri(string.Format(@"{0}://{1}{2}", protocol, _host, path))); duoWebRequest.Method = method; duoWebRequest.Accept = "application/json"; duoWebRequest.Timeout = 3 * 60 * 1000; return duoWebRequest; }
protected override IWebDriverUpdater GetUpdater(IHttpWebRequestFactory httpWebRequestFactory, IWebDriverUpdaterOptions webDriverUpdaterOptions) { return(new EdgeWebDriverUpdater(httpWebRequestFactory, webDriverUpdaterOptions)); }
public MockMirthConnectRequest(IHttpWebRequestFactory httpRequestFactory, string url) : base(httpRequestFactory, url) { this.httpRequestFactory = (MockHttpWebRequestFactory)httpRequestFactory; }
public MockMirthConnectRequestFactory SetHttpWebRequestFactory(IHttpWebRequestFactory factory) { HttpWebRequestFactory = factory; return this; }
protected WebClientBase(IHttpWebRequestFactory webRequestFactory, WebRequestHandler webRequestHandler) : this(webRequestFactory) { this.webRequestHandler = webRequestHandler; }
public HttpDataGrabber(IHttpWebRequestFactory requestFactory, string userName, string password) { _userName = userName; _password = password; _requestFactory = requestFactory; }
/// <summary> /// Creates a new CsqWebRequest for a URL using the provided IHttpWebRequestFactory. (Usually, /// you should use the default constructor, unless replacing the .NET framework HttpWebRequest /// object for testing or some other purpose) /// </summary> /// /// <param name="url"> /// URL of the document. /// </param> /// <param name="webRequestFactory"> /// The web request factory. /// </param> public CsqWebRequest(string url, IHttpWebRequestFactory webRequestFactory) { Url = url; WebRequestFactory = webRequestFactory; }
/// <summary> /// Creates a new DeliciousQueryProvider. /// </summary> /// <param name="requestFactory">The factory for creating HttpWebRequest objects.</param> /// <param name="delayer">The IDelayer responsible for timing HTTP requests.</param> /// <param name="translatorFactory">The factory for creating IQueryTranslator objects.</param> public DeliciousQueryProvider(IHttpWebRequestFactory requestFactory, IDelayer delayer, IQueryTranslatorFactory translatorFactory) { mRequestFactory = requestFactory; mDelayer = delayer; mTranslatorFactory = translatorFactory; }
/// <summary> /// Initializes a new instance of the <see cref="ApiClient" /> class. /// </summary> /// <param name="logger">The logger.</param> /// <param name="requestFactory">The request factory.</param> public HttpWebRequestClient(ILogger logger, IHttpWebRequestFactory requestFactory) { Logger = logger; _requestFactory = requestFactory; }
public SolrConnectionWrapper(string serverURL, IHttpWebRequestFactory httpWebRequestFactory) : this(serverURL) { this.HttpWebRequestFactory = httpWebRequestFactory; }
private IHttpWebRequest CreateSignedDuoWebRequest(IHttpWebRequestFactory webRequestFactory, string protocol, string path, HttpWebRequestMethod method, IEnumerable<KeyValuePair<string, string>> queryValues) { var duoWebRequest = CreateDuoWebRequest(webRequestFactory, protocol, path, method); var safeQueryString = "message=Your%20PIN%20is%20%3Cpin%3E&phone=%2B447952556282"; // CreateSafeQueryString(queryValues); SignWebRequest(duoWebRequest, method, path, safeQueryString); if (method == HttpWebRequestMethod.POST) SetFormValuesForQuery(duoWebRequest, safeQueryString); return duoWebRequest; }
public EarthquakeContainer(IHttpWebRequestFactory factory) { appSettings = new AppSettings(); geonet = new GeonetAccessor(factory); geonet.GetQuakesCompletedEvent += QuakeListener; }
public SeqBatchSender(SeqTraceListener associatedTraceListener, IHttpWebRequestFactory httpWebRequestFactory) { _associatedTraceListener = associatedTraceListener; _httpWebRequestFactory = httpWebRequestFactory; }
public FirefoxWebDriverUpdater(IHttpWebRequestFactory webRequestFactory, IWebDriverUpdaterOptions webDriverUpdaterOptions) : base(WebBrowserId.Firefox, webRequestFactory, webDriverUpdaterOptions) { }
public HttpRequestSender(IHttpWebRequestFactory httpWebRequestFactory) { Requires.NotNull(httpWebRequestFactory, "httpWebRequestFactory"); _httpWebRequestFactory = httpWebRequestFactory; }
public GeonetAccessor(IHttpWebRequestFactory webRequestFactory) { this.webRequestFactory = webRequestFactory; this.settings = new AppSettings(); }
public MirthConnectRequest(IHttpWebRequestFactory httpRequestFactory, string url) { this.httpRequestFactory = httpRequestFactory; this.url = url; this.postData = new Dictionary<string, string>(); }
public EdgeWebDriverFactory(IHttpWebRequestFactory webRequestFactory, IWebDriverOptions webDriverOptions, IWebDriverFactoryOptions webDriverFactoryOptions) : base(WebBrowserId.Edge, webRequestFactory, webDriverOptions, webDriverFactoryOptions) { }
public HttpWebProxyRequestFactory(IHttpWebRequestFactory httpWebRequestFactory, IHttpWebProcessor httpWebProcessor) { _httpWebRequestFactory = httpWebRequestFactory; _httpWebProcessor = httpWebProcessor; }
private IHttpWebRequest CreateSignedDuoWebRequest(IHttpWebRequestFactory webRequestFactory, string protocol, string path, HttpWebRequestMethod method, IEnumerable<KeyValuePair<string, string>> queryValues) { queryValues = queryValues.OrderBy(item => item.Key); var duoWebRequest = CreateDuoWebRequest(webRequestFactory, protocol, path, method); var safeQueryString = CreateSafeQueryString(queryValues); SignWebRequest(duoWebRequest, method, path, safeQueryString); if (method == HttpWebRequestMethod.POST) SetFormValuesForQuery(duoWebRequest, safeQueryString); return duoWebRequest; }