X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=cgi.c;h=641af64190cacd041c6f01b3259efaf7442a19b3;hp=eb099fd0ceae065cc09d5fec09e25dd72b9bda86;hb=e37a59aca86ce1f33b5979f7456084b11919b3b7;hpb=126ff944cbdc598e2119bc97f09a430a251bdf3d diff --git a/cgi.c b/cgi.c index eb099fd0..641af641 100644 --- a/cgi.c +++ b/cgi.c @@ -1,4 +1,4 @@ -const char cgi_rcs[] = "$Id: cgi.c,v 1.41 2002/01/17 20:56:22 jongfoster Exp $"; +const char cgi_rcs[] = "$Id: cgi.c,v 1.44 2002/03/05 22:43:45 david__schmidt Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgi.c,v $ @@ -38,6 +38,21 @@ const char cgi_rcs[] = "$Id: cgi.c,v 1.41 2002/01/17 20:56:22 jongfoster Exp $"; * * Revisions : * $Log: cgi.c,v $ + * Revision 1.44 2002/03/05 22:43:45 david__schmidt + * - Better error reporting on OS/2 + * - Fix double-slash comment (oops) + * + * Revision 1.43 2002/03/05 21:33:45 david__schmidt + * - Re-enable OS/2 building after new parms were added + * - Fix false out of memory report when resolving CGI templates when no IP + * address is available of failed attempt (a la no such domain) + * + * Revision 1.42 2002/01/21 00:33:20 jongfoster + * Replacing strsav() with the safer string_append() or string_join(). + * Adding map_block_keep() to save a few bytes in the edit-actions-list HTML. + * Adding missing html_encode() to error message generators. + * Adding edit-actions-section-swap and many "shortcuts" to the list of CGIs. + * * Revision 1.41 2002/01/17 20:56:22 jongfoster * Replacing hard references to the URL of the config interface * with #defines from project.h @@ -682,7 +697,16 @@ struct http_response *error_response(struct client_state *csp, if (!err) err = map(exports, "hostport", 1, html_encode(csp->http->hostport), 0); if (!err) err = map(exports, "path", 1, html_encode(csp->http->path), 0); if (!err) err = map(exports, "error", 1, html_encode_and_free_original(safe_strerror(sys_err)), 0); - if (!err) err = map(exports, "host-ip", 1, html_encode(csp->http->host_ip_addr_str), 0); + if (!err) + { + err = map(exports, "host-ip", 1, html_encode(csp->http->host_ip_addr_str), 0); + if (err) + { + /* Some failures, like "404 no such domain", don't have an IP address. */ + err = map(exports, "host-ip", 1, html_encode(csp->http->host), 0); + } + } + if (err) { @@ -747,7 +771,7 @@ void cgi_init_error_messages(void) "500 Internal JunkBuster Proxy Error\r\n" "\r\n" "

500 Internal JunkBuster Proxy Error

\r\n" - "

JunkBuster ran out of memory whilst processing your request.

\r\n" + "

JunkBuster ran out of memory while processing your request.

\r\n" "

Please contact your proxy administrator, or try again later

\r\n" "\r\n" "\r\n"; @@ -767,9 +791,9 @@ void cgi_init_error_messages(void) * Returns a statically-allocated error response. * * Parameters : - * 1 : csp = Current client state (buffers, headers, etc...) - * 2 : rsp = http_response data structure for output - * 3 : template_name = Name of template that could not + * 1 : csp = Current client state (buffers, headers, etc...) + * 2 : rsp = http_response data structure for output + * 3 : template_name = Name of template that could not * be loaded. * * Returns : JB_ERR_OK on success @@ -795,9 +819,9 @@ struct http_response *cgi_error_memory(void) * parameters. * * Parameters : - * 1 : csp = Current client state (buffers, headers, etc...) - * 2 : rsp = http_response data structure for output - * 3 : template_name = Name of template that could not + * 1 : csp = Current client state (buffers, headers, etc...) + * 2 : rsp = http_response data structure for output + * 3 : template_name = Name of template that could not * be loaded. * * Returns : JB_ERR_OK on success @@ -815,7 +839,7 @@ jb_err cgi_error_no_template(struct client_state *csp, "500 Internal JunkBuster Proxy Error\r\n" "\r\n" "

500 Internal JunkBuster Proxy Error

\r\n" - "

JunkBuster encountered an error whilst processing your request:

\r\n" + "

JunkBuster encountered an error while processing your request:

\r\n" "

Could not load template file "; static const char body_suffix[] = "

\r\n" @@ -871,8 +895,8 @@ jb_err cgi_error_no_template(struct client_state *csp, * (query string) for a CGI were wrong. * * Parameters : - * 1 : csp = Current client state (buffers, headers, etc...) - * 2 : rsp = http_response data structure for output + * 1 : csp = Current client state (buffers, headers, etc...) + * 2 : rsp = http_response data structure for output * * CGI Parameters : none * @@ -1125,10 +1149,10 @@ void free_http_response(struct http_response *rsp) * lines. * * Parameters : - * 1 : csp = Current client state (buffers, headers, etc...) - * 2 : template_ptr = Destination for pointer to loaded + * 1 : csp = Current client state (buffers, headers, etc...) + * 2 : template_ptr = Destination for pointer to loaded * template text. - * 3 : template = name of the HTML template to be used + * 3 : template = name of the HTML template to be used * * Returns : JB_ERR_OK on success * JB_ERR_MEMORY on out-of-memory error. @@ -1224,11 +1248,11 @@ jb_err template_load(struct client_state *csp, char ** template_ptr, * interpretation. * * Parameters : - * 1 : template_ptr = IN: Template to be filled out. + * 1 : template_ptr = IN: Template to be filled out. * Will be free()d. * OUT: Filled out template. * Caller must free(). - * 2 : exports = map with fill in symbol -> name pairs + * 2 : exports = map with fill in symbol -> name pairs * * Returns : JB_ERR_OK on success * JB_ERR_MEMORY on out-of-memory error @@ -1331,9 +1355,9 @@ jb_err template_fill(char **template_ptr, const struct map *exports) * this function also frees the passed "exports" map. * * Parameters : - * 1 : csp = Client state - * 2 : templatename = name of the HTML template to be used - * 3 : exports = map with fill in symbol -> name pairs. + * 1 : csp = Client state + * 2 : templatename = name of the HTML template to be used + * 3 : exports = map with fill in symbol -> name pairs. * Will be freed by this function. * * Returns : JB_ERR_OK on success