From 5b38267e0979f4fe60977830300b2f890998c4e9 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Sun, 5 Feb 2012 18:21:11 -0500 Subject: [PATCH] would never answer the browser if cgi threw --- httpd.d | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/httpd.d b/httpd.d index def1571..37dbb06 100644 --- a/httpd.d +++ b/httpd.d @@ -78,6 +78,8 @@ class HttpdConnection(CustomCgi) : Connection /* if(is(CustomCgi : Cgi)) */ { state = 0; separator = "\r\n"; + // writeln("FINISHED"); + scope(exit) { if(closeConnection) disconnect(); @@ -106,6 +108,8 @@ class HttpdConnection(CustomCgi) : Connection /* if(is(CustomCgi : Cgi)) */ { } catch(Throwable e) { cgi.setResponseStatus("500 Internal Server Error"); cgi.write(e.toString()); + cgi.close(); + cgi.dispose(); return; } @@ -114,6 +118,8 @@ class HttpdConnection(CustomCgi) : Connection /* if(is(CustomCgi : Cgi)) */ { override void onDataReceived(){ auto a = read(); + // writeln("data received ", state, "\n", cast(string) a); + more: switch(state) { default: assert(0);