summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-01-09 13:13:23 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-01-09 13:13:23 +0300
commit110fdc1157d94f5d787a21c60163681767fdd6c4 (patch)
tree3a401fa5b6d10e397784f4a7aa1cda38beee9fb9 /protocols
parent74c01c7fb7862ec01ad27c4b225b08b7aa0f3b0a (diff)
more strict constructor of MHttpRequest to avoid quirks
Diffstat (limited to 'protocols')
-rw-r--r--protocols/CloudFile/src/http_request.h15
-rw-r--r--protocols/CurrencyRates/src/HTTPSession.cpp3
-rw-r--r--protocols/Facebook/src/avatars.cpp3
-rw-r--r--protocols/Facebook/src/server.cpp3
-rw-r--r--protocols/Gadu-Gadu/src/avatar.cpp9
-rw-r--r--protocols/Gadu-Gadu/src/oauth.cpp9
-rw-r--r--protocols/GmailNotifier/src/check.cpp8
-rw-r--r--protocols/JabberG/src/jabber_file.cpp9
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp3
-rw-r--r--protocols/JabberG/src/jabber_util.cpp3
-rw-r--r--protocols/MinecraftDynmap/src/communication.cpp3
-rw-r--r--protocols/NewsAggregator/Src/Utils.cpp6
-rw-r--r--protocols/Non-IM Contact/src/http.cpp3
-rw-r--r--protocols/Tox/src/http_request.h15
-rw-r--r--protocols/Twitter/src/utility.cpp3
-rw-r--r--protocols/VKontakte/src/misc.cpp3
-rw-r--r--protocols/VKontakte/src/vk_captcha.cpp3
-rw-r--r--protocols/VKontakte/src/vk_pollserver.cpp3
-rw-r--r--protocols/Weather/src/weather_http.cpp3
-rw-r--r--protocols/WebView/src/webview_getdata.cpp3
-rw-r--r--protocols/WhatsApp/src/avatars.cpp3
-rw-r--r--protocols/WhatsApp/src/utils.cpp3
22 files changed, 43 insertions, 73 deletions
diff --git a/protocols/CloudFile/src/http_request.h b/protocols/CloudFile/src/http_request.h
index 214ecea761..c9921cfd76 100644
--- a/protocols/CloudFile/src/http_request.h
+++ b/protocols/CloudFile/src/http_request.h
@@ -22,12 +22,9 @@ class HttpRequest : public MHttpRequest
private:
CMStringA m_szUrl;
- void Init(int type)
+ void Init()
{
- requestType = type;
flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP;
- nlc = NULL;
- timeout = 0;
}
protected:
@@ -78,16 +75,18 @@ protected:
}
public:
- HttpRequest(int type, LPCSTR url)
+ HttpRequest(int type, LPCSTR url) :
+ MHttpRequest(type)
{
- Init(type);
+ Init();
m_szUrl = url;
}
- HttpRequest(int type, CMStringDataFormat, LPCSTR urlFormat, ...)
+ HttpRequest(int type, CMStringDataFormat, LPCSTR urlFormat, ...) :
+ MHttpRequest(type)
{
- Init(type);
+ Init();
va_list formatArgs;
va_start(formatArgs, urlFormat);
diff --git a/protocols/CurrencyRates/src/HTTPSession.cpp b/protocols/CurrencyRates/src/HTTPSession.cpp
index a00a71d635..4bb0374ad1 100644
--- a/protocols/CurrencyRates/src/HTTPSession.cpp
+++ b/protocols/CurrencyRates/src/HTTPSession.cpp
@@ -20,8 +20,7 @@ bool CHTTPSession::ReadResponce(CMStringW &rsResponce)
if (m_szUrl.IsEmpty())
return false;
- MHttpRequest nlhr;
- nlhr.requestType = REQUEST_GET;
+ MHttpRequest nlhr(REQUEST_GET);
nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_REDIRECT;
nlhr.m_szUrl = m_szUrl;
nlhr.AddHeader("User-Agent", NETLIB_USER_AGENT);
diff --git a/protocols/Facebook/src/avatars.cpp b/protocols/Facebook/src/avatars.cpp
index ba5ae845ec..b395da7805 100644
--- a/protocols/Facebook/src/avatars.cpp
+++ b/protocols/Facebook/src/avatars.cpp
@@ -33,9 +33,8 @@ void FacebookProto::GetAvatarFilename(MCONTACT hContact, wchar_t *pwszFileName)
void __cdecl FacebookProto::AvatarsUpdate(void *)
{
- MHttpRequest req;
+ MHttpRequest req(REQUEST_GET);
req.flags = NLHRF_NODUMP | NLHRF_SSL | NLHRF_HTTP11 | NLHRF_REDIRECT;
- req.requestType = REQUEST_GET;
CMStringA szParams((m_bUseBigAvatars) ? "type=large" : "type=normal");
szParams.AppendFormat("&access_token=%s", m_szAuthToken.c_str());
diff --git a/protocols/Facebook/src/server.cpp b/protocols/Facebook/src/server.cpp
index 69cb6b6940..63b292a77e 100644
--- a/protocols/Facebook/src/server.cpp
+++ b/protocols/Facebook/src/server.cpp
@@ -760,9 +760,8 @@ void FacebookProto::OnPublishPrivateMessage(const JSONNode &root)
// wszFileName.Format(L"%s\\STK{%S}.webp", wszPath.c_str(), stickerId.c_str());
std::string szUrl = sticker["thread_image"]["uri"].as_string();
- MHttpRequest req;
+ MHttpRequest req(REQUEST_GET);
req.flags = NLHRF_NODUMP | NLHRF_SSL | NLHRF_HTTP11 | NLHRF_REDIRECT;
- req.requestType = REQUEST_GET;
req.m_szUrl = szUrl.c_str();
MHttpResponse *pReply = Netlib_HttpTransaction(m_hNetlibUser, &req);
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp
index c9887a1da4..0bfce1c00c 100644
--- a/protocols/Gadu-Gadu/src/avatar.cpp
+++ b/protocols/Gadu-Gadu/src/avatar.cpp
@@ -51,8 +51,7 @@ bool GaduProto::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts)
char szUrl[128];
mir_snprintf(szUrl, "http://api.gadu-gadu.pl/avatars/%d/0.xml", uin);
- MHttpRequest req;
- req.requestType = REQUEST_GET;
+ MHttpRequest req(REQUEST_GET);
req.m_szUrl = szUrl;
req.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_REDIRECT;
@@ -225,8 +224,7 @@ void __cdecl GaduProto::avatarrequestthread(void*)
ai.hContact = data->hContact;
ai.format = getByte(ai.hContact, GG_KEY_AVATARTYPE, GG_KEYDEF_AVATARTYPE);
- MHttpRequest req;
- req.requestType = REQUEST_GET;
+ MHttpRequest req(REQUEST_GET);
req.m_szUrl = data->szAvatarURL;
req.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_REDIRECT;
@@ -372,8 +370,7 @@ void __cdecl GaduProto::setavatarthread(void *param)
char* token = getStringA(GG_KEY_TOKEN);
// construct request
- MHttpRequest req = {};
- req.requestType = REQUEST_POST;
+ MHttpRequest req(REQUEST_POST);
req.m_szUrl = "http://avatars.nowe.gg/upload";
req.flags = NLHRF_NODUMP | NLHRF_HTTP11;
req.AddHeader("X-Request", "JSON");
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp
index 084b4df1bf..70f145ce33 100644
--- a/protocols/Gadu-Gadu/src/oauth.cpp
+++ b/protocols/Gadu-Gadu/src/oauth.cpp
@@ -283,8 +283,7 @@ int GaduProto::oauth_receivetoken()
NLHR_PTR resp(0);
{
- MHttpRequest req;
- req.requestType = REQUEST_POST;
+ MHttpRequest req(REQUEST_POST);
req.m_szUrl = "http://api.gadu-gadu.pl/request_token";
req.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_PERSISTENT;
req.AddHeader("User-Agent", GG8_VERSION);
@@ -313,8 +312,7 @@ int GaduProto::oauth_receivetoken()
// 2. Obtaining User Authorization
debugLogA("oauth_receivetoken(): Obtaining User Authorization...");
{
- MHttpRequest req;
- req.requestType = REQUEST_POST;
+ MHttpRequest req(REQUEST_POST);
req.m_szUrl = "https://login.gadu-gadu.pl/authorize";
req.flags = NLHRF_NODUMP | NLHRF_HTTP11;
req.m_szParam.Format("callback_url=%s&request_token=%s&uin=%s&password=%s", ptrA(oauth_uri_escape("http://www.mojageneracja.pl")), token, uin, password);
@@ -335,8 +333,7 @@ int GaduProto::oauth_receivetoken()
token = nullptr;
token_secret = nullptr;
{
- MHttpRequest req;
- req.requestType = REQUEST_POST;
+ MHttpRequest req(REQUEST_POST);
req.m_szUrl = "http://api.gadu-gadu.pl/access_token";
req.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_PERSISTENT;
req.nlc = nlc;
diff --git a/protocols/GmailNotifier/src/check.cpp b/protocols/GmailNotifier/src/check.cpp
index df86f3fa0d..34a123390c 100644
--- a/protocols/GmailNotifier/src/check.cpp
+++ b/protocols/GmailNotifier/src/check.cpp
@@ -67,10 +67,9 @@ void CheckMailInbox(Account *curAcc)
szBody.Append("&password=");
szBody.Append(curAcc->pass);
- MHttpRequest nlhr;
+ MHttpRequest nlhr(REQUEST_POST);
nlhr.m_szUrl = szUrl.GetBuffer();
nlhr.m_szParam = szBody;
- nlhr.requestType = REQUEST_POST;
nlhr.AddHeader("Content-Type", "application/x-www-form-urlencoded");
NLHR_PTR nlu(Netlib_HttpTransaction(hNetlibUser, &nlhr));
@@ -93,9 +92,8 @@ void CheckMailInbox(Account *curAcc)
else
szUrl.Append("/mail/feed/atom");
- MHttpRequest nlhr;
- nlhr.m_szUrl = szUrl.GetBuffer();
- nlhr.requestType = REQUEST_GET;
+ MHttpRequest nlhr(REQUEST_GET);
+ nlhr.m_szUrl = szUrl;
nlhr.AddHeader("Authorization", szAuth.GetBuffer());
NLHR_PTR nlu(Netlib_HttpTransaction(hNetlibUser, &nlhr));
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp
index f58d6a3a46..616a629c59 100644
--- a/protocols/JabberG/src/jabber_file.cpp
+++ b/protocols/JabberG/src/jabber_file.cpp
@@ -49,8 +49,7 @@ void __cdecl CJabberProto::OfflineFileThread(OFDTHREAD *ofd)
}
// initialize the netlib request
- MHttpRequest nlhr;
- nlhr.requestType = REQUEST_GET;
+ MHttpRequest nlhr(REQUEST_GET);
nlhr.flags = NLHRF_HTTP11 | NLHRF_DUMPASTEXT | NLHRF_REDIRECT;
nlhr.m_szUrl = url;
@@ -127,8 +126,7 @@ void CJabberProto::OnReceiveOfflineFile(DB::FILE_BLOB &blob, void *pHandle)
void __cdecl CJabberProto::FileReceiveHttpThread(filetransfer *ft)
{
- MHttpRequest req;
- req.requestType = REQUEST_GET;
+ MHttpRequest req(REQUEST_GET);
req.m_szUrl = ft->httpPath;
NLHR_PTR pResp(Netlib_HttpTransaction(m_hNetlibUser, &req));
@@ -154,8 +152,7 @@ void CJabberProto::FileProcessHttpDownload(MCONTACT hContact, const char *jid, c
szName.AppendChar(*b++);
auto *pszName = szName.c_str();
- MHttpRequest req;
- req.requestType = REQUEST_HEAD;
+ MHttpRequest req(REQUEST_HEAD);
req.m_szUrl = pszUrl;
filetransfer *ft = new filetransfer(this, 0);
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp
index 752ab550a9..f4f088daa6 100644
--- a/protocols/JabberG/src/jabber_ft.cpp
+++ b/protocols/JabberG/src/jabber_ft.cpp
@@ -691,8 +691,7 @@ LBL_Fail:
if (!szUrl)
goto LBL_Fail;
- MHttpRequest nlhr;
- nlhr.requestType = REQUEST_PUT;
+ MHttpRequest nlhr(REQUEST_PUT);
nlhr.flags = NLHRF_NODUMPSEND | NLHRF_SSL | NLHRF_REDIRECT;
nlhr.m_szUrl = szUrl;
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 2f0ba8fa34..1f750bc08c 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -881,8 +881,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param)
OBJLIST<JABBER_HTTP_AVATARS> &avs = *(OBJLIST<JABBER_HTTP_AVATARS>*)param;
HNETLIBCONN hHttpCon = nullptr;
for (auto &it : avs) {
- MHttpRequest nlhr;
- nlhr.requestType = REQUEST_GET;
+ MHttpRequest nlhr(REQUEST_GET);
nlhr.flags = NLHRF_HTTP11 | NLHRF_REDIRECT | NLHRF_PERSISTENT;
nlhr.m_szUrl = it->Url;
nlhr.nlc = hHttpCon;
diff --git a/protocols/MinecraftDynmap/src/communication.cpp b/protocols/MinecraftDynmap/src/communication.cpp
index f7094c80f6..c09d069a83 100644
--- a/protocols/MinecraftDynmap/src/communication.cpp
+++ b/protocols/MinecraftDynmap/src/communication.cpp
@@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
MHttpResponse* MinecraftDynmapProto::sendRequest(const int request_type, std::string *post_data, std::string *get_data)
{
// Prepare the request
- MHttpRequest nlhr;
+ MHttpRequest nlhr(REQUEST_GET);
// FIXME: get server
@@ -40,7 +40,6 @@ MHttpResponse* MinecraftDynmapProto::sendRequest(const int request_type, std::st
nlhr.requestType = REQUEST_POST;
nlhr.SetData(post_data->c_str(), post_data->length());
}
- else nlhr.requestType = REQUEST_GET;
// Set headers - it depends on requestType so it must be after setting that
if (request_type == REQUEST_POST)
diff --git a/protocols/NewsAggregator/Src/Utils.cpp b/protocols/NewsAggregator/Src/Utils.cpp
index c5f1df5b95..60aec00266 100644
--- a/protocols/NewsAggregator/Src/Utils.cpp
+++ b/protocols/NewsAggregator/Src/Utils.cpp
@@ -47,10 +47,9 @@ void NetlibUnInit()
void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, CFeedEditor *pEditDlg)
{
Netlib_LogfW(hNetlibUser, L"Getting feed data %s.", tszUrl);
- MHttpRequest nlhr;
// initialize the netlib request
- nlhr.requestType = REQUEST_GET;
+ MHttpRequest nlhr(REQUEST_GET);
nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_REDIRECT;
if (wcsstr(tszUrl, L"https://") != nullptr)
nlhr.flags |= NLHRF_SSL;
@@ -205,8 +204,7 @@ time_t DateToUnixTime(const char *stamp, bool FeedType)
bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
{
- MHttpRequest nlhr;
- nlhr.requestType = REQUEST_GET;
+ MHttpRequest nlhr(REQUEST_GET);
nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11;
nlhr.m_szUrl = _T2A(tszURL);
nlhr.AddHeader("User-Agent", NETLIB_USER_AGENT);
diff --git a/protocols/Non-IM Contact/src/http.cpp b/protocols/Non-IM Contact/src/http.cpp
index 5aba5bbd8d..5e9d0a4821 100644
--- a/protocols/Non-IM Contact/src/http.cpp
+++ b/protocols/Non-IM Contact/src/http.cpp
@@ -35,8 +35,7 @@ HNETLIBUSER hNetlibUser;
int InternetDownloadFile(char *szUrl)
{
// initialize the netlib request
- MHttpRequest nlhr;
- nlhr.requestType = REQUEST_GET;
+ MHttpRequest nlhr(REQUEST_GET);
nlhr.flags = NLHRF_DUMPASTEXT;
nlhr.m_szUrl = szUrl;
diff --git a/protocols/Tox/src/http_request.h b/protocols/Tox/src/http_request.h
index 1e140b2ef0..cacc66f51d 100644
--- a/protocols/Tox/src/http_request.h
+++ b/protocols/Tox/src/http_request.h
@@ -19,28 +19,27 @@ public:
class HttpRequest : public MHttpRequest
{
- void Init(int type)
+ void Init()
{
- requestType = type;
flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMPSEND | NLHRF_DUMPASTEXT;
- nlc = nullptr;
- timeout = 0;
}
protected:
enum HttpRequestUrlFormat { FORMAT };
public:
- HttpRequest(int type, LPCSTR url)
+ HttpRequest(int type, LPCSTR url) :
+ MHttpRequest(type)
{
- Init(type);
+ Init();
m_szUrl = url;
}
- HttpRequest(int type, HttpRequestUrlFormat, LPCSTR urlFormat, ...)
+ HttpRequest(int type, HttpRequestUrlFormat, LPCSTR urlFormat, ...) :
+ MHttpRequest(type)
{
- Init(type);
+ Init();
va_list formatArgs;
va_start(formatArgs, urlFormat);
diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp
index 7e853b8a32..c46c146390 100644
--- a/protocols/Twitter/src/utility.cpp
+++ b/protocols/Twitter/src/utility.cpp
@@ -71,8 +71,7 @@ void CTwitterProto::ShowPopup(const char *text, int Error)
bool save_url(HNETLIBUSER hNetlib, const CMStringA &url, const CMStringW &filename)
{
- MHttpRequest req;
- req.requestType = REQUEST_GET;
+ MHttpRequest req(REQUEST_GET);
req.flags = NLHRF_HTTP11 | NLHRF_REDIRECT;
req.m_szUrl = const_cast<char*>(url.c_str());
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index c3abf2d9ec..3f15bcac16 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -1469,9 +1469,8 @@ CMStringW CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport
if (GetFileAttributesW(wszFileName) == INVALID_FILE_ATTRIBUTES) {
T2Utf szUrl(wszUrl);
- MHttpRequest req;
+ MHttpRequest req(REQUEST_GET);
req.flags = NLHRF_NODUMP | NLHRF_SSL | NLHRF_HTTP11 | NLHRF_REDIRECT;
- req.requestType = REQUEST_GET;
req.m_szUrl = szUrl.get();
MHttpResponse *pReply = Netlib_HttpTransaction(m_hNetlibUser, &req);
diff --git a/protocols/VKontakte/src/vk_captcha.cpp b/protocols/VKontakte/src/vk_captcha.cpp
index 5ff52d732f..3969850fe8 100644
--- a/protocols/VKontakte/src/vk_captcha.cpp
+++ b/protocols/VKontakte/src/vk_captcha.cpp
@@ -33,8 +33,7 @@ bool CVkProto::RunCaptchaForm(LPCSTR szUrl, CMStringA &result)
Utils_OpenUrl(szCaptchaAssistant);
}
else {
- MHttpRequest req;
- req.requestType = REQUEST_GET;
+ MHttpRequest req(REQUEST_GET);
req.m_szUrl = (LPSTR)szUrl;
req.flags = VK_NODUMPHEADERS;
diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp
index 8d6b9abae9..10bd5c7e43 100644
--- a/protocols/VKontakte/src/vk_pollserver.cpp
+++ b/protocols/VKontakte/src/vk_pollserver.cpp
@@ -253,8 +253,7 @@ int CVkProto::PollServer()
CMStringA szReqUrl(FORMAT, "https://%s?act=a_check&key=%s&ts=%s&wait=25&access_token=%s&mode=%d&version=%d", m_szPollingServer, m_szPollingKey, m_szPollingTs, m_szAccessToken, 106, 2);
// see mode parametr description on https://vk.com/dev/using_longpoll (Russian version)
- MHttpRequest req;
- req.requestType = REQUEST_GET;
+ MHttpRequest req(REQUEST_GET);
req.m_szUrl = szReqUrl.GetBuffer();
req.flags = VK_NODUMPHEADERS | NLHRF_PERSISTENT | NLHRF_HTTP11 | NLHRF_SSL;
req.timeout = 30000;
diff --git a/protocols/Weather/src/weather_http.cpp b/protocols/Weather/src/weather_http.cpp
index 99c262ec6a..79c9efd21e 100644
--- a/protocols/Weather/src/weather_http.cpp
+++ b/protocols/Weather/src/weather_http.cpp
@@ -40,8 +40,7 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **s
userAgent = NETLIB_USER_AGENT;
// initialize the netlib request
- MHttpRequest nlhr;
- nlhr.requestType = REQUEST_GET;
+ MHttpRequest nlhr(REQUEST_GET);
nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_REDIRECT;
nlhr.m_szUrl = szUrl;
nlhr.AddHeader("User-Agent", userAgent);
diff --git a/protocols/WebView/src/webview_getdata.cpp b/protocols/WebView/src/webview_getdata.cpp
index babfe3cca8..ba913bab5f 100644
--- a/protocols/WebView/src/webview_getdata.cpp
+++ b/protocols/WebView/src/webview_getdata.cpp
@@ -104,8 +104,7 @@ void GetData(void *param)
if (mir_strlen(url) < 3)
WErrorPopup(hContact, TranslateT("URL not supplied"));
- MHttpRequest nlhr;
- nlhr.requestType = REQUEST_GET;
+ MHttpRequest nlhr(REQUEST_GET);
nlhr.flags = NLHRF_DUMPASTEXT;
nlhr.m_szUrl = url;
nlhr.AddHeader("User-Agent", NETLIB_USER_AGENT);
diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp
index bfd3e16d72..32e57706a4 100644
--- a/protocols/WhatsApp/src/avatars.cpp
+++ b/protocols/WhatsApp/src/avatars.cpp
@@ -130,9 +130,8 @@ void WhatsAppProto::ServerFetchAvatar(const char *jid)
bool CMPlugin::SaveFile(const char *pszUrl, PROTO_AVATAR_INFORMATION &ai)
{
- MHttpRequest req;
+ MHttpRequest req(REQUEST_GET);
req.flags = NLHRF_NODUMP | NLHRF_PERSISTENT | NLHRF_SSL | NLHRF_HTTP11 | NLHRF_REDIRECT;
- req.requestType = REQUEST_GET;
req.m_szUrl = pszUrl;
req.nlc = hAvatarConn;
diff --git a/protocols/WhatsApp/src/utils.cpp b/protocols/WhatsApp/src/utils.cpp
index 0333c62ca5..ff1a5b5daf 100644
--- a/protocols/WhatsApp/src/utils.cpp
+++ b/protocols/WhatsApp/src/utils.cpp
@@ -519,8 +519,7 @@ WAMediaKeys::WAMediaKeys(const uint8_t *pKey, size_t keyLen, const char *pszMedi
MBinBuffer WhatsAppProto::DownloadEncryptedFile(const char *url, const ProtobufCBinaryData &mediaKeys, const char *pszMediaType)
{
- MHttpRequest req;
- req.requestType = REQUEST_GET;
+ MHttpRequest req(REQUEST_GET);
req.m_szUrl = url;
req.AddHeader("Origin", "https://web.whatsapp.com");