From: Fabian Keil <fk@fabiankeil.de>
Date: Fri, 8 Dec 2006 14:45:32 +0000 (+0000)
Subject: Don't lose the FORCE_PREFIX in case of
X-Git-Tag: v_3_0_7~464
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/developer-manual/faq/static/@default-cgi@?a=commitdiff_plain;h=5f862bf5a73699655615c4b52e3fc251df547fcd;p=privoxy.git

Don't lose the FORCE_PREFIX in case of
connection problems. Fixes #612235.
---

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)