X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=cgisimple.c;h=76eef051b95f6046db6f0a6e7f8663c26bc1b2cb;hb=3e7e5c6d755d68d16c1bca4305ec7032884e8146;hp=22f5dd8b3f7b14b922d349ff4bc979ccd2035aae;hpb=40cb7c21bb922a5a9c56a652e4ff357bc187a4f9;p=privoxy.git diff --git a/cgisimple.c b/cgisimple.c index 22f5dd8b..76eef051 100644 --- a/cgisimple.c +++ b/cgisimple.c @@ -1,4 +1,4 @@ -const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.49 2007/01/20 16:29:38 fabiankeil Exp $"; +const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.51 2007/02/10 16:55:22 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgisimple.c,v $ @@ -36,6 +36,13 @@ const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.49 2007/01/20 16:29:38 fabian * * Revisions : * $Log: cgisimple.c,v $ + * Revision 1.51 2007/02/10 16:55:22 fabiankeil + * - Show forwarding settings on the show-url-info page + * - Fix some HTML syntax errors. + * + * Revision 1.50 2007/01/23 15:51:17 fabiankeil + * Add favicon delivery functions. + * * Revision 1.49 2007/01/20 16:29:38 fabiankeil * Suppress edit buttons for action files if Privoxy has * no write access. Suggested by Roland in PR 1564026. @@ -902,15 +909,7 @@ jb_err cgi_send_user_manual(struct client_state *csp, } /* Open user-manual file */ -#ifdef WIN32 - /* - * XXX: Do we support other operating systems that - * require special treatment to fopen in binary mode? - */ if (NULL == (fp = fopen(full_path, "rb"))) -#else - if (NULL == (fp = fopen(full_path, "r"))) -#endif /* def WIN32 */ { log_error(LOG_LEVEL_ERROR, "Cannot open user-manual file %s: %E", full_path); err = cgi_error_no_template(csp, rsp, full_path); @@ -934,7 +933,7 @@ jb_err cgi_send_user_manual(struct client_state *csp, if (!fread(rsp->body, length, 1, fp)) { /* - * This happens if we didn't fopen in binary mode. + * May happen if the file size changes between fseek() and fread(). * If it does, we just log it and serve what we got. */ log_error(LOG_LEVEL_ERROR, "Couldn't completely read user-manual file %s.", full_path); @@ -1487,7 +1486,7 @@ jb_err cgi_show_url_info(struct client_state *csp, } } - matches = strdup(""); + matches = strdup("
"); for (i = 0; i < MAX_AF_FILES; i++) { @@ -1524,7 +1523,7 @@ jb_err cgi_show_url_info(struct client_state *csp, { string_append(&matches, "\n"); @@ -1547,9 +1546,62 @@ jb_err cgi_show_url_info(struct client_state *csp, } string_append(&matches, "
{"); string_join (&matches, actions_to_html(csp, b->action)); - string_append(&matches, " }
\n"); + string_append(&matches, " }
\n"); string_join (&matches, html_encode(b->url->spec)); string_append(&matches, "
\n"); + /* + * Fill in forwarding settings. + * + * The possibilities are: + * - no forwarding + * - http forwarding only + * - socks4(a) forwarding only + * - socks4(a) and http forwarding. + * + * XXX: Parts of this code could be reused for the + * "forwarding-failed" template which currently doesn't + * display the proxy port and an eventuell second forwarder. + */ + { + const struct forward_spec * fwd = forward_url(url_to_query, csp); + + if ((fwd->gateway_host == NULL) && (fwd->forward_host == NULL)) + { + if (!err) err = map_block_killer(exports, "socks-forwarder"); + if (!err) err = map_block_killer(exports, "http-forwarder"); + } + else + { + char port[10]; /* We save proxy ports as int but need a string here */ + + if (!err) err = map_block_killer(exports, "no-forwarder"); + + if (fwd->gateway_host != NULL) + { + if (!err) err = map(exports, "socks-type", 1, (fwd->type == SOCKS_4) ? + "socks4" : "socks4a", 1); + if (!err) err = map(exports, "gateway-host", 1, fwd->gateway_host, 1); + snprintf(port, sizeof(port), "%d", fwd->gateway_port); + if (!err) err = map(exports, "gateway-port", 1, port, 1); + } + else + { + if (!err) err = map_block_killer(exports, "socks-forwarder"); + } + + if (fwd->forward_host != NULL) + { + if (!err) err = map(exports, "forward-host", 1, fwd->forward_host, 1); + snprintf(port, sizeof(port), "%d", fwd->forward_port); + if (!err) err = map(exports, "forward-port", 1, port, 1); + } + else + { + if (!err) err = map_block_killer(exports, "http-forwarder"); + } + } + } + free_http_request(url_to_query); - if (matches == NULL) + if (err || matches == NULL) { free_current_action(action); free_map(exports);