Make HTTPClient IDisposable

This commit is contained in:
Michael Nolan 2022-08-26 14:17:21 -05:00
parent 7960b8fff1
commit eea21de38a
11 changed files with 26 additions and 98 deletions

View File

@ -87,7 +87,7 @@ namespace Tesses.Http
} }
public RequestLine RequestLine {get{return p.SentHeaders.FirstLine;} set{p.SentHeaders.FirstLine=value;}} public RequestLine RequestLine {get{return p.SentHeaders.FirstLine;} set{p.SentHeaders.FirstLine=value;}}
} }
public sealed class HTTPClient public sealed class HTTPClient : IDisposable
{ {
TcpClient client; TcpClient client;
Stream strm; Stream strm;
@ -219,6 +219,24 @@ namespace Tesses.Http
return HTTPClient.Open(method,myUrl); return HTTPClient.Open(method,myUrl);
} }
public void Dispose()
{
try{
if(strm != null)
strm.Dispose();
}catch(Exception ex)
{
_=ex;
}
try{
if(client != null)
client.Dispose();
}catch(Exception ex)
{
_=ex;
}
}
} }
public class HTTPClientResponse public class HTTPClientResponse

View File

@ -6,9 +6,9 @@
<PackageId>Tesses.Http</PackageId> <PackageId>Tesses.Http</PackageId>
<Author>Mike Nolan</Author> <Author>Mike Nolan</Author>
<Company>Tesses</Company> <Company>Tesses</Company>
<Version>1.0.2</Version> <Version>1.0.3</Version>
<AssemblyVersion>1.0.2</AssemblyVersion> <AssemblyVersion>1.0.3</AssemblyVersion>
<FileVersion>1.0.2</FileVersion> <FileVersion>1.0.3</FileVersion>
<Description>A Web Server/Client</Description> <Description>A Web Server/Client</Description>
<PackageTags>HTTP, WebServer, WebClient</PackageTags> <PackageTags>HTTP, WebServer, WebClient</PackageTags>
<RepositoryUrl>https://gitlab.tesses.cf/tesses50/tesses.http</RepositoryUrl> <RepositoryUrl>https://gitlab.tesses.cf/tesses50/tesses.http</RepositoryUrl>

View File

@ -1,79 +0,0 @@
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.0/",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETStandard,Version=v2.0": {},
".NETStandard,Version=v2.0/": {
"Tesses.Http/1.0.2": {
"dependencies": {
"MimeTypesMap": "1.0.8",
"NETStandard.Library": "2.0.3",
"Newtonsoft.Json": "13.0.1"
},
"runtime": {
"Tesses.Http.dll": {}
}
},
"Microsoft.NETCore.Platforms/1.1.0": {},
"MimeTypesMap/1.0.8": {
"runtime": {
"lib/netstandard2.0/MimeTypesMap.dll": {
"assemblyVersion": "1.0.8.0",
"fileVersion": "1.0.8.0"
}
}
},
"NETStandard.Library/2.0.3": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
}
},
"Newtonsoft.Json/13.0.1": {
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.1.25517"
}
}
}
}
},
"libraries": {
"Tesses.Http/1.0.2": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Microsoft.NETCore.Platforms/1.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
"path": "microsoft.netcore.platforms/1.1.0",
"hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512"
},
"MimeTypesMap/1.0.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-iOm6Zar+yVROhlyrGGSJTfThvNoHLUeYeQQND9YD/ot/nA2qsWUp9kP2MHTdF9P7I8afW6eCf8vdELLZjDFdSQ==",
"path": "mimetypesmap/1.0.8",
"hashPath": "mimetypesmap.1.0.8.nupkg.sha512"
},
"NETStandard.Library/2.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
"path": "netstandard.library/2.0.3",
"hashPath": "netstandard.library.2.0.3.nupkg.sha512"
},
"Newtonsoft.Json/13.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
"path": "newtonsoft.json/13.0.1",
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
}
}
}

