Added support for the "FilterURLs" and "FilterExtended" directives.

These directives were submitted by James Flemer for use with the new
filtering code.
This commit is contained in:
Robert James Kaes 2002-05-27 01:52:44 +00:00
parent 4ba42369b9
commit 026c7d9a3d
3 changed files with 32 additions and 3 deletions

View File

@ -123,6 +123,16 @@ Allow 192.168.1.0/25
# #
#Filter "/etc/tinyproxy/filter" #Filter "/etc/tinyproxy/filter"
#
# Filter based on URLs rather than domains.
#
#FilterURLs On
#
# Use POSIX Extended regular expressions rather than basic.
#
#FilterExtended On
# #
# If an Anonymous keyword is present, then anonymous proxying is enabled. # If an Anonymous keyword is present, then anonymous proxying is enabled.
# The headers listed are allowed through, while all others are denied. If # The headers listed are allowed through, while all others are denied. If

View File

@ -1,4 +1,4 @@
/* $Id: grammar.y,v 1.12 2002-05-26 18:54:27 rjkaes Exp $ /* $Id: grammar.y,v 1.13 2002-05-27 01:52:44 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
@ -45,7 +45,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 %token KW_ANONYMOUS KW_XTINYPROXY
%token KW_FILTER KW_FILTERURLS KW_FILTEREXTENDED
%token KW_TUNNEL KW_UPSTREAM %token KW_TUNNEL KW_UPSTREAM
%token KW_CONNECTPORT KW_BIND %token KW_CONNECTPORT KW_BIND
%token KW_ALLOW KW_DENY %token KW_ALLOW KW_DENY
@ -115,6 +116,22 @@ statement
config.filter = $2; config.filter = $2;
#else #else
log_message(LOG_WARNING, "Filter support was not compiled in."); log_message(LOG_WARNING, "Filter support was not compiled in.");
#endif
}
| KW_FILTERURLS yesno
{
#ifdef FILTER_ENABLE
config.filter_url = $2;
#else
log_message(LOG_WARNING, "Filter support wss not compiled in.");
#endif
}
| KW_FILTEREXTENDED yesno
{
#ifdef FILTER_ENABLE
config.filter_extended = $2;
#else
log_message(LOG_WARNING, "Filter support was not compiled in.");
#endif #endif
} }
| KW_XTINYPROXY network_address | KW_XTINYPROXY network_address

View File

@ -1,4 +1,4 @@
/* $Id: scanner.l,v 1.12 2002-05-26 18:54:27 rjkaes Exp $ /* $Id: scanner.l,v 1.13 2002-05-27 01:52:44 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
@ -44,6 +44,8 @@ static struct keyword keywords[] = {
{ "group", KW_GROUP }, { "group", KW_GROUP },
{ "anonymous", KW_ANONYMOUS }, { "anonymous", KW_ANONYMOUS },
{ "filter", KW_FILTER }, { "filter", KW_FILTER },
{ "filterurls", KW_FILTERURLS },
{ "filterextended", KW_FILTEREXTENDED },
{ "xtinyproxy", KW_XTINYPROXY }, { "xtinyproxy", KW_XTINYPROXY },
{ "tunnel", KW_TUNNEL }, { "tunnel", KW_TUNNEL },
{ "upstream", KW_UPSTREAM }, { "upstream", KW_UPSTREAM },