Added the token for Upstream and the code the handle the upstream

directive in the configuration file.
This commit is contained in:
Robert James Kaes 2001-09-16 20:08:24 +00:00
parent ec9068fae8
commit a8f0272ace
2 changed files with 14 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $Id: grammar.y,v 1.4 2001-08-26 21:08:36 rjkaes Exp $ /* $Id: grammar.y,v 1.5 2001-09-16 20:08:24 rjkaes Exp $
* *
* This is the grammar for tinyproxy's configuration file. It needs to be * 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 * in sync with scanner.l. If you know more about yacc and lex than I do
@ -44,7 +44,8 @@ int yylex(void);
%token KW_MAXREQUESTSPERCHILD %token KW_MAXREQUESTSPERCHILD
%token KW_TIMEOUT %token KW_TIMEOUT
%token KW_USER KW_GROUP %token KW_USER KW_GROUP
%token KW_ANONYMOUS KW_FILTER KW_XTINYPROXY KW_TUNNEL %token KW_ANONYMOUS KW_FILTER KW_XTINYPROXY
%token KW_TUNNEL KW_UPSTREAM
%token KW_ALLOW KW_DENY %token KW_ALLOW KW_DENY
/* yes/no switches */ /* yes/no switches */
@ -122,6 +123,15 @@ statement
config.tunnel_port = $4; config.tunnel_port = $4;
#else #else
log_message(LOG_WARNING, "Tunnel support was not compiled in."); log_message(LOG_WARNING, "Tunnel support was not compiled in.");
#endif
}
| KW_UPSTREAM unique_address ':' NUMBER
{
#ifdef UPSTREAM_SUPPORT
config.upstream_name = $2;
config.upstream_port = $4;
#else
log_message(LOG_WARNING, "Upstream proxy support was not compiled in.");
#endif #endif
} }
| KW_LISTEN NUMERIC_ADDRESS { config.ipAddr = $2; } | KW_LISTEN NUMERIC_ADDRESS { config.ipAddr = $2; }

View File

@ -1,4 +1,4 @@
/* $Id: scanner.l,v 1.4 2001-08-26 21:08:36 rjkaes Exp $ /* $Id: scanner.l,v 1.5 2001-09-16 20:08:24 rjkaes Exp $
* *
* This builds the scanner for the tinyproxy configuration file. This * 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 * file needs to stay in sync with grammar.y. If someone knows lex and yacc
@ -47,6 +47,7 @@ static struct keyword keywords[] = {
{ "filter", KW_FILTER }, { "filter", KW_FILTER },
{ "xtinyproxy", KW_XTINYPROXY }, { "xtinyproxy", KW_XTINYPROXY },
{ "tunnel", KW_TUNNEL }, { "tunnel", KW_TUNNEL },
{ "upstream", KW_UPSTREAM },
{ "allow", KW_ALLOW }, { "allow", KW_ALLOW },
{ "deny", KW_DENY }, { "deny", KW_DENY },