-const char jcc_rcs[] = "$Id: jcc.c,v 1.404 2012/10/21 13:04:08 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.416 2012/11/24 14:01:25 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
*/
csp->expected_content_length = 0;
content_length_known = TRUE;
+ csp->flags |= CSP_FLAG_SERVER_CONTENT_LENGTH_SET;
}
if (csp->http->status == 204 || csp->http->status == 304)
*/
csp->expected_content_length = 0;
content_length_known = TRUE;
+ csp->flags |= CSP_FLAG_SERVER_CONTENT_LENGTH_SET;
}
return (content_length_known && ((0 == csp->expected_content_length)
* we do.
*
* Data that doesn't belong to the current request is
- * thrown away to let the client retry on a clean socket.
- *
- * XXX: This is a hack until we can deal with multiple
- * pipelined requests at the same time.
- *
+ * either thrown away to let the client retry on a clean
+ * socket, or stashed to be dealt with after the current
+ * request is served.
*
* Parameters :
* 1 : csp = Current client state (buffers, headers, etc...)
}
if (!(csp->flags & CSP_FLAG_CLIENT_REQUEST_COMPLETELY_READ)
- && ((csp->client_iob->cur[0] != '\0') || (csp->expected_client_content_length != 0)))
+ && ((csp->client_iob->cur < csp->client_iob->eod)
+ || (csp->expected_client_content_length != 0)))
{
if (strcmpic(csp->http->gpc, "GET")
&& strcmpic(csp->http->gpc, "HEAD")
{
/* XXX: this is an incomplete hack */
csp->flags &= ~CSP_FLAG_CLIENT_REQUEST_COMPLETELY_READ;
- csp->flags |= CSP_FLAG_SERVER_SOCKET_TAINTED;
- log_error(LOG_LEVEL_CONNECT,
- "There might be a request body. The connection will not be kept alive.");
+ log_error(LOG_LEVEL_CONNECT, "There better be a request body.");
}
else
{
* it once we're done serving the current request.
*/
csp->flags |= CSP_FLAG_PIPELINED_REQUEST_WAITING;
- assert(csp->client_iob->eod > csp->client_iob->cur);
+ assert(csp->client_iob->eod >= csp->client_iob->cur);
log_error(LOG_LEVEL_CONNECT, "Complete client request followed by "
"%d bytes of pipelined data received.",
(int)(csp->client_iob->eod - csp->client_iob->cur));
* actually been reused.
*/
if ((csp->flags & CSP_FLAG_SERVER_CONNECTION_KEEP_ALIVE)
- && !(csp->flags |= CSP_FLAG_SERVER_SOCKET_TAINTED))
+ && !(csp->flags & CSP_FLAG_SERVER_SOCKET_TAINTED))
{
log_error(LOG_LEVEL_CONNECT,
"Marking the server socket %d tainted.",
server_body = 0;
+#ifdef FEATURE_CONNECTION_KEEP_ALIVE
watch_client_socket = 0 == (csp->flags & CSP_FLAG_PIPELINED_REQUEST_WAITING);
+#endif
for (;;)
{
static void serve(struct client_state *csp)
#endif /* def AMIGA */
{
+ int config_file_change_detected = 0; /* Only used for debugging */
#ifdef FEATURE_CONNECTION_KEEP_ALIVE
#ifdef FEATURE_CONNECTION_SHARING
static int monitor_thread_running = 0;
#endif /* def FEATURE_CONNECTION_SHARING */
int continue_chatting = 0;
- int config_file_change_detected = 0; /* Only used for debugging */
log_error(LOG_LEVEL_CONNECT, "Accepted connection from %s on socket %d",
csp->ip_addr_str, csp->cfd);
& RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE)
&& !(csp->flags & CSP_FLAG_SERVER_SOCKET_TAINTED)
&& (csp->cfd != JB_INVALID_SOCKET)
- && ((csp->flags & CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE)
- || (csp->config->feature_flags &
- RUNTIME_FEATURE_CONNECTION_SHARING));
+ && (csp->flags & CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE)
+ && ((csp->flags & CSP_FLAG_SERVER_CONTENT_LENGTH_SET)
+ || (csp->flags & CSP_FLAG_CHUNKED));
if (!(csp->flags & CSP_FLAG_CRUNCHED)
&& (csp->server_connection.sfd != JB_INVALID_SOCKET))
|| !(latency < csp->server_connection.keep_alive_timeout))
{
log_error(LOG_LEVEL_CONNECT,
- "Closing server socket %d connected to %s: "
+ "Closing server socket %d connected to %s. "
"Keep-alive %u. Tainted: %u. Socket alive %u. Timeout: %u.",
csp->server_connection.sfd, csp->server_connection.host,
0 != (csp->flags & CSP_FLAG_SERVER_CONNECTION_KEEP_ALIVE),
static void usage(const char *myname)
{
printf("Privoxy version " VERSION " (" HOME_PAGE_URL ")\n"
- "Usage: %s "
+ "Usage: %s [--config-test] "
#if defined(unix)
"[--chroot] "
#endif /* defined(unix) */
#endif
{
int argc_pos = 0;
+ int do_config_test = 0;
unsigned int random_seed;
#ifdef unix
struct passwd *pw = NULL;
}
#endif /* defined(unix) */
+ else if (strcmp(argv[argc_pos], "--config-test") == 0)
+ {
+ do_config_test = 1;
+ }
+
else if (argc_pos + 1 != argc)
{
/*
# endif /* def _WIN_CONSOLE */
#endif /* def _WIN32 */
+ if (do_config_test)
+ {
+ exit(NULL == load_config());
+ }
/* Initialize the CGI subsystem */
cgi_init_error_messages();