From 6330a7157d32b0db4f6ea65edfa7d89783c3f691 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Wed, 18 Mar 2020 15:21:58 -0400 Subject: [PATCH] connection closed exception --- cgi.d | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cgi.d b/cgi.d index 05556d0..681fae4 100644 --- a/cgi.d +++ b/cgi.d @@ -495,6 +495,12 @@ mixin template ForwardCgiConstructors() { this(BufferedInputRange ir, bool* closeConnection) { super(ir, closeConnection); } } +/// thrown when a connection is closed remotely while we waiting on data from it +class ConnectionClosedException : Exception { + this(string message, string file = __FILE__, size_t line = __LINE__, Throwable next = null) { + super(message, file, line, next); + } +} version(Windows) { @@ -3968,7 +3974,7 @@ class BufferedInputRange { */ void popFront(size_t maxBytesToConsume = 0 /*size_t.max*/, size_t minBytesToSettleFor = 0, bool skipConsume = false) { if(sourceClosed) - throw new Exception("can't get any more data from a closed source"); + throw new ConnectionClosedException("can't get any more data from a closed source"); if(!skipConsume) consume(maxBytesToConsume);