diff options
author | George Hazan <ghazan@miranda.im> | 2017-02-06 12:59:54 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-02-06 13:00:05 +0300 |
commit | a99addebf1ea42d4031e52a84c4576355e3d8365 (patch) | |
tree | ef14a929a86bfbddaef94bde9f941e97308ca2c2 /protocols/Discord/src | |
parent | a3358bdf6c14082595b1008663d60bb49f468deb (diff) |
fix for adding duplicate headers
Diffstat (limited to 'protocols/Discord/src')
-rw-r--r-- | protocols/Discord/src/http.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/protocols/Discord/src/http.cpp b/protocols/Discord/src/http.cpp index e9dc031e62..72a6db3915 100644 --- a/protocols/Discord/src/http.cpp +++ b/protocols/Discord/src/http.cpp @@ -63,8 +63,8 @@ AsyncHttpRequest::AsyncHttpRequest(CDiscordProto *ppro, int iRequestType, LPCSTR ptrW text(json_write(pRoot)); pData = mir_utf8encodeW(text); dataLength = (int)mir_strlen(pData); - AddHeader("Content-Type", "application/json"); } + AddHeader("Content-Type", "application/json"); requestType = iRequestType; m_pCallback = pFunc; @@ -85,6 +85,10 @@ AsyncHttpRequest::~AsyncHttpRequest() void AsyncHttpRequest::AddHeader(LPCSTR szName, LPCSTR szValue) { + for (int i = 0; i < headersCount; i++) + if (!mir_strcmp(headers[i].szName, szName)) + return; + headers = (NETLIBHTTPHEADER*)mir_realloc(headers, sizeof(NETLIBHTTPHEADER)*(headersCount + 1)); headers[headersCount].szName = mir_strdup(szName); headers[headersCount].szValue = mir_strdup(szValue); |