+
+
+/*********************************************************************
+ *
+ * Function : cgi_error_404
+ *
+ * Description : CGI function that is called if an unknow action was
+ * given.
+ *
+ * Parameters :
+ * 1 : csp = Current client state (buffers, headers, etc...)
+ * 2 : rsp = http_response data structure for output
+ * 3 : parameters = map of cgi parameters
+ *
+ * Returns : 0
+ *
+ *********************************************************************/
+int cgi_error_404(struct client_state *csp,
+ struct http_response *rsp,
+ struct map *parameters)
+{
+ struct map *exports = default_exports(csp, NULL);
+
+ rsp->status = strdup("404 JunkBuster configuration page not found");
+ rsp->body = template_load(csp, "cgi-error-404");
+ template_fill(&rsp->body, exports);
+ free_map(exports);
+ return 0;
+}
+
+
+/*********************************************************************
+ *
+ * Function : cgi_show_request
+ *
+ * Description : Show the client's request and what sed() would have
+ * made of it.
+ *
+ * Parameters :
+ * 1 : csp = Current client state (buffers, headers, etc...)
+ * 2 : rsp = http_response data structure for output
+ * 3 : parameters = map of cgi parameters
+ *
+ * Returns : 0
+ *
+ *********************************************************************/
+int cgi_show_request(struct client_state *csp, struct http_response *rsp,
+ struct map *parameters)
+{
+ char *p;
+ struct map *exports = default_exports(csp, "show-request");
+
+ /*
+ * Repair the damage done to the IOB by get_header()
+ */
+ for (p = csp->iob->buf; p < csp->iob->eod; p++)
+ {
+ if (*p == '\0') *p = '\n';
+ }
+
+ /*
+ * Export the original client's request and the one we would
+ * be sending to the server if this wasn't a CGI call
+ */
+ map(exports, "client-request", 1, csp->iob->buf, 1);
+ map(exports, "processed-request", 1, sed(client_patterns, add_client_headers, csp), 0);
+
+ rsp->body = template_load(csp, "show-request");
+ template_fill(&rsp->body, exports);
+ free_map(exports);
+ return(0);
+
+}
+
+