Resyncing HEAD with v_3_0_branch for two OSX fixes:
[privoxy.git] / src / jcc.c
index 24e8f74..29b712e 100644 (file)
--- a/src/jcc.c
+++ b/src/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 2.3 2002/07/18 22:06:12 jongfoster Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 2.6 2003/06/24 12:24:24 oes Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/src/jcc.c,v $
@@ -33,6 +33,16 @@ const char jcc_rcs[] = "$Id: jcc.c,v 2.3 2002/07/18 22:06:12 jongfoster Exp $";
  *
  * Revisions   :
  *    $Log: jcc.c,v $
+ *    Revision 2.6  2003/06/24 12:24:24  oes
+ *    Added a line plus Fix-me as a reminder to fix broken force handling in trunk. Thanks to lionel for the hint
+ *
+ *    Revision 2.5  2003/01/26 20:24:26  david__schmidt
+ *    Updated activity console instrumentation locations
+ *
+ *    Revision 2.4  2002/12/28 03:58:19  david__schmidt
+ *    Initial drop of dashboard instrumentation - enabled with
+ *    --enable-activity-console
+ *
  *    Revision 2.3  2002/07/18 22:06:12  jongfoster
  *    Trivial formatting changes
  *
@@ -667,8 +677,18 @@ static int32 server_thread(void *data);
 #define sleep(N)  DosSleep(((N) * 100))
 #endif
 
+#ifdef OSX_DARWIN
+/*
+ * Hit OSX over the head with a hammer.  Protect all *_r functions.
+ */
+pthread_mutex_t gmtime_mutex;
+pthread_mutex_t localtime_mutex;
+pthread_mutex_t gethostbyaddr_mutex;
+pthread_mutex_t gethostbyname_mutex;
+#endif /* def OSX_DARWIN */
+
 #if defined(unix) || defined(__EMX__)
-const char *basedir;
+const char *basedir = NULL;
 const char *pidfile = NULL;
 int received_hup_signal = 0;
 #endif /* defined unix */
@@ -1120,6 +1140,16 @@ int main(int argc, const char *argv[])
    InitWin32();
 #endif
 
+#ifdef OSX_DARWIN
+   /*
+    * Prepare global mutex semaphores
+    */
+   pthread_mutex_init(&gmtime_mutex,0);
+   pthread_mutex_init(&localtime_mutex,0);
+   pthread_mutex_init(&gethostbyaddr_mutex,0);
+   pthread_mutex_init(&gethostbyname_mutex,0);
+#endif /* def OSX_DARWIN */
+
    /*
     * Unix signal handling
     *
@@ -1477,6 +1507,9 @@ static void listen_loop(void)
 #ifdef FEATURE_ACL
       if (block_acl(NULL,csp))
       {
+#ifdef FEATURE_ACTIVITY_CONSOLE
+         accumulate_stats(STATS_ACL_RESTRICT,1);
+#endif /* def FEATURE_ACTIVITY_CONSOLE */
          log_error(LOG_LEVEL_CONNECT, "Connection dropped due to ACL");
          close_socket(csp->cfd);
          freez(csp);
@@ -2164,11 +2197,13 @@ static jb_err process_client_headers( struct client_state *csp, struct http_requ
       /* If this request contains the FORCE_PREFIX,
        * better get rid of it now and set the force flag --oes
        * Changed to use the http structure rather than the req field --jaa
+       * FIXME: This isn't enough -- there is the path and referrer etc! *
        */
 
       if (strstr(http->url, FORCE_PREFIX))
       {
          strclean(http->url, FORCE_PREFIX);
+         strclean(http->path, FORCE_PREFIX);
          log_error(LOG_LEVEL_FORCE, "Enforcing request \"%s\".\n", http->url);
          csp->flags |= CSP_FLAG_FORCED;
       }