View File

@ -13,11 +13,11 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Tesses")] [assembly: System.Reflection.AssemblyCompanyAttribute("Tesses")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("A Web Server/Client")] [assembly: System.Reflection.AssemblyDescriptionAttribute("A Web Server/Client")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.2")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.3")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.2")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.3")]
[assembly: System.Reflection.AssemblyProductAttribute("Tesses.Http")] [assembly: System.Reflection.AssemblyProductAttribute("Tesses.Http")]
[assembly: System.Reflection.AssemblyTitleAttribute("Tesses.Http")] [assembly: System.Reflection.AssemblyTitleAttribute("Tesses.Http")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.2")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.3")]
[assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://gitlab.tesses.cf/tesses50/tesses.http")] [assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://gitlab.tesses.cf/tesses50/tesses.http")]
// Generated by the MSBuild WriteCodeFragment class. // Generated by the MSBuild WriteCodeFragment class.

View File

@ -1 +1 @@
ef665c6697ab0ceacafd25239c9a77510e969592 474729b5e555789d618d8c5cc2e1056d7996834a

View File

@ -1 +0,0 @@
49567bbfdeef5c942182dce493f3c6aa22656b4c

View File

@ -8,13 +8,3 @@
/home/mike/Documents/Tesses.Http/Tesses.Http/obj/Debug/netstandard2.0/Tesses.Http.csproj.CoreCompileInputs.cache /home/mike/Documents/Tesses.Http/Tesses.Http/obj/Debug/netstandard2.0/Tesses.Http.csproj.CoreCompileInputs.cache
/home/mike/Documents/Tesses.Http/Tesses.Http/obj/Debug/netstandard2.0/Tesses.Http.dll /home/mike/Documents/Tesses.Http/Tesses.Http/obj/Debug/netstandard2.0/Tesses.Http.dll
/home/mike/Documents/Tesses.Http/Tesses.Http/obj/Debug/netstandard2.0/Tesses.Http.pdb /home/mike/Documents/Tesses.Http/Tesses.Http/obj/Debug/netstandard2.0/Tesses.Http.pdb
/home/mike/Documents/Code/WorkingOn/Tesses.Http/Tesses.Http/bin/Debug/netstandard2.0/Tesses.Http.deps.json
/home/mike/Documents/Code/WorkingOn/Tesses.Http/Tesses.Http/bin/Debug/netstandard2.0/Tesses.Http.dll
/home/mike/Documents/Code/WorkingOn/Tesses.Http/Tesses.Http/bin/Debug/netstandard2.0/Tesses.Http.pdb
/home/mike/Documents/Code/WorkingOn/Tesses.Http/Tesses.Http/obj/Debug/netstandard2.0/Tesses.Http.csproj.AssemblyReference.cache
/home/mike/Documents/Code/WorkingOn/Tesses.Http/Tesses.Http/obj/Debug/netstandard2.0/Tesses.Http.GeneratedMSBuildEditorConfig.editorconfig
/home/mike/Documents/Code/WorkingOn/Tesses.Http/Tesses.Http/obj/Debug/netstandard2.0/Tesses.Http.AssemblyInfoInputs.cache
/home/mike/Documents/Code/WorkingOn/Tesses.Http/Tesses.Http/obj/Debug/netstandard2.0/Tesses.Http.AssemblyInfo.cs
/home/mike/Documents/Code/WorkingOn/Tesses.Http/Tesses.Http/obj/Debug/netstandard2.0/Tesses.Http.csproj.CoreCompileInputs.cache
/home/mike/Documents/Code/WorkingOn/Tesses.Http/Tesses.Http/obj/Debug/netstandard2.0/Tesses.Http.dll
/home/mike/Documents/Code/WorkingOn/Tesses.Http/Tesses.Http/obj/Debug/netstandard2.0/Tesses.Http.pdb