From 4c9141aac6b60eab1a0113d45ac059a78097b0f7 Mon Sep 17 00:00:00 2001 From: Robert James Kaes Date: Fri, 20 Jun 2003 17:02:13 +0000 Subject: Removed the "ViaHeader" directive and replaced it with the "ViaProxyName" directive. The "Via" HTTP header is _required_ by the HTTP spec, so the code has been changed to always send the header. However, including the proxy's host name could be considered a security threat, so the "ViaProxyName" directive is used to set the token sent in the "Via" header. If the directive is not enabled the proxy's host name will be used. --- src/grammar.y | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/grammar.y') diff --git a/src/grammar.y b/src/grammar.y index 404f450..6d39a53 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -1,4 +1,4 @@ -/* $Id: grammar.y,v 1.21 2003-05-29 19:43:58 rjkaes Exp $ +/* $Id: grammar.y,v 1.22 2003-06-20 17:02:13 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 @@ -51,11 +51,12 @@ int yylex(void); %token KW_FILTER KW_FILTERURLS KW_FILTEREXTENDED KW_FILTER_DEFAULT_DENY %token KW_FILTER_CASESENSITIVE %token KW_UPSTREAM -%token KW_CONNECTPORT KW_BIND KW_HTTP_VIA +%token KW_CONNECTPORT KW_BIND %token KW_STATHOST %token KW_ALLOW KW_DENY %token KW_ERRORPAGE KW_DEFAULT_ERRORPAGE %token KW_STATPAGE +%token KW_VIA_PROXY_NAME /* yes/no switches */ %token KW_YES KW_NO @@ -210,14 +211,10 @@ statement log_message(LOG_WARNING, "The 'Bind' directive can not be used with transparent proxy support. Ignoring the directive."); #endif } - | KW_HTTP_VIA yesno + | KW_VIA_PROXY_NAME string { - if ($2) { - log_message(LOG_INFO, "Enabling HTTP Via header."); - config.via_http_header = TRUE; - } else { - config.via_http_header = FALSE; - } + log_message(LOG_INFO, "Setting \"Via\" proxy name to: %s", $2); + config.via_proxy_name = $2; } | KW_STATHOST string { @@ -258,7 +255,7 @@ string %% -extern unsigned int yylineno; +extern unsigned int scanner_lineno; void yyerror(char *s) @@ -270,5 +267,6 @@ yyerror(char *s) headerdisplayed = 1; } - fprintf(stderr, "\t%s:%d: %s\n", config.config_file, yylineno, s); + fprintf(stderr, "\t%s:%d: %s\n", config.config_file, scanner_lineno, s); + exit(EXIT_FAILURE); } -- cgit v1.2.3