From 5f862bf5a73699655615c4b52e3fc251df547fcd Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Fri, 8 Dec 2006 14:45:32 +0000 Subject: [PATCH] Don't lose the FORCE_PREFIX in case of connection problems. Fixes #612235. --- ChangeLog | 2 ++ cgi.c | 30 ++++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e2feb723..65e4f8e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,8 @@ ChangeLog for Privoxy pages are no longer padded with garbage data. - Fixed small memory leak in case of config file reloads. - Only unlink the pidfile if it's actually used. +- Retries after connection problems with forced requests + aren't blocked again. *** Version 3.0.6 *** diff --git a/cgi.c b/cgi.c index da9d0870..45f18d42 100644 --- a/cgi.c +++ b/cgi.c @@ -1,4 +1,4 @@ -const char cgi_rcs[] = "$Id: cgi.c,v 1.78 2006/09/21 19:22:07 fabiankeil Exp $"; +const char cgi_rcs[] = "$Id: cgi.c,v 1.79 2006/11/13 19:05:50 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgi.c,v $ @@ -38,6 +38,16 @@ const char cgi_rcs[] = "$Id: cgi.c,v 1.78 2006/09/21 19:22:07 fabiankeil Exp $"; * * Revisions : * $Log: cgi.c,v $ + * Revision 1.79 2006/11/13 19:05:50 fabiankeil + * Make pthread mutex locking more generic. Instead of + * checking for OSX and OpenBSD, check for FEATURE_PTHREAD + * and use mutex locking unless there is an _r function + * available. Better safe than sorry. + * + * Fixes "./configure --disable-pthread" and should result + * in less threading-related problems on pthread-using platforms, + * but it still doesn't fix BR#1122404. + * * Revision 1.78 2006/09/21 19:22:07 fabiankeil * Use CGI_PREFIX to check the referrer. * The check for "http://config.privoxy.org/" fails @@ -1228,7 +1238,9 @@ struct http_response *error_response(struct client_state *csp, { jb_err err; struct http_response *rsp; - struct map * exports = default_exports(csp, NULL); + struct map *exports = default_exports(csp, NULL); + char *path = NULL; + if (exports == NULL) { return cgi_error_memory(); @@ -1240,9 +1252,19 @@ struct http_response *error_response(struct client_state *csp, return cgi_error_memory(); } - err = map(exports, "host", 1, html_encode(csp->http->host), 0); + if (csp->flags & CSP_FLAG_FORCED) + { + path = strdup(FORCE_PREFIX); + } + else + { + path = strdup(""); + } + err = string_append(&path, csp->http->path); + + if (!err) err = map(exports, "host", 1, html_encode(csp->http->host), 0); 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, "path", 1, html_encode_and_free_original(path), 0); if (!err) err = map(exports, "error", 1, html_encode_and_free_original(safe_strerror(sys_err)), 0); if (!err) err = map(exports, "protocol", 1, csp->http->ssl ? "https://" : "http://", 1); if (!err) -- 2.39.2