From c20375a8df7a1a54e3322d9c3bc4812049560747 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Mon, 25 Jan 2021 21:06:57 -0500 Subject: [PATCH] catch usage error before segfault --- http2.d | 2 ++ 1 file changed, 2 insertions(+) diff --git a/http2.d b/http2.d index 06406b3..0682c69 100644 --- a/http2.d +++ b/http2.d @@ -966,6 +966,8 @@ class HttpRequest { socket.connect(new UnixAddress(unixSocketPath)); } else { // FIXME: i should prolly do ipv6 if available too. + if(host.length == 0) // this could arguably also be an in contract since it is user error, but the exception is good enough + throw new Exception("No host given for request"); socket.connect(new InternetAddress(host, port)); }