From: jongfoster Date: Sun, 14 Oct 2001 22:00:32 +0000 (+0000) Subject: Adding support for a 404 error when an invalid CGI page is requested. X-Git-Tag: v_2_9_10~132 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=68804878a2e22c8ff9393a157ddfd8c050bf6cf3 Adding support for a 404 error when an invalid CGI page is requested. --- diff --git a/cgisimple.c b/cgisimple.c index 005a83f1..fcf71e7e 100644 --- a/cgisimple.c +++ b/cgisimple.c @@ -1,4 +1,4 @@ -const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.4 2001/10/02 15:31:12 oes Exp $"; +const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.5 2001/10/07 15:30:41 oes Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgisimple.c,v $ @@ -36,6 +36,9 @@ const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.4 2001/10/02 15:31:12 oes Exp * * Revisions : * $Log: cgisimple.c,v $ + * Revision 1.5 2001/10/07 15:30:41 oes + * Removed FEATURE_DENY_GZIP + * * Revision 1.4 2001/10/02 15:31:12 oes * Introduced show-request cgi * @@ -129,6 +132,37 @@ int cgi_default(struct client_state *csp, struct http_response *rsp, } + + +/********************************************************************* + * + * 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 diff --git a/cgisimple.h b/cgisimple.h index 37f9b200..6be066d9 100644 --- a/cgisimple.h +++ b/cgisimple.h @@ -1,6 +1,6 @@ #ifndef CGISIMPLE_H_INCLUDED #define CGISIMPLE_H_INCLUDED -#define CGISIMPLE_H_VERSION "$Id: cgisimple.h,v 1.1 2001/09/16 17:08:54 jongfoster Exp $" +#define CGISIMPLE_H_VERSION "$Id: cgisimple.h,v 1.2 2001/10/02 15:31:20 oes Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgisimple.h,v $ @@ -38,6 +38,9 @@ * * Revisions : * $Log: cgisimple.h,v $ + * Revision 1.2 2001/10/02 15:31:20 oes + * Introduced show-request cgi + * * Revision 1.1 2001/09/16 17:08:54 jongfoster * Moving simple CGI functions from cgi.c to new file cgisimple.c * @@ -57,6 +60,9 @@ extern "C" { extern int cgi_default (struct client_state *csp, struct http_response *rsp, struct map *parameters); +extern int cgi_error_404 (struct client_state *csp, + struct http_response *rsp, + struct map *parameters); extern int cgi_robots_txt (struct client_state *csp, struct http_response *rsp, struct map *parameters); diff --git a/templates/cgi-error-404 b/templates/cgi-error-404 new file mode 100644 index 00000000..d7d7ed6b --- /dev/null +++ b/templates/cgi-error-404 @@ -0,0 +1,138 @@ +########################################################## +# +# No-Such-Domain Error Output template for junkbuster 2.9.x. +# +# +# USING HTML TEMPLATES: +# --------------------- +# +# Template files are written win plain HTML, with a few +# additions: +# +# - Lines that start with a '#' character like this one +# are ignored +# +# - Each item in the below list of exported symbols will +# be replaced by dynamically generated text, if they +# are enclosed in '@'-characters. E.g. The string @version@ +# will be replaced by the version number of Junkbuster. +# +# - One special application of this is to make whole blocks +# of the HTML template disappear if the condition +# is not given. Simply enclose the block between the two +# strings @if-start and if--end@. The strings +# should be placed in HTML comments (), so the +# html structure won't be messed when the magic happens. +# +# USABLE SYMBOLS IN THIS TEMPLATE: +# -------------------------------- +# +# my-ip-addr: +# The IP-address that the client used to reach this proxy +# my-hostname: +# The hostname associated with my-ip-addr +# admin-address: +# The email address of the pxoxy's administrator, as configured +# in the config file +# default-cgi: +# The URL for the "main menu" builtin CGI of this proxy +# menu: +# List of
  • elements linking to the other available CGIs +# version: +# The version number of the proxy software +# code-status: +# The development status of the proxy software: "alpha", "beta", +# or "stable". +# homepage: +# The URL of the SourceForge ijbswa project, who maintains this +# software. +# +# CONDITIONAL SYMBOLS FOR THIS TEMPLATE AND THEIR DEPANDANT SYMBOLS: +# ------------------------------------------------------------------ +# +# unstable: +# this is an alpha or beta release of the proxy software +# have-proxy-info: +# A URL for online documentation about this proxy has been +# specified and is available through the "proxy-info-url" +# symbol +# + + + + 404 - JunkBuster Configuration Page not found + + + + + + + + + + + + +# This will only appear if CODE_STATUS is "alpha" or "beta". See configure.in + + + + + + + + + + + + + + + + +
    +

    404

    +
    +

    This is the Internet JUNKBUSTER + @version@ on @my-hostname@ (@my-ip-address@), port @my-port@

    +
    +

    Please note that this @code-status@ release + of the proxy software is not intended for production systems! +
    Use at your own risk. See the license for details.
    +

    + +

    Feel free to mail the developers + with any problems you encounter. +

    +
    +

    JunkBuster Configuration page not found

    +
    +

    You typed in what looks like a URL used to configure + JunkBuster, but it cannot be recognised. Maybe it's + for a different JunkBuster version, or you typed it + in wrong? Or maybe the JunkBuster administrator + has decided to disable the feature.

    +

    If you got here by clicking a link in the + configuration interface, please file a bug report!

    +

    You can use the menu below to select from the available + configuration options

    +
    +
    +

    More Junkbuster:

    +
      @menu@
    +
    +

    If you have any questions about this service, + + + consult the online documentation or + + + send mail to @admin-address@ + who will be glad to help you. +

    +
    + + +