projects
/
privoxy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add #131: handle-as-empty-doc-returns-ok should be replaced with an action
[privoxy.git]
/
jcc.c
diff --git
a/jcc.c
b/jcc.c
index
6967ad8
..
d9960f7
100644
(file)
--- a/
jcc.c
+++ b/
jcc.c
@@
-1,4
+1,4
@@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.4
18 2012/12/07 12:43:05
fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.4
27 2014/06/02 06:22:21
fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@
-6,7
+6,7
@@
const char jcc_rcs[] = "$Id: jcc.c,v 1.418 2012/12/07 12:43:05 fabiankeil Exp $"
* Purpose : Main file. Contains main() method, main loop, and
* the main connection-handling function.
*
* Purpose : Main file. Contains main() method, main loop, and
* the main connection-handling function.
*
- * Copyright : Written by and Copyright (C) 2001-201
2
the
+ * Copyright : Written by and Copyright (C) 2001-201
4
the
* Privoxy team. http://www.privoxy.org/
*
* Based on the Internet Junkbuster originally written
* Privoxy team. http://www.privoxy.org/
*
* Based on the Internet Junkbuster originally written
@@
-182,6
+182,10
@@
privoxy_mutex_t log_mutex;
privoxy_mutex_t log_init_mutex;
privoxy_mutex_t connection_reuse_mutex;
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) */
#if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_GETHOSTBYNAME_R)
privoxy_mutex_t resolver_mutex;
#endif /* !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_GETHOSTBYNAME_R) */
@@
-911,7
+915,8
@@
static jb_err change_request_destination(struct client_state *csp)
struct http_request *http = csp->http;
jb_err err;
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)
free_http_request(http);
err = parse_http_request(csp->headers->first->str, http);
if (JB_ERR_OK != err)
@@
-919,11
+924,6
@@
static jb_err change_request_destination(struct client_state *csp)
log_error(LOG_LEVEL_ERROR, "Couldn't parse rewritten request: %s.",
jb_err_to_string(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;
}
return err;
}
@@
-1602,10
+1602,6
@@
static jb_err receive_client_request(struct client_state *csp)
get_url_actions(csp, http);
}
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 */
enlist(csp->headers, http->cmd);
/* Append the previously read headers */
@@
-1920,7
+1916,12
@@
static void chat(struct client_state *csp)
csp->server_connection.requests_sent_total++;
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);
{
int write_failure;
hdr = list_to_text(csp->headers);
@@
-1978,6
+1979,7
@@
static void chat(struct client_state *csp)
log_error(LOG_LEVEL_CONNECT, "to %s successful", http->hostport);
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) ?
csp->server_connection.request_sent = time(NULL);
maxfd = (csp->cfd > csp->server_connection.sfd) ?
@@
-3127,6
+3129,9
@@
static void initialize_mutexes(void)
privoxy_mutex_init(&log_mutex);
privoxy_mutex_init(&log_init_mutex);
privoxy_mutex_init(&connection_reuse_mutex);
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
/*
* XXX: The assumptions below are a bit naive
@@
-3511,6
+3516,13
@@
int main(int argc, char **argv)
close(fd);
}
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) */
chdir("/");
} /* -END- if (daemon_mode) */
@@
-3636,7
+3648,7
@@
int main(int argc, char **argv)
* on failure.
*
* Parameters :
* on failure.
*
* Parameters :
- * 1 : haddr = Host addres to bind to. Use NULL to bind to
+ * 1 : haddr = Host addres
s
to bind to. Use NULL to bind to
* INADDR_ANY.
* 2 : hport = Specifies port to bind to.
*
* INADDR_ANY.
* 2 : hport = Specifies port to bind to.
*
@@
-3675,6
+3687,15
@@
static jb_socket bind_port_helper(const char *haddr, int hport)
return JB_INVALID_SOCKET;
}
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",
if (haddr == NULL)
{
log_error(LOG_LEVEL_INFO, "Listening on port %d on all IP addresses",