diff options
Diffstat (limited to '')
-rw-r--r-- | src/grammar.y | 13 | ||||
-rw-r--r-- | src/reqs.c | 82 | ||||
-rw-r--r-- | src/scanner.l | 3 | ||||
-rw-r--r-- | src/tinyproxy.c | 14 | ||||
-rw-r--r-- | src/tinyproxy.h | 6 |
5 files changed, 6 insertions, 112 deletions
diff --git a/src/grammar.y b/src/grammar.y index 526bf7b..cf28e9a 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -1,4 +1,4 @@ -/* $Id: grammar.y,v 1.15 2002-06-07 18:29:40 rjkaes Exp $ +/* $Id: grammar.y,v 1.16 2002-11-03 17:10:32 rjkaes Exp $ * * This is the grammar for tinyproxy's configuration file. It needs to be * in sync with scanner.l. If you know more about yacc and lex than I do @@ -48,7 +48,7 @@ int yylex(void); %token KW_USER KW_GROUP %token KW_ANONYMOUS KW_XTINYPROXY %token KW_FILTER KW_FILTERURLS KW_FILTEREXTENDED KW_FILTER_DEFAULT_DENY -%token KW_TUNNEL KW_UPSTREAM +%token KW_UPSTREAM %token KW_CONNECTPORT KW_BIND %token KW_ALLOW KW_DENY @@ -152,15 +152,6 @@ statement log_message(LOG_WARNING, "X-Tinyproxy header support was not compiled in."); #endif } - | KW_TUNNEL unique_address ':' NUMBER - { -#ifdef TUNNEL_SUPPORT - config.tunnel_name = $2; - config.tunnel_port = $4; -#else - log_message(LOG_WARNING, "Tunnel support was not compiled in."); -#endif - } | KW_UPSTREAM unique_address ':' NUMBER { #ifdef UPSTREAM_SUPPORT @@ -1,12 +1,9 @@ -/* $Id: reqs.c,v 1.83 2002-10-17 19:27:08 rjkaes Exp $ +/* $Id: reqs.c,v 1.84 2002-11-03 17:10:32 rjkaes Exp $ * * This is where all the work in tinyproxy is actually done. Incoming * connections have a new child created for them. The child then * processes the headers from the client, the response from the server, * and then relays the bytes between the two. - * If TUNNEL_SUPPORT is enabled, then tinyproxy will actually work - * as a simple buffering TCP tunnel. Very cool! (Robert actually uses - * this feature for a buffering NNTP tunnel.) * * Copyright (C) 1998 Steven Young * Copyright (C) 1999-2002 Robert James Kaes (rjkaes@flarenet.com) @@ -63,15 +60,6 @@ #endif /* - * Macro to help test if tunnel support is compiled in, and is enabled. - */ -#ifdef TUNNEL_SUPPORT -# define TUNNEL_CONFIGURED() (config.tunnel_name && config.tunnel_port != -1) -#else -# define TUNNEL_CONFIGURED() (0) -#endif - -/* * Codify the test for the carriage return and new line characters. */ #define CHECK_CRLF(header, len) ((len == 1 && header[0] == '\n') || (len == 2 && header[0] == '\r' && header[1] == '\n')) @@ -1185,65 +1173,6 @@ connect_to_upstream(struct conn_s *connptr, struct request_s *request) } #endif -#ifdef TUNNEL_SUPPORT -/* - * If tunnel has been configured then redirect any connections to it. - */ -static int -connect_to_tunnel(struct conn_s *connptr) -{ - -#if 0 - /* - * NOTE: This must be fixed - * - * Needed to remove this for right now since it breaks the semantics - * of the "tunnel" concept since the information from the remote host - * wasn't being sent until _after_ data was sent by the client. This - * is not correct since we should be sending the data regardless of - * who sent it first. - * - * I'll have to look into this for the next release. - */ - char *request_buf; - ssize_t len; - int pos; - - request_buf = safemalloc(HTTP_LINE_LENGTH); - if (request_buf) { - len = recv(connptr->client_fd, request_buf, HTTP_LINE_LENGTH - 1, MSG_PEEK); - for (pos = 0; pos < len && request_buf[pos] != '\n'; pos++) - ; - request_buf[pos] = '\0'; - - log_message(LOG_CONN, "Request: %s", request_buf); - - safefree(request_buf); - } -#endif - - log_message(LOG_INFO, "Redirecting to %s:%d", - config.tunnel_name, config.tunnel_port); - - connptr->server_fd = - opensock(config.tunnel_name, config.tunnel_port); - - if (connptr->server_fd < 0) { - log_message(LOG_WARNING, - "Could not connect to tunnel."); - indicate_http_error(connptr, 404, "Unable to connect to tunnel."); - - return -1; - } - - log_message(LOG_INFO, - "Established a connection to the tunnel \"%s\" using file descriptor %d.", - config.tunnel_name, connptr->server_fd); - - return 0; -} -#endif - /* * This is the main drive for each connection. As you can tell, for the * first few steps we are using a blocking socket. If you remember the @@ -1283,14 +1212,6 @@ handle_connection(int fd) return; } - if (TUNNEL_CONFIGURED()) { - if (connect_to_tunnel(connptr) < 0) - goto internal_proxy; - else - goto relay_proxy; - } - - internal_proxy: if (read_request_line(connptr) < 0) { update_stats(STAT_BADCONN); indicate_http_error(connptr, 408, @@ -1394,7 +1315,6 @@ handle_connection(int fd) } } - relay_proxy: relay_connection(connptr); log_message(LOG_INFO, "Closed connection between local client (fd:%d) and remote client (fd:%d)", diff --git a/src/scanner.l b/src/scanner.l index bb142f7..e6c33a9 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -1,4 +1,4 @@ -/* $Id: scanner.l,v 1.14 2002-06-07 18:29:40 rjkaes Exp $ +/* $Id: scanner.l,v 1.15 2002-11-03 17:10:32 rjkaes Exp $ * * This builds the scanner for the tinyproxy configuration file. This * file needs to stay in sync with grammar.y. If someone knows lex and yacc @@ -48,7 +48,6 @@ static struct keyword keywords[] = { { "filterextended", KW_FILTEREXTENDED }, { "filterdefaultdeny", KW_FILTER_DEFAULT_DENY }, { "xtinyproxy", KW_XTINYPROXY }, - { "tunnel", KW_TUNNEL }, { "upstream", KW_UPSTREAM }, { "allow", KW_ALLOW }, { "deny", KW_DENY }, diff --git a/src/tinyproxy.c b/src/tinyproxy.c index 614926d..a4a0c2e 100644 --- a/src/tinyproxy.c +++ b/src/tinyproxy.c @@ -1,4 +1,4 @@ -/* $Id: tinyproxy.c,v 1.39 2002-10-03 20:53:11 rjkaes Exp $ +/* $Id: tinyproxy.c,v 1.40 2002-11-03 17:10:32 rjkaes Exp $ * * The initialize routine. Basically sets up all the initial stuff (logfile, * listening socket, config options, etc.) and then sits there and loops @@ -141,9 +141,6 @@ Options:\n\ #ifndef NDEBUG printf(" Debugging code\n"); #endif /* NDEBUG */ -#ifdef TUNNEL_SUPPORT - printf(" TCP Tunnelling\n"); -#endif /* TUNNEL_SUPPORT */ #ifdef TRANSPARENT_PROXY printf(" Transparent Proxy Support\n"); #endif /* TRANSPARENT_PROXY */ @@ -214,15 +211,6 @@ main(int argc, char **argv) } yyparse(); -#if defined(TUNNEL_SUPPORT) && defined(UPSTREAM_SUPPORT) - if (config.tunnel_name && config.upstream_name) { - fprintf(stderr, - "%s: \"Tunnel\" and \"Upstream\" directives can not be both set.\n", - argv[0]); - exit(EX_SOFTWARE); - } -#endif - /* Open the log file if not using syslog */ if (config.syslog == FALSE) { if (!config.logf_name) { diff --git a/src/tinyproxy.h b/src/tinyproxy.h index 66afe91..3f9abdf 100644 --- a/src/tinyproxy.h +++ b/src/tinyproxy.h @@ -1,4 +1,4 @@ -/* $Id: tinyproxy.h,v 1.33 2002-06-15 17:29:59 rjkaes Exp $ +/* $Id: tinyproxy.h,v 1.34 2002-11-03 17:10:32 rjkaes Exp $ * * See 'tinyproxy.c' for a detailed description. * @@ -42,10 +42,6 @@ struct config_s { #ifdef XTINYPROXY_ENABLE char *my_domain; #endif -#ifdef TUNNEL_SUPPORT - char *tunnel_name; - int tunnel_port; -#endif /* TUNNEL_SUPPORT */ #ifdef UPSTREAM_SUPPORT char *upstream_name; int upstream_port; |