summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/gateway.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-01-13 16:48:55 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-01-13 16:48:55 +0300
commit87a2660299edd64cbb6f6c92c33683e91a6d187c (patch)
treea1b0777ec5b8afc0c49fbb66cf6a122b5ac82c6d /protocols/Discord/src/gateway.cpp
parent21f52dbfa251d171b4cc9dc315e8736da2e2be08 (diff)
Netlib_GetHeader() - handful utility to avoid writing cycles
Diffstat (limited to 'protocols/Discord/src/gateway.cpp')
-rw-r--r--protocols/Discord/src/gateway.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/protocols/Discord/src/gateway.cpp b/protocols/Discord/src/gateway.cpp
index fae8eef7cc..6b5e320904 100644
--- a/protocols/Discord/src/gateway.cpp
+++ b/protocols/Discord/src/gateway.cpp
@@ -56,15 +56,13 @@ bool CDiscordProto::GatewayThreadWorker()
debugLogA("Gateway connection succeeded");
m_hGatewayConnection = pReply->nlc;
- for (int i=0; i < pReply->headersCount; i++)
- if (!mir_strcmp(pReply->headers[i].szName, "Set-Cookie")) {
- m_szCookie = pReply->headers[i].szValue;
+ if (auto *pszHdr = Netlib_GetHeader(pReply, "Set-Cookie")) {
+ m_szCookie = pszHdr;
- int idx = m_szCookie.Find(';');
- if (idx != -1)
- m_szCookie.Truncate(idx);
- break;
- }
+ int idx = m_szCookie.Find(';');
+ if (idx != -1)
+ m_szCookie.Truncate(idx);
+ }
Netlib_FreeHttpRequest(pReply);
bool bExit = false;