X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=cgiedit.c;h=aec3be0fd37c33f93515de8131f4ee81822f6a23;hb=dc06803e26ff2167440e9a3c05a1cd6235611c08;hp=49d9ee062571f0b8a9b5527d0f073c41559862fc;hpb=e72b401da5537a14b29e945944926373cb251825;p=privoxy.git diff --git a/cgiedit.c b/cgiedit.c index 49d9ee06..aec3be0f 100644 --- a/cgiedit.c +++ b/cgiedit.c @@ -1,12 +1,10 @@ -const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.65 2009/03/08 14:19:22 fabiankeil Exp $"; +const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.71 2011/11/18 16:47:08 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgiedit.c,v $ * * Purpose : CGI-based actionsfile editor. * - * Functions declared include: cgi_edit_* - * * NOTE: The CGIs in this file use parameter names * such as "f" and "s" which are really *BAD* choices. * However, I'm trying to save bytes in the @@ -85,10 +83,10 @@ struct file_line { /** Next entry in the linked list */ struct file_line * next; - + /** The raw data, to write out if this line is unmodified. */ char * raw; - + /** Comments and/or whitespace to put before this line if it's modified and then written out. */ char * prefix; @@ -97,7 +95,7 @@ struct file_line are performed on the data read from file before it's stored here, so it will be a single line of data. */ char * unprocessed; - + /** The type of data on this line. One of the FILE_LINE_xxx constants. */ int type; @@ -321,15 +319,10 @@ static jb_err actions_from_radio(const struct map * parameters, static jb_err map_copy_parameter_html(struct map *out, const struct map *in, const char *name); -#if 0 /* unused function */ -static jb_err map_copy_parameter_url(struct map *out, - const struct map *in, - const char *name); -#endif /* unused function */ - -static jb_err get_file_name_param(struct client_state *csp, - const struct map *parameters, - const char *param_name, + +static jb_err get_file_name_param(struct client_state *csp, + const struct map *parameters, + const char *param_name, const char **pfilename); /* Internal convenience functions */ @@ -433,56 +426,6 @@ static jb_err map_copy_parameter_html(struct map *out, } -#if 0 /* unused function */ -/********************************************************************* - * - * Function : map_copy_parameter_url - * - * Description : Copy a CGI parameter from one map to another, URL - * encoding it. - * - * Parameters : - * 1 : out = target map - * 2 : in = source map - * 3 : name = name of cgi parameter to copy - * - * Returns : JB_ERR_OK on success - * JB_ERR_MEMORY on out-of-memory - * JB_ERR_CGI_PARAMS if the parameter doesn't exist - * in the source map - * - *********************************************************************/ -static jb_err map_copy_parameter_url(struct map *out, - const struct map *in, - const char *name) -{ - const char * value; - jb_err err; - - assert(out); - assert(in); - assert(name); - - value = lookup(in, name); - err = map(out, name, 1, url_encode(value), 0); - - if (err) - { - /* Out of memory */ - return err; - } - else if (*value == '\0') - { - return JB_ERR_CGI_PARAMS; - } - else - { - return JB_ERR_OK; - } -} -#endif /* 0 - unused function */ - - /********************************************************************* * * Function : cgi_edit_actions_url_form @@ -707,7 +650,7 @@ jb_err cgi_edit_actions_remove_url_form(struct client_state *csp, if (cur_line->type == FILE_LINE_ACTION) { section_start_line_number = line_number; - } + } cur_line = cur_line->next; } @@ -1483,7 +1426,7 @@ jb_err edit_read_file_lines(FILE *fp, struct file_line ** pfile, int *newline) if (rval) { /* Out of memory or empty file. */ - /* Note that empty file is not an error we propogate up */ + /* Note that empty file is not an error we propagate up */ free(cur_line); return ((rval == JB_ERR_FILE) ? JB_ERR_OK : rval); } @@ -1588,7 +1531,7 @@ jb_err edit_read_file(struct client_state *csp, * Probably an old-school URL like * http://config.privoxy.org/edit-actions-list?f=default */ - err = get_file_name_param(csp, parameters, "f", &filename); + get_file_name_param(csp, parameters, "f", &filename); } if (NULL == filename || stat(filename, statbuf) < 0) @@ -1734,7 +1677,7 @@ jb_err edit_read_actions_file(struct client_state *csp, { log_error(LOG_LEVEL_INFO, "Timestamp mismatch limit reached, turning CGI editor off. " - "Reload the configuration file to reenable it."); + "Reload the configuration file to re-enable it."); csp->config->feature_flags &= ~RUNTIME_FEATURE_CGI_EDIT_ACTIONS; } } @@ -2873,7 +2816,7 @@ jb_err cgi_edit_actions_for_url(struct client_state *csp, if (!err) err = actions_to_radio(exports, cur_line->data.action); /* - * XXX: Some browsers (at least IE6 and IE7) have an artifical URL + * XXX: Some browsers (at least IE6 and IE7) have an artificial URL * length limitation and ignore clicks on the Submit buttons if * the resulting GET URL would be longer than their limit. * @@ -2882,7 +2825,7 @@ jb_err cgi_edit_actions_for_url(struct client_state *csp, * browsers (BR #1570678). * * The config option split-large-forms works around this browser - * bug (HTTP has no URL lenght limitation) by deviding the action + * bug (HTTP has no URL length limitation) by deviding the action * list form into multiple smaller ones. It means the URLs are shorter * and work in broken browsers as well, but the user can no longer change * all actions with one submit. @@ -3415,7 +3358,7 @@ jb_err cgi_edit_actions_url(struct client_state *csp, if (cur_line->type == FILE_LINE_ACTION) { section_start_line_number = line_number; - } + } cur_line = cur_line->next; line_number++; } @@ -4183,7 +4126,7 @@ jb_err cgi_edit_actions_section_swap(struct client_state *csp, * * Description : Converts a string into a form JavaScript will like. * - * Netscape 4's JavaScript sucks - it doesn't use + * Netscape 4's JavaScript sucks - it doesn't use * "id" parameters, so you have to set the "name" * used to submit a form element to something JavaScript * will like. (Or access the elements by index in an