mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Stop server if started with old curl and incompatible sv_register
This prevents accidentally falling victim to the bug #5858.
This commit is contained in:
parent
4f2f3f4bba
commit
884cf75cb8
|
@ -508,7 +508,16 @@ CRegister::CRegister(CConfig *pConfig, IConsole *pConsole, IEngine *pEngine, int
|
|||
|
||||
void CRegister::Update()
|
||||
{
|
||||
m_GotFirstUpdateCall = true;
|
||||
if(!m_GotFirstUpdateCall)
|
||||
{
|
||||
bool Ipv6 = m_aProtocolEnabled[PROTOCOL_TW6_IPV6] || m_aProtocolEnabled[PROTOCOL_TW7_IPV6];
|
||||
bool Ipv4 = m_aProtocolEnabled[PROTOCOL_TW6_IPV4] || m_aProtocolEnabled[PROTOCOL_TW7_IPV4];
|
||||
if(Ipv6 && Ipv4)
|
||||
{
|
||||
dbg_assert(!HttpHasIpresolveBug(), "curl version < 7.77.0 does not support registering via both IPv4 and IPv6, set `sv_register ipv6` or `sv_register ipv4`");
|
||||
}
|
||||
m_GotFirstUpdateCall = true;
|
||||
}
|
||||
if(!m_GotServerInfo)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -116,6 +116,13 @@ void EscapeUrl(char *pBuf, int Size, const char *pStr)
|
|||
curl_free(pEsc);
|
||||
}
|
||||
|
||||
bool HttpHasIpresolveBug()
|
||||
{
|
||||
// curl < 7.77.0 doesn't use CURLOPT_IPRESOLVE correctly wrt.
|
||||
// connection caches.
|
||||
return curl_version_info(CURLVERSION_NOW)->version_num < 0x074d00;
|
||||
}
|
||||
|
||||
CHttpRequest::CHttpRequest(const char *pUrl)
|
||||
{
|
||||
str_copy(m_aUrl, pUrl);
|
||||
|
|
|
@ -194,4 +194,5 @@ inline std::unique_ptr<CHttpRequest> HttpPostJson(const char *pUrl, const char *
|
|||
|
||||
bool HttpInit(IStorage *pStorage);
|
||||
void EscapeUrl(char *pBuf, int Size, const char *pStr);
|
||||
bool HttpHasIpresolveBug();
|
||||
#endif // ENGINE_SHARED_HTTP_H
|
||||
|
|
Loading…
Reference in a new issue