diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..f45d8f1 --- /dev/null +++ b/renovate.json @@ -0,0 +1,5 @@ +{ + "extends": [ + "config:base" + ] +} diff --git a/uhttpsharp/HttpResponse.cs b/uhttpsharp/HttpResponse.cs index 2afdd59..ea12b1b 100644 --- a/uhttpsharp/HttpResponse.cs +++ b/uhttpsharp/HttpResponse.cs @@ -160,18 +160,18 @@ public sealed class HttpResponse : IHttpResponse private readonly IHttpHeaders _headers; private readonly HttpResponseCode _responseCode; - public HttpResponse(HttpResponseCode code, string content, bool closeConnection) - : this(code, "text/html; charset=utf-8", StringToStream(content), closeConnection) + public HttpResponse(HttpResponseCode code, string content, bool keepAliveConnection) + : this(code, "text/html; charset=utf-8", StringToStream(content), keepAliveConnection) { } - public HttpResponse(HttpResponseCode code, string content, IEnumerable> headers, bool closeConnection) - : this(code, "text/html; charset=utf-8", StringToStream(content), closeConnection,headers) + public HttpResponse(HttpResponseCode code, string content, IEnumerable> headers, bool keepAliveConnection) + : this(code, "text/html; charset=utf-8", StringToStream(content), keepAliveConnection, headers) { } - public HttpResponse(string contentType, Stream contentStream, bool closeConnection) - : this(HttpResponseCode.Ok, contentType, contentStream, closeConnection) + public HttpResponse(string contentType, Stream contentStream, bool keepAliveConnection) + : this(HttpResponseCode.Ok, contentType, contentStream, keepAliveConnection) { } diff --git a/uhttpsharp/Listeners/IHttpListener.cs b/uhttpsharp/Listeners/IHttpListener.cs index 6503765..687efc2 100644 --- a/uhttpsharp/Listeners/IHttpListener.cs +++ b/uhttpsharp/Listeners/IHttpListener.cs @@ -1,9 +1,10 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; using uhttpsharp.Clients; namespace uhttpsharp.Listeners { - public interface IHttpListener + public interface IHttpListener : IDisposable { Task GetClient(); diff --git a/uhttpsharp/Listeners/SslListenerDecoerator.cs b/uhttpsharp/Listeners/SslListenerDecorator.cs similarity index 89% rename from uhttpsharp/Listeners/SslListenerDecoerator.cs rename to uhttpsharp/Listeners/SslListenerDecorator.cs index 8da27f9..4d1986b 100644 --- a/uhttpsharp/Listeners/SslListenerDecoerator.cs +++ b/uhttpsharp/Listeners/SslListenerDecorator.cs @@ -18,6 +18,11 @@ public ListenerSslDecorator(IHttpListener child, X509Certificate certificate) public async Task GetClient() { return new ClientSslDecorator(await _child.GetClient().ConfigureAwait(false), _certificate); + } + + public void Dispose() + { + _child.Dispose(); } } } \ No newline at end of file diff --git a/uhttpsharp/Listeners/TcpListenerAdapter.cs b/uhttpsharp/Listeners/TcpListenerAdapter.cs index db68923..ebc6980 100644 --- a/uhttpsharp/Listeners/TcpListenerAdapter.cs +++ b/uhttpsharp/Listeners/TcpListenerAdapter.cs @@ -17,5 +17,10 @@ public async Task GetClient() { return new TcpClientAdapter(await _listener.AcceptTcpClientAsync().ConfigureAwait(false)); } + + public void Dispose() + { + _listener.Stop(); + } } } \ No newline at end of file diff --git a/uhttpsharp/uhttpsharp.csproj b/uhttpsharp/uhttpsharp.csproj index 404dd0d..e102ab3 100644 --- a/uhttpsharp/uhttpsharp.csproj +++ b/uhttpsharp/uhttpsharp.csproj @@ -101,7 +101,7 @@ - +