diff --git a/ln.http/HttpRequest.cs b/ln.http/HttpRequest.cs
index 29b3d50..cd69139 100644
--- a/ln.http/HttpRequest.cs
+++ b/ln.http/HttpRequest.cs
@@ -96,6 +96,10 @@ namespace ln.http
void ReadRequestLine()
{
string requestLine = connectionReader.ReadLine();
+
+ if (requestLine == null)
+ throw new ConnectionClosedException("UnbufferedStreamReader.ReadLine() returned null");
+
string[] requestTokens = requestLine.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
if (requestTokens.Length != 3)
diff --git a/ln.http/connections/Connection.cs b/ln.http/connections/Connection.cs
index 4b40f2c..904c339 100644
--- a/ln.http/connections/Connection.cs
+++ b/ln.http/connections/Connection.cs
@@ -12,6 +12,8 @@ using ln.type;
using System.IO;
using ln.logging;
using ln.http.listener;
+using ln.http.exceptions;
+
namespace ln.http.connections
{
public abstract class Connection : IDisposable
@@ -34,6 +36,9 @@ namespace ln.http.connections
{
return new HttpRequest(httpServer, GetStream(), Listener.LocalEndpoint, new Endpoint(RemoteHost, RemotePort));
} catch (IOException)
+ {
+ return null;
+ } catch (ConnectionClosedException)
{
return null;
} catch (Exception e)
diff --git a/ln.http/exceptions/ConnectionClosedException.cs b/ln.http/exceptions/ConnectionClosedException.cs
new file mode 100644
index 0000000..ab67122
--- /dev/null
+++ b/ln.http/exceptions/ConnectionClosedException.cs
@@ -0,0 +1,13 @@
+using System;
+
+namespace ln.http.exceptions
+{
+
+ public class ConnectionClosedException : Exception
+ {
+ public ConnectionClosedException(string message) : base(message) { }
+
+ public ConnectionClosedException(){ }
+ }
+
+}
diff --git a/ln.http/ln.http.csproj b/ln.http/ln.http.csproj
index 1b09fb1..c4f44a4 100644
--- a/ln.http/ln.http.csproj
+++ b/ln.http/ln.http.csproj
@@ -3,14 +3,12 @@
netcoreapp3.1
true
- 0.1.1
+ 0.1.2
Harald Wolff-Thobaben
l--n.de
(c) 2020 Harald Wolff-Thobaben
http server
- 0.0.1.0
- 0.0.1.0