summaryrefslogtreecommitdiff
path: root/src/grammar.y
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2003-06-20 17:02:13 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2003-06-20 17:02:13 +0000
commit4c9141aac6b60eab1a0113d45ac059a78097b0f7 (patch)
treef94631c1b13568855c0c9f7575a32fda5798ae4f /src/grammar.y
parent0d3962f1f069845c2f396ca2450d9529f27d556b (diff)
downloadtinyproxy-4c9141aac6b60eab1a0113d45ac059a78097b0f7.tar.gz
tinyproxy-4c9141aac6b60eab1a0113d45ac059a78097b0f7.zip
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.
Diffstat (limited to '')
-rw-r--r--src/grammar.y20
1 files changed, 9 insertions, 11 deletions
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);
}