Пример #1
0
        public static async Task <HttpResponseMessage> SendRequest(HttpRequestMessage httpRequestMessage, CookieContainer cookieContainer)
        {
            int arg_54_0 = 0;

            httpRequestMessage.RequestUri.AbsoluteUri.IndexOf("partslink24.com");
            HttpResponseMessage result;

            if (arg_54_0 != 0)
            {
                HttpProxyServer.ConfigureMessageHeaders(httpRequestMessage);
                using (HttpClient httpClient = new HttpClient(HttpProxyServer.CreateClientHandler2(cookieContainer), true))
                {
                    httpClient.BaseAddress = httpRequestMessage.RequestUri;
                    result = await httpClient.SendAsync(httpRequestMessage);

                    return(result);
                }
            }
            HttpProxyServer.ConfigureMessageHeaders(httpRequestMessage);
            using (HttpClient httpClient2 = new HttpClient(HttpProxyServer.CreateClientHandler(cookieContainer), true))
            {
                httpClient2.BaseAddress = httpRequestMessage.RequestUri;
                result = await httpClient2.SendAsync(httpRequestMessage);
            }
            return(result);
        }
Пример #2
0
        public static async Task <HttpResponseMessage> SendRequest(HttpRequestMessage httpRequestMessage, CookieContainer cookieContainer)
        {
            int arg_54_0 = 0;
            //httpRequestMessage.RequestUri.AbsoluteUri.IndexOf(string.Format("{0}.com", ResourceManager.Urls[CatalogApi.UrlConstants.Key.Partslink24Root]));

            HttpResponseMessage result;

            if (arg_54_0 != 0)
            {
                HttpProxyServer.ConfigureMessageHeaders(httpRequestMessage);
                using (HttpClient httpClient = new HttpClient(HttpProxyServer.CreateClientHandler2(cookieContainer), true))
                {
                    httpClient.BaseAddress = httpRequestMessage.RequestUri;
                    result = await httpClient.SendAsync(httpRequestMessage);

                    return(result);
                }
            }

            HttpProxyServer.ConfigureMessageHeaders(httpRequestMessage);
            using (HttpClient httpClient2 = new HttpClient(HttpProxyServer.CreateClientHandler(cookieContainer), true))
            {
                httpClient2.BaseAddress = httpRequestMessage.RequestUri;
                result = await httpClient2.SendAsync(httpRequestMessage);
            }

            return(result);
        }
Пример #3
0
 public async Task <HttpResponseMessage> OpenSessionAsync(CookieContainer cookieContainer)
 {
     return(await HttpProxyServer.SendRequest(createLoginRequest(), cookieContainer));
 }
Пример #4
0
 public async Task <HttpResponseMessage> GetSessionAsync(string url, CookieContainer cookieContainer)
 {
     return(await HttpProxyServer.SendRequest(RequestFactory.CreateGetRequest(url), cookieContainer));
 }
Пример #5
0
 public async Task Close(CookieContainer cookieContainer)
 {
     await HttpProxyServer.SendRequest(createLogoutRequest(), cookieContainer);
 }
 public async Task <HttpResponseMessage> OpenSessionAsync(CookieContainer cookieContainer)
 {
     return(await HttpProxyServer.SendRequest(PartsLink24RequestFactory.CreateLoginRequest(this.login, this.password), cookieContainer));
 }
 public async Task Close(CookieContainer cookieContainer)
 {
     await HttpProxyServer.SendRequest(PartsLink24RequestFactory.CreateLogoutRequest(), cookieContainer);
 }