mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-03-06 13:43:57 +00:00
DnsWebService: removed https timeout code in TlsToHttpTunnelAsync() and letting the http server to do timeout to avoid getting connection reset when downloading files.
This commit is contained in:
@@ -85,7 +85,6 @@ namespace DnsServerCore
|
||||
string _webServiceTlsCertificatePath;
|
||||
string _webServiceTlsCertificatePassword;
|
||||
DateTime _webServiceTlsCertificateLastModifiedOn;
|
||||
const int HTTPS_REQUEST_TIMEOUT = 60000;
|
||||
|
||||
HttpListener _webService;
|
||||
IReadOnlyList<Socket> _webServiceTlsListeners;
|
||||
@@ -305,21 +304,7 @@ namespace DnsServerCore
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
HttpRequest httpRequest;
|
||||
{
|
||||
Task<HttpRequest> task = HttpRequest.ReadRequestAsync(sslStream);
|
||||
|
||||
using (CancellationTokenSource timeoutCancellationTokenSource = new CancellationTokenSource())
|
||||
{
|
||||
if (await Task.WhenAny(task, Task.Delay(HTTPS_REQUEST_TIMEOUT, timeoutCancellationTokenSource.Token)) != task)
|
||||
return; //request timed out
|
||||
|
||||
timeoutCancellationTokenSource.Cancel(); //cancel delay task
|
||||
}
|
||||
|
||||
httpRequest = await task;
|
||||
}
|
||||
|
||||
HttpRequest httpRequest = await HttpRequest.ReadRequestAsync(sslStream);
|
||||
if (httpRequest == null)
|
||||
return; //connection closed gracefully by client
|
||||
|
||||
|
||||
Reference in New Issue
Block a user