-const char jcc_rcs[] = "$Id: jcc.c,v 1.418 2012/12/07 12:43:05 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.427 2014/06/02 06:22:21 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-2012 the
+ * Copyright : Written by and Copyright (C) 2001-2014 the
* Privoxy team. http://www.privoxy.org/
*
* Based on the Internet Junkbuster originally written
privoxy_mutex_t log_init_mutex;
privoxy_mutex_t connection_reuse_mutex;
+#ifdef FEATURE_EXTERNAL_FILTERS
+privoxy_mutex_t external_filter_mutex;
+#endif
+
#if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_GETHOSTBYNAME_R)
privoxy_mutex_t resolver_mutex;
#endif /* !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_GETHOSTBYNAME_R) */
struct http_request *http = csp->http;
jb_err err;
- log_error(LOG_LEVEL_INFO, "Rewrite detected: %s", csp->headers->first->str);
+ log_error(LOG_LEVEL_REDIRECTS, "Rewrite detected: %s",
+ csp->headers->first->str);
free_http_request(http);
err = parse_http_request(csp->headers->first->str, http);
if (JB_ERR_OK != err)
log_error(LOG_LEVEL_ERROR, "Couldn't parse rewritten request: %s.",
jb_err_to_string(err));
}
- else
- {
- /* XXX: ocmd is a misleading name */
- http->ocmd = strdup_or_die(http->cmd);
- }
return err;
}
get_url_actions(csp, http);
}
- /*
- * Save a copy of the original request for logging
- */
- http->ocmd = strdup_or_die(http->cmd);
enlist(csp->headers, http->cmd);
/* Append the previously read headers */
csp->server_connection.requests_sent_total++;
- if (fwd->forward_host || (http->ssl == 0))
+ if ((fwd->type == SOCKS_5T) && (NULL == csp->headers->first))
+ {
+ /* Client headers have been sent optimistically */
+ assert(csp->headers->last == NULL);
+ }
+ else if (fwd->forward_host || (http->ssl == 0))
{
int write_failure;
hdr = list_to_text(csp->headers);
log_error(LOG_LEVEL_CONNECT, "to %s successful", http->hostport);
+ /* XXX: should the time start earlier for optimistically sent data? */
csp->server_connection.request_sent = time(NULL);
maxfd = (csp->cfd > csp->server_connection.sfd) ?
privoxy_mutex_init(&log_mutex);
privoxy_mutex_init(&log_init_mutex);
privoxy_mutex_init(&connection_reuse_mutex);
+#ifdef FEATURE_EXTERNAL_FILTERS
+ privoxy_mutex_init(&external_filter_mutex);
+#endif
/*
* XXX: The assumptions below are a bit naive
close(fd);
}
+#ifdef FEATURE_EXTERNAL_FILTERS
+ for (fd = 0; fd < 3; fd++)
+ {
+ mark_socket_for_close_on_execute(fd);
+ }
+#endif
+
chdir("/");
} /* -END- if (daemon_mode) */
* on failure.
*
* Parameters :
- * 1 : haddr = Host addres to bind to. Use NULL to bind to
+ * 1 : haddr = Host address to bind to. Use NULL to bind to
* INADDR_ANY.
* 2 : hport = Specifies port to bind to.
*
return JB_INVALID_SOCKET;
}
+#ifndef _WIN32
+ if (bfd >= FD_SETSIZE)
+ {
+ log_error(LOG_LEVEL_FATAL,
+ "Bind socket number too high to use select(): %d >= %d",
+ bfd, FD_SETSIZE);
+ }
+#endif
+
if (haddr == NULL)
{
log_error(LOG_LEVEL_INFO, "Listening on port %d on all IP addresses",