1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-11-25 04:41:33 +03:00

Add custom HTTP header feature for HTTP proxy

A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS.
This commit is contained in:
Davide Beatrici
2018-11-29 20:32:03 +01:00
parent 4be45342b7
commit aefbd2e903
29 changed files with 1665 additions and 120 deletions

View File

@ -2027,6 +2027,53 @@ void EnSafeStr(char *str, char replace)
}
}
// Replace '\r' and '\n' with the specified character.
// If the specified character is a space (unsafe), the original character is removed.
void EnSafeHttpHeaderValueStr(char *str, char replace)
{
UINT length = 0;
UINT index = 0;
// Validate arguments
if (str == NULL)
{
return;
}
length = StrLen(str);
while (index < length)
{
if (str[index] == '\r' || str[index] == '\n')
{
if (replace == ' ')
{
Move(&str[index], &str[index + 1], length - index);
}
else
{
str[index] = replace;
}
}
else if (str[index] == '\\')
{
if (str[index + 1] == 'r' || str[index + 1] == 'n')
{
if (replace == ' ')
{
Move(&str[index], &str[index + 2], length - index);
index--;
}
else
{
str[index] = str[index + 1] = replace;
index++;
}
}
}
index++;
}
}
// Operation check of string library
bool CheckStringLibrary()
{