From 5b4704b5eeaef403c7b79cbced500f23f9eea08e Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Thu, 3 Mar 2011 14:42:18 +0000 Subject: [PATCH] Add a proper CGI message for cgi_die(). --- cgisimple.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/cgisimple.c b/cgisimple.c index 81fab06f..0a6c7794 100644 --- a/cgisimple.c +++ b/cgisimple.c @@ -1,4 +1,4 @@ -const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.105 2011/02/14 16:07:32 fabiankeil Exp $"; +const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.106 2011/02/14 16:07:52 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgisimple.c,v $ @@ -181,6 +181,20 @@ jb_err cgi_die (struct client_state *csp, struct http_response *rsp, const struct map *parameters) { + static const char status[] = "200 OK Privoxy shutdown request received"; + static const char body[] = + "\n" + "\n" + " Privoxy shutdown request received\n" + " \n" + " \n" + "\n" + "\n" + "

Privoxy shutdown request received

\n" + "

Privoxy is going to shut down after the next request.

\n" + "\n" + "\n"; + assert(csp); assert(rsp); assert(parameters); @@ -188,12 +202,19 @@ jb_err cgi_die (struct client_state *csp, /* quit */ g_terminate = 1; - /* - * I don't really care what gets sent back to the browser. - * Take the easy option - "out of memory" page. - */ + rsp->content_length = 0; + rsp->head_length = 0; + rsp->is_static = 0; - return JB_ERR_MEMORY; + rsp->body = strdup(body); + rsp->status = strdup(status); + + if ((rsp->body == NULL) || (rsp->status == NULL)) + { + return JB_ERR_MEMORY; + } + + return JB_ERR_OK; } #endif /* def FEATURE_GRACEFUL_TERMINATION */ -- 2.39.2