changed: config parameters: log_check_proxy_ip_header -> check_proxy_ip_header and log_proxy_ip_header -> proxy_ip_header
added: Request::ip_str (std::wstring) (string of the client's IP address) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1105 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -779,7 +779,6 @@ void App::ReadEnvVariables()
|
||||
{
|
||||
SetEnv("REQUEST_METHOD", cur.request->env_request_method);
|
||||
SetEnv("REQUEST_URI", cur.request->env_request_uri);
|
||||
SetEnv("REMOTE_ADDR", cur.request->env_remote_addr);
|
||||
SetEnv("FCGI_ROLE", cur.request->env_fcgi_role);
|
||||
SetEnv("CONTENT_TYPE", cur.request->env_content_type);
|
||||
SetEnv("HTTPS", cur.request->env_https);
|
||||
@@ -878,11 +877,26 @@ bool App::SaveEnvHTTPVariable(const char * env)
|
||||
|
||||
void App::ReadEnvRemoteIP()
|
||||
{
|
||||
const char * v = FCGX_GetParam("REMOTE_ADDR", fcgi_request.envp);
|
||||
|
||||
const char * v = nullptr;
|
||||
|
||||
if( config.check_proxy_ip_header )
|
||||
{
|
||||
http_header = L"HTTP_";
|
||||
http_header += config.proxy_ip_header;
|
||||
ToCapital(http_header);
|
||||
|
||||
PT::WideToUTF8(http_header, http_header_8bit);
|
||||
v = FCGX_GetParam(http_header_8bit.c_str(), fcgi_request.envp);
|
||||
}
|
||||
else
|
||||
{
|
||||
v = FCGX_GetParam("REMOTE_ADDR", fcgi_request.envp);
|
||||
}
|
||||
|
||||
if( v )
|
||||
{
|
||||
cur.request->ip = (int)inet_addr(v);
|
||||
PT::UTF8ToWide(v, cur.request->ip_str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -936,14 +950,8 @@ void App::LogAccess()
|
||||
log << log1;
|
||||
log.PrintDate(cur.request->start_date, config.log_time_zone_id);
|
||||
|
||||
log << ' ';
|
||||
|
||||
if( config.log_check_proxy_ip_header )
|
||||
log << cur.request->headers_in.Text(config.log_proxy_ip_header, L"no-log_proxy_ip_header");
|
||||
else
|
||||
log << cur.request->env_remote_addr;
|
||||
|
||||
log << ' '
|
||||
<< cur.request->ip_str << ' '
|
||||
<< cur.request->env_request_method << ' '
|
||||
<< cur.request->env_http_host
|
||||
<< cur.request->env_request_uri << ' '
|
||||
|
||||
Reference in New Issue
Block a user