Merged in changes from 1.6.3

This commit is contained in:
Robert James Kaes 2004-08-10 21:24:24 +00:00
parent 18df4910a4
commit badc7673d0
8 changed files with 36 additions and 18 deletions

View File

@ -1,3 +1,7 @@
2004-08-10 Robert James Kaes <rjkaes@users.sourceforge.net>
Merged in changes from 1.6.3.
2004-01-26 Robert James Kaes <rjkaes@flarenet.com> 2004-01-26 Robert James Kaes <rjkaes@flarenet.com>
Released tinyproxy 1.7.0 (2004-01-26) Released tinyproxy 1.7.0 (2004-01-26)

View File

@ -1,4 +1,4 @@
/* $Id: child.c,v 1.14 2004-02-13 21:27:42 rjkaes Exp $ /* $Id: child.c,v 1.15 2004-08-10 21:24:23 rjkaes Exp $
* *
* Handles the creation/destruction of the various children required for * Handles the creation/destruction of the various children required for
* processing incoming connections. * processing incoming connections.
@ -47,8 +47,8 @@ struct child_s {
static struct child_s *child_ptr; static struct child_s *child_ptr;
static struct child_config_s { static struct child_config_s {
unsigned int maxclients, maxrequestsperchild; int maxclients, maxrequestsperchild;
unsigned int maxspareservers, minspareservers, startservers; int maxspareservers, minspareservers, startservers;
} child_config; } child_config;
static unsigned int* servers_waiting; /* servers waiting for a connection */ static unsigned int* servers_waiting; /* servers waiting for a connection */
@ -129,7 +129,7 @@ _child_lock_release(void)
* Set the configuration values for the various child related settings. * Set the configuration values for the various child related settings.
*/ */
short int short int
child_configure(child_config_t type, unsigned int val) child_configure(child_config_t type, int val)
{ {
switch (type) { switch (type) {
case CHILD_MAXCLIENTS: case CHILD_MAXCLIENTS:

View File

@ -1,4 +1,4 @@
/* $Id: child.h,v 1.1 2002-05-26 18:45:26 rjkaes Exp $ /* $Id: child.h,v 1.2 2004-08-10 21:24:23 rjkaes Exp $
* *
* See 'child.c' for more information. * See 'child.c' for more information.
* *
@ -32,6 +32,6 @@ extern void child_close_sock(void);
extern void child_main_loop(void); extern void child_main_loop(void);
extern void child_kill_children(void); extern void child_kill_children(void);
extern short int child_configure(child_config_t type, unsigned int val); extern short int child_configure(child_config_t type, int val);
#endif #endif

View File

@ -1,4 +1,4 @@
/* $Id: conns.c,v 1.22 2004-04-27 18:53:14 rjkaes Exp $ /* $Id: conns.c,v 1.23 2004-08-10 21:24:23 rjkaes Exp $
* *
* Create and free the connection structure. One day there could be * Create and free the connection structure. One day there could be
* other connection related tasks put here, but for now the header * other connection related tasks put here, but for now the header
@ -76,6 +76,8 @@ initialize_conn(int client_fd, const char* ipaddr, const char* string_addr,
connptr->client_ip_addr = safestrdup(ipaddr); connptr->client_ip_addr = safestrdup(ipaddr);
connptr->client_string_addr = safestrdup(string_addr); connptr->client_string_addr = safestrdup(string_addr);
connptr->upstream_proxy = NULL;
update_stats(STAT_OPEN); update_stats(STAT_OPEN);
#ifdef REVERSE_SUPPORT #ifdef REVERSE_SUPPORT

View File

@ -1,4 +1,4 @@
/* $Id: conns.h,v 1.17 2004-04-27 18:53:14 rjkaes Exp $ /* $Id: conns.h,v 1.18 2004-08-10 21:24:23 rjkaes Exp $
* *
* See 'conns.c' for a detailed description. * See 'conns.c' for a detailed description.
* *
@ -78,6 +78,11 @@ struct conn_s {
*/ */
char* reversepath; char* reversepath;
#endif #endif
/*
* Pointer to upstream proxy.
*/
struct upstream *upstream_proxy;
}; };
/* /*

View File

@ -1,4 +1,4 @@
/* $Id: daemon.c,v 1.2 2002-10-03 20:38:06 rjkaes Exp $ /* $Id: daemon.c,v 1.3 2004-08-10 21:24:23 rjkaes Exp $
* *
* This file contains functions which are useful when writing a * This file contains functions which are useful when writing a
* daemon process. The functions include a "makedaemon" function and * daemon process. The functions include a "makedaemon" function and
@ -40,7 +40,11 @@ makedaemon(void)
chdir("/"); chdir("/");
umask(077); umask(077);
#if 0 #if NDEBUG
/*
* When not in debugging mode, close the standard file
* descriptors.
*/
close(0); close(0);
close(1); close(1);
close(2); close(2);

View File

@ -1,4 +1,4 @@
/* $Id: reqs.c,v 1.112 2004-04-27 18:53:14 rjkaes Exp $ /* $Id: reqs.c,v 1.113 2004-08-10 21:24:23 rjkaes Exp $
* *
* This is where all the work in tinyproxy is actually done. Incoming * This is where all the work in tinyproxy is actually done. Incoming
* connections have a new child created for them. The child then * connections have a new child created for them. The child then
@ -1223,7 +1223,7 @@ process_client_headers(struct conn_s *connptr, hashmap_t hashofheaders)
* proxy is in use.) * proxy is in use.)
*/ */
if (connptr->server_fd == -1 || connptr->show_stats if (connptr->server_fd == -1 || connptr->show_stats
|| (connptr->connect_method && !UPSTREAM_CONFIGURED())) { || (connptr->connect_method && (connptr->upstream_proxy == NULL))) {
log_message(LOG_INFO, "Not sending client headers to remote machine"); log_message(LOG_INFO, "Not sending client headers to remote machine");
return 0; return 0;
} }
@ -1600,7 +1600,7 @@ connect_to_upstream(struct conn_s *connptr, struct request_s *request)
char *combined_string; char *combined_string;
int len; int len;
struct upstream *cur_upstream = upstream_get(request->host); struct upstream *cur_upstream = connptr->upstream_proxy;
if(!cur_upstream) { if(!cur_upstream) {
log_message(LOG_WARNING, log_message(LOG_WARNING,
"No upstream proxy defined for %s.", "No upstream proxy defined for %s.",
@ -1751,7 +1751,8 @@ handle_connection(int fd)
goto send_error; goto send_error;
} }
if (UPSTREAM_CONFIGURED() && (UPSTREAM_HOST(request->host) != NULL)) { connptr->upstream_proxy = UPSTREAM_HOST(request->host);
if (connptr->upstream_proxy != NULL) {
if (connect_to_upstream(connptr, request) < 0) { if (connect_to_upstream(connptr, request) < 0) {
goto send_error; goto send_error;
} }
@ -1797,7 +1798,7 @@ handle_connection(int fd)
return; return;
} }
if (!connptr->connect_method || UPSTREAM_CONFIGURED()) { if (!connptr->connect_method || (connptr->upstream_proxy != NULL)) {
if (process_server_headers(connptr) < 0) { if (process_server_headers(connptr) < 0) {
if (connptr->error_variables) if (connptr->error_variables)
send_http_error_message(connptr); send_http_error_message(connptr);

View File

@ -1,4 +1,4 @@
/* $Id: tinyproxy.h,v 1.44 2004-04-27 18:53:14 rjkaes Exp $ /* $Id: tinyproxy.h,v 1.45 2004-08-10 21:24:23 rjkaes Exp $
* *
* See 'tinyproxy.c' for a detailed description. * See 'tinyproxy.c' for a detailed description.
* *
@ -26,7 +26,10 @@
#define MAXBUFFSIZE ((size_t)(1024 * 96)) /* Max size of buffer */ #define MAXBUFFSIZE ((size_t)(1024 * 96)) /* Max size of buffer */
#define MAX_IDLE_TIME (60 * 10) /* 10 minutes of no activity */ #define MAX_IDLE_TIME (60 * 10) /* 10 minutes of no activity */
#ifdef UPSTREAM_SUPPORT /*
* Even if upstream support is not compiled into tinyproxy, this
* structure still needs to be defined.
*/
struct upstream { struct upstream {
struct upstream *next; struct upstream *next;
char *domain; /* optional */ char *domain; /* optional */
@ -34,7 +37,6 @@ struct upstream {
int port; int port;
in_addr_t ip, mask; in_addr_t ip, mask;
}; };
#endif
#ifdef REVERSE_SUPPORT #ifdef REVERSE_SUPPORT
struct reversepath { struct reversepath {