mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
dispose of IDisposable w/using
This commit is contained in:
parent
7a0b05ac2a
commit
40b6bf4406
1 changed files with 2 additions and 3 deletions
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
|
|
@ -74,7 +73,7 @@ public async Task<UrlValidationResult> ValidateAsync(Uri u, CancellationToken ca
|
|||
|
||||
try
|
||||
{
|
||||
var response =
|
||||
using var response =
|
||||
await _httpClient.GetAsync(u, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
|
||||
if (u.Scheme == Uri.UriSchemeHttp && await IsHttpsSupported(u, cancellationToken))
|
||||
result.SetSupportsHttps();
|
||||
|
|
@ -118,7 +117,7 @@ private async Task<bool> IsHttpsSupported(Uri url, CancellationToken cancellatio
|
|||
var httpsUrl = new UriBuilder(url.OriginalString) {Scheme = Uri.UriSchemeHttps}.Uri;
|
||||
try
|
||||
{
|
||||
var response = await _httpClient.GetAsync(httpsUrl, HttpCompletionOption.ResponseHeadersRead,
|
||||
using var response = await _httpClient.GetAsync(httpsUrl, HttpCompletionOption.ResponseHeadersRead,
|
||||
cancellationToken);
|
||||
if (response.IsSuccessStatusCode)
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue