Add config option "split-large-forms"
authorFabian Keil <fk@fabiankeil.de>
Thu, 21 Dec 2006 12:57:48 +0000 (12:57 +0000)
committerFabian Keil <fk@fabiankeil.de>
Thu, 21 Dec 2006 12:57:48 +0000 (12:57 +0000)
to work around the browser bug reported
in BR #1570678.

cgiedit.c
loadcfg.c
project.h

index 5cd0fb3..c50ad20 100644 (file)
--- a/cgiedit.c
+++ b/cgiedit.c
@@ -1,4 +1,4 @@
-const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.43 2006/07/18 14:48:45 david__schmidt Exp $";
+const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.44 2006/12/09 13:49:16 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/cgiedit.c,v $
@@ -42,6 +42,10 @@ const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.43 2006/07/18 14:48:45 david__sch
  *
  * Revisions   :
  *    $Log: cgiedit.c,v $
+ *    Revision 1.44  2006/12/09 13:49:16  fabiankeil
+ *    Fix configure option --disable-toggle.
+ *    Thanks to Peter Thoenen for reporting this.
+ *
  *    Revision 1.43  2006/07/18 14:48:45  david__schmidt
  *    Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
  *    with what was really the latest development (the v_3_0_branch branch)
@@ -3029,6 +3033,35 @@ 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
+    * length limitation and ignore clicks on the Submit buttons if
+    * the resulting GET URL would be longer than their limit.
+    *
+    * In Privoxy 3.0.5 beta the standard edit-actions-for-url template
+    * reached this limit and action editing stopped working in these
+    * browsers (BR #1570678).
+    *
+    * The config option split-large-forms works around this browser
+    * bug (HTTP has no URL lenght 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.
+    *
+    * A better solution would be to switch to POST requests,
+    * but this will do for now.
+    */
+   if(!err && (csp->config->feature_flags & RUNTIME_FEATURE_SPLIT_LARGE_FORMS))
+   {
+      /* Generate multiple smaller form by killing the big one. */
+      err = map_block_killer(exports, "one-form-only");
+   }
+   else
+   {
+      /* Default: Generate one large form by killing the smaller ones. */
+      err = map_block_killer(exports, "multiple-forms");
+   }
+
    for (i = 0; i < MAX_AF_FILES; i++)
    {
       if ((csp->rlist[i] != NULL) && (csp->rlist[i]->f != NULL))
index 57c0e0f..ede63d2 100644 (file)
--- a/loadcfg.c
+++ b/loadcfg.c
@@ -1,4 +1,4 @@
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.55 2006/11/28 15:31:52 fabiankeil Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.56 2006/12/17 17:04:51 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
@@ -35,6 +35,11 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.55 2006/11/28 15:31:52 fabiankeil
  *
  * Revisions   :
  *    $Log: loadcfg.c,v $
+ *    Revision 1.56  2006/12/17 17:04:51  fabiankeil
+ *    Move the <br> in the generated HTML for the config
+ *    options from the beginning of the string to its end.
+ *    Keeps the white space in balance.
+ *
  *    Revision 1.55  2006/11/28 15:31:52  fabiankeil
  *    Fix memory leak in case of config file reloads.
  *
@@ -476,6 +481,7 @@ static struct file_list *current_configfile = NULL;
 #define hash_permit_access             3587953268ul /* "permit-access" */
 #define hash_proxy_info_url            3903079059ul /* "proxy-info-url" */
 #define hash_single_threaded           4250084780ul /* "single-threaded" */
+#define hash_split_large_cgi_forms      671658948ul /* "split-large-cgi-forms" */
 #define hash_suppress_blocklists       1948693308ul /* "suppress-blocklists" */
 #define hash_toggle                        447966ul /* "toggle" */
 #define hash_trust_info_url             430331967ul /* "trust-info-url" */
@@ -676,6 +682,7 @@ struct configuration_spec * load_config(void)
    config->proxy_args                = strdup("");
    config->forwarded_connect_retries = 0;
    config->feature_flags            &= ~RUNTIME_FEATURE_CGI_TOGGLE;
+   config->feature_flags            &= ~RUNTIME_FEATURE_SPLIT_LARGE_FORMS;
 
    if ((configfp = fopen(configfile, "r")) == NULL)
    {
@@ -1303,6 +1310,20 @@ struct configuration_spec * load_config(void)
             config->multi_threaded = 0;
             continue;
 
+/* *************************************************************************
+ * split-large-cgi-forms
+ * *************************************************************************/
+         case hash_split_large_cgi_forms :
+            if ((*arg != '\0') && (0 != atoi(arg)))
+            {
+               config->feature_flags |= RUNTIME_FEATURE_SPLIT_LARGE_FORMS;
+            }
+            else
+            {
+               config->feature_flags &= ~RUNTIME_FEATURE_SPLIT_LARGE_FORMS;
+            }
+            continue;
+
 /* *************************************************************************
  * toggle (0|1)
  * *************************************************************************/
index a652b1b..50df93b 100644 (file)
--- a/project.h
+++ b/project.h
@@ -1,7 +1,7 @@
 #ifndef PROJECT_H_INCLUDED
 #define PROJECT_H_INCLUDED
 /** Version string. */
-#define PROJECT_H_VERSION "$Id: project.h,v 1.82 2006/09/20 15:50:31 fabiankeil Exp $"
+#define PROJECT_H_VERSION "$Id: project.h,v 1.83 2006/12/06 19:26:29 fabiankeil Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/project.h,v $
  *
  * Revisions   :
  *    $Log: project.h,v $
+ *    Revision 1.83  2006/12/06 19:26:29  fabiankeil
+ *    Moved HTTP snipplets into jcc.c. They aren't
+ *    used anywhere else.
+ *
  *    Revision 1.82  2006/09/20 15:50:31  fabiankeil
  *    Doubled size of HOSTENT_BUFFER_SIZE to mask
  *    problems with gethostbyname_r and some
@@ -1423,6 +1427,9 @@ struct access_control_list
 /** configuration_spec::feature_flags: HTTP-header-based toggle. */
 #define RUNTIME_FEATURE_HTTP_TOGGLE       4
 
+/** configuration_spec::feature_flags: Split large forms to limit the number of GET arguments. */
+#define RUNTIME_FEATURE_SPLIT_LARGE_FORMS       8
+
 /**
  * Data loaded from the configuration file.
  *
@@ -1443,6 +1450,7 @@ struct configuration_spec
     * - RUNTIME_FEATURE_CGI_EDIT_ACTIONS
     * - RUNTIME_FEATURE_CGI_TOGGLE
     * - RUNTIME_FEATURE_HTTP_TOGGLE
+    * - RUNTIME_FEATURE_SPLIT_LARGE_FORMS
     */
    unsigned feature_flags;