From: Lee Date: Sun, 10 Jan 2010 13:53:49 +0000 (+0000) Subject: Workaround for firefox hanging on blocked javascript pages X-Git-Tag: v_3_0_16~80 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=54b4e8c141117d636f6113ec4c43579248b77ed7 Workaround for firefox hanging on blocked javascript pages --- diff --git a/doc/source/p-config.sgml b/doc/source/p-config.sgml index 8594df00..44570e66 100644 --- a/doc/source/p-config.sgml +++ b/doc/source/p-config.sgml @@ -3,7 +3,7 @@ Purpose : Used with other docs and files only. - $Id: p-config.sgml,v 2.54 2009/11/27 13:47:34 fabiankeil Exp $ + $Id: p-config.sgml,v 2.55 2009/12/15 17:43:40 fabiankeil Exp $ Copyright (C) 2001-2009 Privoxy Developers http://www.privoxy.org/ See LICENSE. @@ -97,7 +97,7 @@ Sample Configuration File for Privoxy v&p-version; - $Id: p-config.sgml,v 2.54 2009/11/27 13:47:34 fabiankeil Exp $ + $Id: p-config.sgml,v 2.55 2009/12/15 17:43:40 fabiankeil Exp $ Copyright (C) 2001-2009 Privoxy Developers http://www.privoxy.org/ @@ -2868,6 +2868,64 @@ forward-socks4, forward-socks4a and forward-socks5 +handle-as-empty-doc-returns-ok + + + Note: + + + This is a work-around for Firefox bug 492459: + + Websites are no longer rendered if SSL requests for JavaScripts are blocked by a proxy. + + ( + https://bugzilla.mozilla.org/show_bug.cgi?id=492459) + + + + + Specifies: + + + The status code Privoxy returns for pages blocked with + +handle-as-empty-document. + + + + + Type of value: + + + 0 or 1 + + + + + Default value: + + 0 + + + + Effect if unset: + + + Privoxy returns a status 403(forbidden) for all blocked pages. + + + Effect if set: + + + Privoxy returns a status 200(OK) for pages blocked with +handle-as-empty-document + and a status 403(Forbidden) for all other blocked pages. + + + + +@@#handle-as-empty-doc-returns-ok 0]]> + + + diff --git a/filters.c b/filters.c index 219c5818..d122d841 100644 --- a/filters.c +++ b/filters.c @@ -1,4 +1,4 @@ -const char filters_rcs[] = "$Id: filters.c,v 1.124 2009/08/19 15:24:30 fabiankeil Exp $"; +const char filters_rcs[] = "$Id: filters.c,v 1.125 2009/10/25 15:23:40 ler762 Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/filters.c,v $ @@ -702,7 +702,21 @@ struct http_response *block_url(struct client_state *csp) rsp->body = strdup(" "); rsp->content_length = 1; - rsp->status = strdup("403 Request blocked by Privoxy"); + if (csp->config->feature_flags & RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK) + { + /* + * Workaround for firefox bug 492459 + * https://bugzilla.mozilla.org/show_bug.cgi?id=492459 + * Return a 200 OK status for pages blocked with +handle-as-empty-document + * if the "handle-as-empty-doc-returns-ok" runtime config option is set. + */ + rsp->status = strdup("200 Request blocked by Privoxy"); + } + else + { + rsp->status = strdup("403 Request blocked by Privoxy"); + } + if (rsp->status == NULL) { free_http_response(rsp); diff --git a/loadcfg.c b/loadcfg.c index b5512d7c..5f88d752 100644 --- a/loadcfg.c +++ b/loadcfg.c @@ -1,4 +1,4 @@ -const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.107 2009/11/27 13:46:47 fabiankeil Exp $"; +const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.108 2010/01/03 12:37:14 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $ @@ -148,6 +148,7 @@ static struct file_list *current_configfile = NULL; #define hash_forward_socks4a 2639958518ul /* "forward-socks4a" */ #define hash_forward_socks5 3963965522ul /* "forward-socks5" */ #define hash_forwarded_connect_retries 101465292ul /* "forwarded-connect-retries" */ +#define hash_handle_as_empty_returns_ok 1444873247ul /* "handle-as-empty-doc-returns-ok" */ #define hash_hostname 10308071ul /* "hostname" */ #define hash_keep_alive_timeout 3878599515ul /* "keep-alive-timeout" */ #define hash_listen_address 1255650842ul /* "listen-address" */ @@ -367,6 +368,7 @@ struct configuration_spec * load_config(void) config->feature_flags &= ~RUNTIME_FEATURE_CGI_TOGGLE; config->feature_flags &= ~RUNTIME_FEATURE_SPLIT_LARGE_FORMS; config->feature_flags &= ~RUNTIME_FEATURE_ACCEPT_INTERCEPTED_REQUESTS; + config->feature_flags &= ~RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK; configfp = fopen(configfile, "r"); if (NULL == configfp) @@ -911,6 +913,26 @@ struct configuration_spec * load_config(void) config->forwarded_connect_retries = atoi(arg); break; +/* ************************************************************************* + * handle-as-empty-doc-returns-ok 0|1 + * + * Workaround for firefox hanging on blocked javascript pages. + * Block with the "+handle-as-empty-document" flag and set the + * "handle-as-empty-doc-returns-ok" run-time config flag so that + * Privoxy returns a 200/OK status instead of a 403/Forbidden status + * to the browser for blocked pages. + ***************************************************************************/ + case hash_handle_as_empty_returns_ok: + if ((*arg != '\0') && (0 != atoi(arg))) + { + config->feature_flags |= RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK; + } + else + { + config->feature_flags &= ~RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK; + } + break; + /* ************************************************************************* * hostname hostname-to-show-on-cgi-pages * *************************************************************************/ diff --git a/project.h b/project.h index ae80b49a..e5c076d6 100644 --- 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.152 2009/11/08 17:54:09 ler762 Exp $" +#define PROJECT_H_VERSION "$Id: project.h,v 1.153 2009/11/27 13:46:47 fabiankeil Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/project.h,v $ @@ -1148,6 +1148,9 @@ struct access_control_list /** configuration_spec::feature_flags: Share outgoing connections between different client connections. */ #define RUNTIME_FEATURE_CONNECTION_SHARING 256U +/** configuration_spec::feature_flags: Pages blocked with +handle-as-empty-doc get a return status of 200 OK. */ +#define RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK 512U + /** * Data loaded from the configuration file. * @@ -1174,6 +1177,7 @@ struct configuration_spec * - RUNTIME_FEATURE_CGI_CRUNCHING * - RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE * - RUNTIME_FEATURE_CONNECTION_SHARING + * - RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK */ unsigned feature_flags;