From acfe2ceef43feda49ad67b512338d7932c6ffc72 Mon Sep 17 00:00:00 2001 From: Qstick Date: Fri, 8 Mar 2019 22:15:18 -0500 Subject: [PATCH] Fixed: Change HttpClientFixture links to HTTPS --- .../Http/HttpClientFixture.cs | 96 +++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs b/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs index 459c0fde6..cbd303147 100644 --- a/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs +++ b/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs @@ -55,7 +55,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_execute_simple_get() { - var request = new HttpRequest($"http://{_httpBinHost}/get"); + var request = new HttpRequest($"https://{_httpBinHost}/get"); var response = Subject.Execute(request); @@ -75,7 +75,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_execute_typed_get() { - var request = new HttpRequest($"http://{_httpBinHost}/get?test=1"); + var request = new HttpRequest($"https://{_httpBinHost}/get?test=1"); var response = Subject.Get(request); @@ -88,7 +88,7 @@ namespace NzbDrone.Common.Test.Http { var message = "{ my: 1 }"; - var request = new HttpRequest($"http://{_httpBinHost}/post"); + var request = new HttpRequest($"https://{_httpBinHost}/post"); request.SetContent(message); var response = Subject.Post(request); @@ -99,7 +99,7 @@ namespace NzbDrone.Common.Test.Http [TestCase("gzip")] public void should_execute_get_using_gzip(string compression) { - var request = new HttpRequest($"http://{_httpBinHost}/{compression}"); + var request = new HttpRequest($"https://{_httpBinHost}/{compression}"); var response = Subject.Get(request); @@ -115,7 +115,7 @@ namespace NzbDrone.Common.Test.Http [TestCase(HttpStatusCode.BadGateway)] public void should_throw_on_unsuccessful_status_codes(int statusCode) { - var request = new HttpRequest($"http://{_httpBinHost}/status/{statusCode}"); + var request = new HttpRequest($"https://{_httpBinHost}/status/{statusCode}"); var exception = Assert.Throws(() => Subject.Get(request)); @@ -127,7 +127,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_not_follow_redirects_when_not_in_production() { - var request = new HttpRequest($"http://{_httpBinHost}/redirect/1"); + var request = new HttpRequest($"https://{_httpBinHost}/redirect/1"); Subject.Get(request); @@ -137,7 +137,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_follow_redirects() { - var request = new HttpRequest($"http://{_httpBinHost}/redirect/1"); + var request = new HttpRequest($"https://{_httpBinHost}/redirect/1"); request.AllowAutoRedirect = true; var response = Subject.Get(request); @@ -150,7 +150,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_not_follow_redirects() { - var request = new HttpRequest($"http://{_httpBinHost}/redirect/1"); + var request = new HttpRequest($"https://{_httpBinHost}/redirect/1"); request.AllowAutoRedirect = false; var response = Subject.Get(request); @@ -168,7 +168,7 @@ namespace NzbDrone.Common.Test.Http Assert.Ignore("Will fail on tls1.2 via managed dispatcher, ignore."); } - var request = new HttpRequestBuilder($"http://{_httpBinHost}/redirect-to") + var request = new HttpRequestBuilder($"https://{_httpBinHost}/redirect-to") .AddQueryParam("url", $"https://lidarr.audio/") .Build(); request.AllowAutoRedirect = true; @@ -184,7 +184,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_throw_on_too_many_redirects() { - var request = new HttpRequest($"http://{_httpBinHost}/redirect/4"); + var request = new HttpRequest($"https://{_httpBinHost}/redirect/4"); request.AllowAutoRedirect = true; Assert.Throws(() => Subject.Get(request)); @@ -195,7 +195,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_send_user_agent() { - var request = new HttpRequest($"http://{_httpBinHost}/get"); + var request = new HttpRequest($"https://{_httpBinHost}/get"); var response = Subject.Get(request); @@ -209,7 +209,7 @@ namespace NzbDrone.Common.Test.Http [TestCase("Accept", "text/xml, text/rss+xml, application/rss+xml")] public void should_send_headers(string header, string value) { - var request = new HttpRequest($"http://{_httpBinHost}/get"); + var request = new HttpRequest($"https://{_httpBinHost}/get"); request.Headers.Add(header, value); var response = Subject.Get(request); @@ -222,7 +222,7 @@ namespace NzbDrone.Common.Test.Http { var file = GetTempFilePath(); - Assert.Throws(() => Subject.DownloadFile("http://download.lidarr.audio/wrongpath", file)); + Assert.Throws(() => Subject.DownloadFile("https://download.lidarr.audio/wrongpath", file)); File.Exists(file).Should().BeFalse(); @@ -232,7 +232,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_send_cookie() { - var request = new HttpRequest($"http://{_httpBinHost}/get"); + var request = new HttpRequest($"https://{_httpBinHost}/get"); request.Cookies["my"] = "cookie"; var response = Subject.Get(request); @@ -246,7 +246,7 @@ namespace NzbDrone.Common.Test.Http public void GivenOldCookie() { - var oldRequest = new HttpRequest("http://eu.httpbin.org/get"); + var oldRequest = new HttpRequest("https://eu.httpbin.org/get"); oldRequest.Cookies["my"] = "cookie"; var oldClient = new HttpClient(new IHttpRequestInterceptor[0], Mocker.Resolve(), Mocker.Resolve(), Mocker.Resolve(), Mocker.GetMock().Object, Mocker.Resolve()); @@ -263,7 +263,7 @@ namespace NzbDrone.Common.Test.Http { GivenOldCookie(); - var request = new HttpRequest("http://eu.httpbin.org/get"); + var request = new HttpRequest("https://eu.httpbin.org/get"); var response = Subject.Get(request); @@ -279,7 +279,7 @@ namespace NzbDrone.Common.Test.Http { GivenOldCookie(); - var request = new HttpRequest("http://httpbin.org/get"); + var request = new HttpRequest("https://httpbin.org/get"); var response = Subject.Get(request); @@ -289,14 +289,14 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_not_store_request_cookie() { - var requestGet = new HttpRequest($"http://{_httpBinHost}/get"); + var requestGet = new HttpRequest($"https://{_httpBinHost}/get"); requestGet.Cookies.Add("my", "cookie"); requestGet.AllowAutoRedirect = false; requestGet.StoreRequestCookie = false; requestGet.StoreResponseCookie = false; var responseGet = Subject.Get(requestGet); - var requestCookies = new HttpRequest($"http://{_httpBinHost}/cookies"); + var requestCookies = new HttpRequest($"https://{_httpBinHost}/cookies"); requestCookies.AllowAutoRedirect = false; var responseCookies = Subject.Get(requestCookies); @@ -308,14 +308,14 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_store_request_cookie() { - var requestGet = new HttpRequest($"http://{_httpBinHost}/get"); + var requestGet = new HttpRequest($"https://{_httpBinHost}/get"); requestGet.Cookies.Add("my", "cookie"); requestGet.AllowAutoRedirect = false; requestGet.StoreRequestCookie.Should().BeTrue(); requestGet.StoreResponseCookie = false; var responseGet = Subject.Get(requestGet); - var requestCookies = new HttpRequest($"http://{_httpBinHost}/cookies"); + var requestCookies = new HttpRequest($"https://{_httpBinHost}/cookies"); requestCookies.AllowAutoRedirect = false; var responseCookies = Subject.Get(requestCookies); @@ -327,7 +327,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_delete_request_cookie() { - var requestDelete = new HttpRequest($"http://{_httpBinHost}/cookies/delete?my"); + var requestDelete = new HttpRequest($"https://{_httpBinHost}/cookies/delete?my"); requestDelete.Cookies.Add("my", "cookie"); requestDelete.AllowAutoRedirect = true; requestDelete.StoreRequestCookie = false; @@ -342,7 +342,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_clear_request_cookie() { - var requestSet = new HttpRequest($"http://{_httpBinHost}/cookies"); + var requestSet = new HttpRequest($"https://{_httpBinHost}/cookies"); requestSet.Cookies.Add("my", "cookie"); requestSet.AllowAutoRedirect = false; requestSet.StoreRequestCookie = true; @@ -350,7 +350,7 @@ namespace NzbDrone.Common.Test.Http var responseSet = Subject.Get(requestSet); - var requestClear = new HttpRequest($"http://{_httpBinHost}/cookies"); + var requestClear = new HttpRequest($"https://{_httpBinHost}/cookies"); requestClear.Cookies.Add("my", null); requestClear.AllowAutoRedirect = false; requestClear.StoreRequestCookie = true; @@ -364,14 +364,14 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_not_store_response_cookie() { - var requestSet = new HttpRequest($"http://{_httpBinHost}/cookies/set?my=cookie"); + var requestSet = new HttpRequest($"https://{_httpBinHost}/cookies/set?my=cookie"); requestSet.AllowAutoRedirect = false; requestSet.StoreRequestCookie = false; requestSet.StoreResponseCookie.Should().BeFalse(); var responseSet = Subject.Get(requestSet); - var requestCookies = new HttpRequest($"http://{_httpBinHost}/cookies"); + var requestCookies = new HttpRequest($"https://{_httpBinHost}/cookies"); var responseCookies = Subject.Get(requestCookies); @@ -383,14 +383,14 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_store_response_cookie() { - var requestSet = new HttpRequest($"http://{_httpBinHost}/cookies/set?my=cookie"); + var requestSet = new HttpRequest($"https://{_httpBinHost}/cookies/set?my=cookie"); requestSet.AllowAutoRedirect = false; requestSet.StoreRequestCookie = false; requestSet.StoreResponseCookie = true; var responseSet = Subject.Get(requestSet); - var requestCookies = new HttpRequest($"http://{_httpBinHost}/cookies"); + var requestCookies = new HttpRequest($"https://{_httpBinHost}/cookies"); var responseCookies = Subject.Get(requestCookies); @@ -402,7 +402,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_temp_store_response_cookie() { - var requestSet = new HttpRequest($"http://{_httpBinHost}/cookies/set?my=cookie"); + var requestSet = new HttpRequest($"https://{_httpBinHost}/cookies/set?my=cookie"); requestSet.AllowAutoRedirect = true; requestSet.StoreRequestCookie = false; requestSet.StoreResponseCookie.Should().BeFalse(); @@ -417,7 +417,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_overwrite_response_cookie() { - var requestSet = new HttpRequest($"http://{_httpBinHost}/cookies/set?my=cookie"); + var requestSet = new HttpRequest($"https://{_httpBinHost}/cookies/set?my=cookie"); requestSet.Cookies.Add("my", "oldcookie"); requestSet.AllowAutoRedirect = false; requestSet.StoreRequestCookie = false; @@ -425,7 +425,7 @@ namespace NzbDrone.Common.Test.Http var responseSet = Subject.Get(requestSet); - var requestCookies = new HttpRequest($"http://{_httpBinHost}/cookies"); + var requestCookies = new HttpRequest($"https://{_httpBinHost}/cookies"); var responseCookies = Subject.Get(requestCookies); @@ -437,7 +437,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_overwrite_temp_response_cookie() { - var requestSet = new HttpRequest($"http://{_httpBinHost}/cookies/set?my=cookie"); + var requestSet = new HttpRequest($"https://{_httpBinHost}/cookies/set?my=cookie"); requestSet.Cookies.Add("my", "oldcookie"); requestSet.AllowAutoRedirect = true; requestSet.StoreRequestCookie = true; @@ -447,7 +447,7 @@ namespace NzbDrone.Common.Test.Http responseSet.Resource.Cookies.Should().HaveCount(1).And.Contain("my", "cookie"); - var requestCookies = new HttpRequest($"http://{_httpBinHost}/cookies"); + var requestCookies = new HttpRequest($"https://{_httpBinHost}/cookies"); var responseCookies = Subject.Get(requestCookies); @@ -459,7 +459,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_not_delete_response_cookie() { - var requestCookies = new HttpRequest($"http://{_httpBinHost}/cookies"); + var requestCookies = new HttpRequest($"https://{_httpBinHost}/cookies"); requestCookies.Cookies.Add("my", "cookie"); requestCookies.AllowAutoRedirect = false; requestCookies.StoreRequestCookie = true; @@ -468,14 +468,14 @@ namespace NzbDrone.Common.Test.Http responseCookies.Resource.Cookies.Should().HaveCount(1).And.Contain("my", "cookie"); - var requestDelete = new HttpRequest($"http://{_httpBinHost}/cookies/delete?my"); + var requestDelete = new HttpRequest($"https://{_httpBinHost}/cookies/delete?my"); requestDelete.AllowAutoRedirect = false; requestDelete.StoreRequestCookie = false; requestDelete.StoreResponseCookie = false; var responseDelete = Subject.Get(requestDelete); - requestCookies = new HttpRequest($"http://{_httpBinHost}/cookies"); + requestCookies = new HttpRequest($"https://{_httpBinHost}/cookies"); requestCookies.StoreRequestCookie = false; requestCookies.StoreResponseCookie = false; @@ -489,7 +489,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_delete_response_cookie() { - var requestCookies = new HttpRequest($"http://{_httpBinHost}/cookies"); + var requestCookies = new HttpRequest($"https://{_httpBinHost}/cookies"); requestCookies.Cookies.Add("my", "cookie"); requestCookies.AllowAutoRedirect = false; requestCookies.StoreRequestCookie = true; @@ -498,14 +498,14 @@ namespace NzbDrone.Common.Test.Http responseCookies.Resource.Cookies.Should().HaveCount(1).And.Contain("my", "cookie"); - var requestDelete = new HttpRequest($"http://{_httpBinHost}/cookies/delete?my"); + var requestDelete = new HttpRequest($"https://{_httpBinHost}/cookies/delete?my"); requestDelete.AllowAutoRedirect = false; requestDelete.StoreRequestCookie = false; requestDelete.StoreResponseCookie = true; var responseDelete = Subject.Get(requestDelete); - requestCookies = new HttpRequest($"http://{_httpBinHost}/cookies"); + requestCookies = new HttpRequest($"https://{_httpBinHost}/cookies"); requestCookies.StoreRequestCookie = false; requestCookies.StoreResponseCookie = false; @@ -519,7 +519,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_delete_temp_response_cookie() { - var requestCookies = new HttpRequest($"http://{_httpBinHost}/cookies"); + var requestCookies = new HttpRequest($"https://{_httpBinHost}/cookies"); requestCookies.Cookies.Add("my", "cookie"); requestCookies.AllowAutoRedirect = false; requestCookies.StoreRequestCookie = true; @@ -528,7 +528,7 @@ namespace NzbDrone.Common.Test.Http responseCookies.Resource.Cookies.Should().HaveCount(1).And.Contain("my", "cookie"); - var requestDelete = new HttpRequest($"http://{_httpBinHost}/cookies/delete?my"); + var requestDelete = new HttpRequest($"https://{_httpBinHost}/cookies/delete?my"); requestDelete.AllowAutoRedirect = true; requestDelete.StoreRequestCookie = false; requestDelete.StoreResponseCookie = false; @@ -536,7 +536,7 @@ namespace NzbDrone.Common.Test.Http responseDelete.Resource.Cookies.Should().BeEmpty(); - requestCookies = new HttpRequest($"http://{_httpBinHost}/cookies"); + requestCookies = new HttpRequest($"https://{_httpBinHost}/cookies"); requestCookies.StoreRequestCookie = false; requestCookies.StoreResponseCookie = false; @@ -548,7 +548,7 @@ namespace NzbDrone.Common.Test.Http [Test] public void should_throw_on_http429_too_many_requests() { - var request = new HttpRequest($"http://{_httpBinHost}/status/429"); + var request = new HttpRequest($"https://{_httpBinHost}/status/429"); Assert.Throws(() => Subject.Get(request)); @@ -568,7 +568,7 @@ namespace NzbDrone.Common.Test.Http .Setup(v => v.PostResponse(It.IsAny())) .Returns(r => r); - var request = new HttpRequest($"http://{_httpBinHost}/get"); + var request = new HttpRequest($"https://{_httpBinHost}/get"); Subject.Get(request); @@ -590,7 +590,7 @@ namespace NzbDrone.Common.Test.Http { // the date is bad in the below - should be 13-Jul-2026 string malformedCookie = @"__cfduid=d29e686a9d65800021c66faca0a29b4261436890790; expires=Mon, 13-Jul-26 16:19:50 GMT; path=/; HttpOnly"; - var requestSet = new HttpRequestBuilder($"http://{_httpBinHost}/response-headers") + var requestSet = new HttpRequestBuilder($"https://{_httpBinHost}/response-headers") .AddQueryParam("Set-Cookie", malformedCookie) .Build(); @@ -599,7 +599,7 @@ namespace NzbDrone.Common.Test.Http var responseSet = Subject.Get(requestSet); - var request = new HttpRequest($"http://{_httpBinHost}/get"); + var request = new HttpRequest($"https://{_httpBinHost}/get"); var response = Subject.Get(request); @@ -623,7 +623,7 @@ namespace NzbDrone.Common.Test.Http { try { - string url = $"http://{_httpBinHost}/response-headers?Set-Cookie={Uri.EscapeUriString(malformedCookie)}"; + string url = $"https://{_httpBinHost}/response-headers?Set-Cookie={Uri.EscapeUriString(malformedCookie)}"; var requestSet = new HttpRequest(url); requestSet.AllowAutoRedirect = false; @@ -631,7 +631,7 @@ namespace NzbDrone.Common.Test.Http var responseSet = Subject.Get(requestSet); - var request = new HttpRequest($"http://{_httpBinHost}/get"); + var request = new HttpRequest($"https://{_httpBinHost}/get"); var response = Subject.Get(request);