-const char jcc_rcs[] = "$Id: jcc.c,v 1.220 2009/02/04 18:29:07 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.224 2009/02/14 15:32:04 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
* Purpose : Main file. Contains main() method, main loop, and
* the main connection-handling function.
*
- * Copyright : Written by and Copyright (C) 2001-2008 the SourceForge
+ * Copyright : Written by and Copyright (C) 2001-2009 the SourceForge
* Privoxy team. http://www.privoxy.org/
*
* Based on the Internet Junkbuster originally written
*
* Revisions :
* $Log: jcc.c,v $
+ * Revision 1.224 2009/02/14 15:32:04 fabiankeil
+ * Add the request URL to the timeout message in chat().
+ * Suggested by Lee.
+ *
+ * Revision 1.223 2009/02/09 21:21:16 fabiankeil
+ * Now that init_log_module() is called earlier, call show_version()
+ * later on from main() directly so it doesn't get called for --help
+ * or --version.
+ *
+ * Revision 1.222 2009/02/08 12:56:51 fabiankeil
+ * Call initialize_mutexes() before init_log_module() again.
+ * Broken since r220, might be the cause of Lee's #2579448.
+ *
+ * Revision 1.221 2009/02/06 18:02:58 fabiankeil
+ * When dropping privileges, also give up membership in supplementary
+ * groups. Thanks to Matthias Drochner for reporting the problem,
+ * providing the initial patch and testing the final version.
+ *
* Revision 1.220 2009/02/04 18:29:07 fabiankeil
* Initialize the log module before parsing arguments.
* Thanks to Matthias Drochner for the report.
return (content_length_known && ((0 == csp->expected_content_length)
|| (csp->expected_content_length <= content_length)));
}
+
+
+/*********************************************************************
+ *
+ * Function : wait_for_alive_connections
+ *
+ * Description : Waits for alive connections to timeout.
+ *
+ * Parameters : N/A
+ *
+ * Returns : N/A
+ *
+ *********************************************************************/
+static void wait_for_alive_connections()
+{
+ int connections_alive = close_unusable_connections();
+
+ while (0 < connections_alive)
+ {
+ log_error(LOG_LEVEL_CONNECT,
+ "Waiting for %d connections to timeout.",
+ connections_alive);
+ sleep(60);
+ connections_alive = close_unusable_connections();
+ }
+
+ log_error(LOG_LEVEL_CONNECT, "No connections to wait for left.");
+
+}
#endif /* FEATURE_CONNECTION_KEEP_ALIVE */
+
/*********************************************************************
*
* Function : mark_server_socket_tainted
if (n == 0)
{
- log_error(LOG_LEVEL_ERROR, "Didn't receive data in time.");
+ log_error(LOG_LEVEL_ERROR,
+ "Didn't receive data in time: %s", http->url);
if ((byte_count == 0) && (http->ssl == 0))
{
write_socket(csp->cfd, CONNECTION_TIMEOUT_RESPONSE,
csp->content_length = byte_count;
}
+#ifdef FEATURE_CONNECTION_KEEP_ALIVE
if ((csp->flags & CSP_FLAG_CONTENT_LENGTH_SET)
&& (csp->expected_content_length != byte_count))
{
byte_count, csp->expected_content_length);
mark_server_socket_tainted(csp);
}
+#endif
log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 200 %d",
csp->ip_addr_str, http->ocmd, csp->content_length);
}
-/*********************************************************************
- *
- * Function : wait_for_alive_connections
- *
- * Description : Waits for alive connections to timeout.
- *
- * Parameters : N/A
- *
- * Returns : N/A
- *
- *********************************************************************/
-static void wait_for_alive_connections()
-{
- int connections_alive = close_unusable_connections();
-
- while (0 < connections_alive)
- {
- log_error(LOG_LEVEL_CONNECT,
- "Waiting for %d connections to timeout.",
- connections_alive);
- sleep(60);
- connections_alive = close_unusable_connections();
- }
-
- log_error(LOG_LEVEL_CONNECT, "No connections to wait for left.");
-
-}
-
/*********************************************************************
*
* Function : serve
#endif
;
+ /* Prepare mutexes if supported and necessary. */
+ initialize_mutexes();
+
/* Enable logging until further notice. */
- init_log_module(Argv[0]);
+ init_log_module();
/*
* Parse the command line arguments
} /* -END- while (more arguments) */
+ show_version(Argv[0]);
+
#if defined(unix)
if ( *configfile != '/' )
{
InitWin32();
#endif
- /* Prepare mutexes if supported and necessary. */
- initialize_mutexes();
-
random_seed = (unsigned int)time(NULL);
#ifdef HAVE_RANDOM
srandom(random_seed);