summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/http_request.h
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Tox/src/http_request.h')
-rw-r--r--protocols/Tox/src/http_request.h41
1 files changed, 2 insertions, 39 deletions
diff --git a/protocols/Tox/src/http_request.h b/protocols/Tox/src/http_request.h
index bba9f0591c..1e140b2ef0 100644
--- a/protocols/Tox/src/http_request.h
+++ b/protocols/Tox/src/http_request.h
@@ -17,22 +17,12 @@ public:
}
};
-class HttpRequest : protected NETLIBHTTPREQUEST
+class HttpRequest : public MHttpRequest
{
-private:
- CMStringA m_szUrl;
-
void Init(int type)
{
requestType = type;
flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMPSEND | NLHRF_DUMPASTEXT;
- szUrl = nullptr;
- headers = nullptr;
- headersCount = 0;
- pData = nullptr;
- dataLength = 0;
- resultCode = 0;
- szResultDescr = nullptr;
nlc = nullptr;
timeout = 0;
}
@@ -60,22 +50,6 @@ public:
~HttpRequest()
{
- for (int i = 0; i < headersCount; i++)
- {
- mir_free(headers[i].szName);
- mir_free(headers[i].szValue);
- }
- mir_free(headers);
- if (pData)
- mir_free(pData);
- }
-
- void AddHeader(LPCSTR szName, LPCSTR szValue)
- {
- headers = (NETLIBHTTPHEADER*)mir_realloc(headers, sizeof(NETLIBHTTPHEADER) * (headersCount + 1));
- headers[headersCount].szName = mir_strdup(szName);
- headers[headersCount].szValue = mir_strdup(szValue);
- headersCount++;
}
void AddUrlParameter(const char *urlFormat, ...)
@@ -87,20 +61,9 @@ public:
va_end(urlArgs);
}
- void SetData(const char *data, size_t size)
- {
- if (pData != nullptr)
- mir_free(pData);
-
- dataLength = (int)size;
- pData = (char*)mir_alloc(size);
- memcpy(pData, data, size);
- }
-
- NETLIBHTTPREQUEST* Send(HNETLIBUSER hNetlibConnection)
+ MHttpResponse* Send(HNETLIBUSER hNetlibConnection)
{
m_szUrl.Replace('\\', '/');
- szUrl = m_szUrl.GetBuffer();
return Netlib_HttpTransaction(hNetlibConnection, this);
}
};