1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 01:49:53 +03:00

Improvement: Add a space character between URL and other tokens in the packet log format.

This commit is contained in:
Daiyuu Nobori 2020-01-01 11:00:51 +09:00
parent 41e023b369
commit 17e7d65839

View File

@ -1243,12 +1243,19 @@ void AddLogBufToStr(BUF *b, char *name, char *value)
void MakeSafeLogStr(char *str) void MakeSafeLogStr(char *str)
{ {
UINT i, len; UINT i, len;
bool is_http = false;
// Validate arguments // Validate arguments
if (str == NULL) if (str == NULL)
{ {
return; return;
} }
if (str[0] == 'h' && str[1] == 't' && str[2] == 't' && str[3] == 'p' &&
((str[4] == 's' && str[5] == ':') || (str[4] == ':')))
{
is_http = true;
}
EnPrintableAsciiStr(str, '?'); EnPrintableAsciiStr(str, '?');
len = StrLen(str); len = StrLen(str);
@ -1259,11 +1266,14 @@ void MakeSafeLogStr(char *str)
str[i] = '.'; str[i] = '.';
} }
else if (str[i] == ' ') else if (str[i] == ' ')
{
if (is_http == false)
{ {
str[i] = '_'; str[i] = '_';
} }
} }
} }
}
// Procedure for converting a packet log entry to a string // Procedure for converting a packet log entry to a string
char *PacketLogParseProc(RECORD *rec) char *PacketLogParseProc(RECORD *rec)
@ -2007,8 +2017,6 @@ void ReplaceForCsv(char *str)
return; return;
} }
// If there are blanks, trim it
Trim(str);
len = StrLen(str); len = StrLen(str);
for (i = 0;i < len;i++) for (i = 0;i < len;i++)