mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-06 00:13:33 +00:00
1. Fixed Control Channel bug, where host field never contained port number
2. Updated tunnels, so host field only contains port if its not a default port
This commit is contained in:
@@ -3374,7 +3374,16 @@ void MeshServer_ConnectEx(MeshAgentHostContainer *agent)
|
||||
req = ILibCreateEmptyPacket();
|
||||
ILibSetVersion(req, "1.1", 3);
|
||||
ILibSetDirective(req, "GET", 3, path, (int)strnlen_s(path, serverUrlLen));
|
||||
ILibAddHeaderLine(req, "Host", 4, host, (int)strnlen_s(host, serverUrlLen));
|
||||
if ((port == 443 && strncmp("wss:", agent->serveruri, 4) == 0) || (port == 80 && strncmp("ws:", agent->serveruri, 3) == 0))
|
||||
{
|
||||
// Default Port, so host field only contains hostname
|
||||
ILibAddHeaderLine(req, "Host", 4, host, (int)strnlen_s(host, serverUrlLen));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Non default port, so host field needs to contain port number too
|
||||
ILibAddHeaderLine(req, "Host", 4, ILibScratchPad, (int)sprintf_s(ILibScratchPad, sizeof(ILibScratchPad), "%s:%u", host, port));
|
||||
}
|
||||
|
||||
free(path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user