This commit is contained in:
2020-06-08 23:42:40 +00:00
parent 4e13b3c9bb
commit 937e9c5907
18 changed files with 119 additions and 83 deletions

View File

@@ -21,13 +21,18 @@ namespace rockfishCore.Util
private const string S3_HOST_ENDPOINT = "https://nyc3.digitaloceanspaces.com";
private const string S3_BUCKET_NAME = "gztw1";
private static HttpClient Client = new HttpClient();
private static readonly HttpClient _httpClient;
static OpsDiagnostics()
{
_httpClient = new HttpClient();
}
public static bool CheckWebsite(string url, string mustContain)
{
bool Result = false;
var Response = Client.GetAsync(url).Result;
var Response = _httpClient.GetAsync(url).Result;
if (Response.IsSuccessStatusCode)
{
var PageText = Response.Content.ReadAsStringAsync().Result;
@@ -73,9 +78,11 @@ namespace rockfishCore.Util
}
};
var httpClient = new HttpClient(httpClientHandler);
await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, url));
using (var httpClient = new HttpClient(httpClientHandler))
{
await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, url));
//httpClient.Dispose();
}
return ret;
}