improve AcceptBaseParser parsing algorithm

remove AcceptParser - not needed now, AcceptBaseParser can prepare a table now
This commit is contained in:
2022-02-02 17:58:27 +01:00
parent d0d2cfb22c
commit 75daf37bbd
10 changed files with 230 additions and 207 deletions

View File

@@ -385,9 +385,6 @@ bool App::Init()
cookie_parser.set_dependency(&winix_model);
accept_encoding_parser.set_dependency(&winix_base);
accept_parser.set_dependency(&winix_base);
plugin.Call((Session*)0, WINIX_PLUGIN_INIT);
return true;
@@ -935,6 +932,23 @@ void App::LogEnvironmentHTTPVariables()
}
void App::ParseAcceptHeader()
{
accept_base_parser.parse(cur.request->env_http_accept, cur.request->accept_mime_types, 16);
if( !cur.request->accept_mime_types.empty() )
{
log << log3 << "App: " << Winix::Header::accept << " header consists of: ";
HeaderValue::log_values(cur.request->accept_mime_types, log);
log << logend;
}
else
{
log << log3 << "App: there is no " << Winix::Header::accept << " header" << logend;
}
}
/*
* reading the request (without GET parameters in the URL)
@@ -952,16 +966,16 @@ void App::ReadRequest()
ReadPostVars();
cookie_parser.Parse(cur.request->env_http_cookie, cur.request->cookie_tab);
accept_encoding_parser.ParseAndLog(cur.request->env_http_accept_encoding);
accept_parser.Parse(cur.request->env_http_accept, cur.request->accept_mime_types);
if( config.log_env_variables )
LogEnvironmentVariables();
if( config.log_env_http_variables )
LogEnvironmentHTTPVariables();
ParseAcceptHeader();
accept_encoding_parser.ParseAndLog(cur.request->env_http_accept_encoding, log);
cookie_parser.Parse(cur.request->env_http_cookie, cur.request->cookie_tab);
CheckIE();
CheckKonqueror();
CheckHtmx();