From 2b6d50f7fdfaca84c3ee82909800ad67d2e99bdc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 4 Jan 2024 11:24:49 +0300 Subject: NETLIBHTTPREQUEST::cbSize = old unused field removed --- include/delphi/m_netlib.inc | 10 +--------- include/m_netlib.h | 1 - plugins/HTTPServer/src/GuiElements.cpp | 1 - plugins/MirLua/src/Modules/m_http.cpp | 2 -- plugins/PackUpdater/Src/Utils.cpp | 1 - plugins/PasteIt/src/PasteToWeb.cpp | 4 ++-- plugins/PluginUpdater/src/Utils.cpp | 1 - plugins/SendScreenshotPlus/src/CSend.cpp | 1 - plugins/SmileyAdd/src/download.cpp | 1 - plugins/Utils.pas/mirutils.pas | 3 --- plugins/Watrack/myshows/i_cookies.inc | 1 - protocols/CloudFile/src/http_request.h | 1 - protocols/CurrencyRates/src/HTTPSession.cpp | 1 - protocols/Facebook/src/avatars.cpp | 1 - protocols/Facebook/src/server.cpp | 1 - protocols/Gadu-Gadu/src/avatar.cpp | 4 +--- protocols/Gadu-Gadu/src/oauth.cpp | 2 -- protocols/GmailNotifier/src/check.cpp | 2 -- protocols/JabberG/src/jabber_file.cpp | 3 --- protocols/JabberG/src/jabber_ft.cpp | 1 - protocols/JabberG/src/jabber_util.cpp | 1 - protocols/NewsAggregator/Src/Utils.cpp | 2 -- protocols/Non-IM Contact/src/http.cpp | 7 +++---- protocols/VKontakte/src/misc.cpp | 1 - protocols/VKontakte/src/vk_pollserver.cpp | 1 - protocols/WhatsApp/src/avatars.cpp | 1 - protocols/WhatsApp/src/utils.cpp | 1 - src/mir_app/src/MHttpRequest.cpp | 1 - src/mir_app/src/netlib_autoproxy.cpp | 1 - src/mir_app/src/netlib_http.cpp | 10 +++------- src/mir_app/src/netlib_openconn.cpp | 3 +-- 31 files changed, 11 insertions(+), 60 deletions(-) diff --git a/include/delphi/m_netlib.inc b/include/delphi/m_netlib.inc index 74744ac3df..253c836a4d 100644 --- a/include/delphi/m_netlib.inc +++ b/include/delphi/m_netlib.inc @@ -102,10 +102,9 @@ type end; ANETLIBHTTPHEADER = array [0..1000] of TNETLIBHTTPHEADER; - PNETLIBHTTPREQUEST = ^TNETLIBHTTPREQUEST; + PNETLIBHTTPREQUEST = ^TNETLIBHTTPREQUEST; TNETLIBHTTPREQUEST = record - cbSize :int; requestType :int; // REQUEST_* constant flags :dword; szUrl :PAnsiChar; @@ -120,13 +119,6 @@ type timeout :int; // Mirver 9.0+ end; -const - {$IFNDEF WIN64} - NETLIBHTTPREQUEST_V1_SIZE = 44; - {$ELSE} - NETLIBHTTPREQUEST_V1_SIZE = SIZEOF(TNETLIBHTTPREQUEST); - {$ENDIF} - type PNETLIBUSER = ^TNETLIBUSER; TNETLIBUSER = record diff --git a/include/m_netlib.h b/include/m_netlib.h index b2f52be372..c667d760fb 100644 --- a/include/m_netlib.h +++ b/include/m_netlib.h @@ -450,7 +450,6 @@ EXTERN_C MIR_APP_DLL(char*) Netlib_GetHeader(const NETLIBHTTPREQUEST *pRec, cons struct NETLIBHTTPREQUEST { - int cbSize; int requestType; // a REQUEST_ uint32_t flags; char *szUrl; diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 963a1cd223..329258e1b9 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -143,7 +143,6 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) NETLIBHTTPREQUEST nlhr; memset(&nlhr, 0, sizeof(nlhr)); - nlhr.cbSize = sizeof(nlhr); nlhr.requestType = REQUEST_GET; nlhr.flags = NLHRF_DUMPASTEXT; nlhr.szUrl = (char*)szURL; diff --git a/plugins/MirLua/src/Modules/m_http.cpp b/plugins/MirLua/src/Modules/m_http.cpp index a3c501c44e..7526b29612 100644 --- a/plugins/MirLua/src/Modules/m_http.cpp +++ b/plugins/MirLua/src/Modules/m_http.cpp @@ -5,7 +5,6 @@ static NETLIBHTTPREQUEST* CreateRequest() { NETLIBHTTPREQUEST *request = (NETLIBHTTPREQUEST*)mir_calloc(sizeof(NETLIBHTTPREQUEST)); - request->cbSize = sizeof(NETLIBHTTPREQUEST); request->flags = NLHRF_HTTP11 | NLHRF_NODUMP; return request; } @@ -403,7 +402,6 @@ static int request_Send(lua_State *L) NETLIBHTTPREQUEST *request = *(NETLIBHTTPREQUEST**)luaL_checkudata(L, 1, MT_NETLIBHTTPREQUEST); NETLIBHTTPREQUEST *newRequest = (NETLIBHTTPREQUEST*)mir_calloc(sizeof(NETLIBHTTPREQUEST)); - newRequest->cbSize = sizeof(NETLIBHTTPREQUEST); newRequest->flags = request->flags; newRequest->requestType = request->requestType; newRequest->szUrl = mir_strdup(request->szUrl); diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 57a1c7db82..1c24905cac 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -108,7 +108,6 @@ void LoadOptions() BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) { NETLIBHTTPREQUEST nlhr = { 0 }; - nlhr.cbSize = sizeof(nlhr); nlhr.requestType = REQUEST_GET; nlhr.flags = NLHRF_REDIRECT | NLHRF_DUMPASTEXT | NLHRF_HTTP11; char* szUrl = mir_u2a(tszURL); diff --git a/plugins/PasteIt/src/PasteToWeb.cpp b/plugins/PasteIt/src/PasteToWeb.cpp index a350ca3bbb..9d1ad7ac5f 100644 --- a/plugins/PasteIt/src/PasteToWeb.cpp +++ b/plugins/PasteIt/src/PasteToWeb.cpp @@ -431,9 +431,9 @@ char *PasteToWeb::SendToWeb(char *url, std::map &heade ++nHeaders; } - NETLIBHTTPREQUEST nlhr = { 0 }; NETLIBHTTPHEADER *httpHeaders = new NETLIBHTTPHEADER[nHeaders]; - nlhr.cbSize = sizeof(nlhr); + + NETLIBHTTPREQUEST nlhr = { 0 }; nlhr.requestType = REQUEST_POST; nlhr.flags = NLHRF_NODUMPSEND | NLHRF_DUMPASTEXT | NLHPIF_HTTP11; nlhr.szUrl = url; diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index b4c7afb6f9..9a30007c66 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -153,7 +153,6 @@ int DownloadFile(FILEURL *pFileURL, HNETLIBCONN &nlc) ptrA szUrl(mir_u2a(pFileURL->wszDownloadURL)); NETLIBHTTPREQUEST nlhr = {}; - nlhr.cbSize = sizeof(nlhr); nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_PERSISTENT; nlhr.requestType = REQUEST_GET; nlhr.nlc = nlc; diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 378bb0ac6c..9290e8d923 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -465,7 +465,6 @@ int CSend::HTTPFormCreate(NETLIBHTTPREQUEST* nlhr, int requestType, const char* boundary[9 + i * 2] = (chcode < 0x0a ? '0' : 'a' - 0x0a) + chcode; } } - nlhr->cbSize = sizeof(NETLIBHTTPREQUEST); nlhr->requestType = requestType; nlhr->flags = NLHRF_HTTP11; if (!strncmp(url, "https://", 8)) nlhr->flags |= NLHRF_SSL; diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 4235e312b2..ef0e4a0682 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -46,7 +46,6 @@ bool InternetDownloadFile(const char *szUrl, char *szDest, HNETLIBCONN &hHttpDwn NETLIBHTTPREQUEST nlhr = {}; // initialize the netlib request - nlhr.cbSize = sizeof(nlhr); nlhr.requestType = REQUEST_GET; nlhr.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_PERSISTENT | NLHRF_REDIRECT; nlhr.szUrl = (char*)szUrl; diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas index 852223cbda..c6066c8ee9 100644 --- a/plugins/Utils.pas/mirutils.pas +++ b/plugins/Utils.pas/mirutils.pas @@ -412,7 +412,6 @@ begin result:=nil; FillChar(req,SizeOf(req),0); - req.cbSize :=NETLIBHTTPREQUEST_V1_SIZE;//SizeOf(req); req.requestType:=rtype; req.szUrl :=url; req.flags :=NLHRF_NODUMP or NLHRF_HTTP11; @@ -476,7 +475,6 @@ begin exit; FillChar(req,SizeOf(req),0); - req.cbSize :=NETLIBHTTPREQUEST_V1_SIZE;//SizeOf(req); req.requestType:=REQUEST_GET; req.szUrl :=url; req.flags :=NLHRF_NODUMP; @@ -593,7 +591,6 @@ begin exit; FillChar(req,SizeOf(req),0); - req.cbSize :=NETLIBHTTPREQUEST_V1_SIZE;//SizeOf(req); req.requestType:=REQUEST_GET; req.szUrl :=url; req.flags :=NLHRF_NODUMP; diff --git a/plugins/Watrack/myshows/i_cookies.inc b/plugins/Watrack/myshows/i_cookies.inc index 24c90216b9..cd01ef6621 100644 --- a/plugins/Watrack/myshows/i_cookies.inc +++ b/plugins/Watrack/myshows/i_cookies.inc @@ -47,7 +47,6 @@ begin result:=nil; FillChar(req,SizeOf(req),0); - req.cbSize :=NETLIBHTTPREQUEST_V1_SIZE;//SizeOf(req); req.requestType:=REQUEST_GET; req.szUrl :=url; req.flags :=NLHRF_NODUMP or NLHRF_HTTP11; diff --git a/protocols/CloudFile/src/http_request.h b/protocols/CloudFile/src/http_request.h index f63102f1cc..68be404921 100644 --- a/protocols/CloudFile/src/http_request.h +++ b/protocols/CloudFile/src/http_request.h @@ -24,7 +24,6 @@ private: void Init(int type) { - cbSize = sizeof(NETLIBHTTPREQUEST); requestType = type; flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP; szUrl = NULL; diff --git a/protocols/CurrencyRates/src/HTTPSession.cpp b/protocols/CurrencyRates/src/HTTPSession.cpp index 4c36778cf9..beee03b47c 100644 --- a/protocols/CurrencyRates/src/HTTPSession.cpp +++ b/protocols/CurrencyRates/src/HTTPSession.cpp @@ -38,7 +38,6 @@ bool CHTTPSession::ReadResponce(CMStringW &rsResponce) }; NETLIBHTTPREQUEST nlhr = {}; - nlhr.cbSize = sizeof(nlhr); nlhr.requestType = REQUEST_GET; nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_REDIRECT; nlhr.szUrl = m_szUrl.GetBuffer(); diff --git a/protocols/Facebook/src/avatars.cpp b/protocols/Facebook/src/avatars.cpp index 43b12dcdac..3f514fca9a 100644 --- a/protocols/Facebook/src/avatars.cpp +++ b/protocols/Facebook/src/avatars.cpp @@ -34,7 +34,6 @@ void FacebookProto::GetAvatarFilename(MCONTACT hContact, wchar_t *pwszFileName) void __cdecl FacebookProto::AvatarsUpdate(void *) { NETLIBHTTPREQUEST req = {}; - req.cbSize = sizeof(req); req.flags = NLHRF_NODUMP | NLHRF_SSL | NLHRF_HTTP11 | NLHRF_REDIRECT; req.requestType = REQUEST_GET; diff --git a/protocols/Facebook/src/server.cpp b/protocols/Facebook/src/server.cpp index 8601cd6db5..72ff76ac1f 100644 --- a/protocols/Facebook/src/server.cpp +++ b/protocols/Facebook/src/server.cpp @@ -761,7 +761,6 @@ void FacebookProto::OnPublishPrivateMessage(const JSONNode &root) std::string szUrl = sticker["thread_image"]["uri"].as_string(); NETLIBHTTPREQUEST req = {}; - req.cbSize = sizeof(req); req.flags = NLHRF_NODUMP | NLHRF_SSL | NLHRF_HTTP11 | NLHRF_REDIRECT; req.requestType = REQUEST_GET; req.szUrl = (char*)szUrl.c_str(); diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index 0b713871c3..3ab82cd50f 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -381,8 +381,7 @@ void __cdecl GaduProto::setavatarthread(void *param) char* token = getStringA(GG_KEY_TOKEN); //construct request - NETLIBHTTPREQUEST req = { 0 }; - req.cbSize = sizeof(req); + NETLIBHTTPREQUEST req = {}; req.requestType = REQUEST_POST; req.szUrl = "http://avatars.nowe.gg/upload"; req.flags = NLHRF_NODUMP | NLHRF_HTTP11; @@ -444,7 +443,6 @@ void __cdecl GaduProto::setavatarthread(void *param) //construct 2nd request memset(&req, 0, sizeof(req)); - req.cbSize = sizeof(req); req.requestType = REQUEST_POST; req.szUrl = "http://avatars.nowe.gg/upload"; req.flags = NLHRF_NODUMP | NLHRF_HTTP11; diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index e7674e959a..932c9c1553 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -327,7 +327,6 @@ int GaduProto::oauth_receivetoken() str = mir_strdup(szUrl); memset(&req, 0, sizeof(req)); - req.cbSize = sizeof(req); req.requestType = REQUEST_POST; req.szUrl = szUrl; req.flags = NLHRF_NODUMP | NLHRF_HTTP11; @@ -354,7 +353,6 @@ int GaduProto::oauth_receivetoken() token_secret = nullptr; memset(&req, 0, sizeof(req)); - req.cbSize = sizeof(req); req.requestType = REQUEST_POST; req.szUrl = szUrl; req.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_PERSISTENT; diff --git a/protocols/GmailNotifier/src/check.cpp b/protocols/GmailNotifier/src/check.cpp index fab62e5283..b5fa2d2dee 100644 --- a/protocols/GmailNotifier/src/check.cpp +++ b/protocols/GmailNotifier/src/check.cpp @@ -72,7 +72,6 @@ void CheckMailInbox(Account *curAcc) }; NETLIBHTTPREQUEST nlr = {}; - nlr.cbSize = sizeof(nlr); nlr.szUrl = szUrl.GetBuffer(); nlr.requestType = REQUEST_POST; nlr.headersCount = _countof(headers); @@ -105,7 +104,6 @@ void CheckMailInbox(Account *curAcc) }; NETLIBHTTPREQUEST nlr = {}; - nlr.cbSize = sizeof(nlr); nlr.szUrl = szUrl.GetBuffer(); nlr.requestType = REQUEST_GET; nlr.headers = headers; diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index b84560dde1..ebd33b3d93 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -50,7 +50,6 @@ void __cdecl CJabberProto::OfflineFileThread(OFDTHREAD *ofd) // initialize the netlib request NETLIBHTTPREQUEST nlhr = {}; - nlhr.cbSize = sizeof(nlhr); nlhr.requestType = REQUEST_GET; nlhr.flags = NLHRF_HTTP11 | NLHRF_DUMPASTEXT | NLHRF_REDIRECT; nlhr.szUrl = (char *)url; @@ -129,7 +128,6 @@ void CJabberProto::OnReceiveOfflineFile(DB::FILE_BLOB &blob, void *pHandle) void __cdecl CJabberProto::FileReceiveHttpThread(filetransfer *ft) { NETLIBHTTPREQUEST req = {}; - req.cbSize = sizeof(req); req.requestType = REQUEST_GET; req.szUrl = ft->httpPath; @@ -157,7 +155,6 @@ void CJabberProto::FileProcessHttpDownload(MCONTACT hContact, const char *jid, c auto *pszName = szName.c_str(); NETLIBHTTPREQUEST req = {}; - req.cbSize = sizeof(req); req.requestType = REQUEST_HEAD; req.szUrl = (char*)pszUrl; diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index 2124b88a83..e0ede298da 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -694,7 +694,6 @@ LBL_Fail: NETLIBHTTPHEADER hdr[10]; NETLIBHTTPREQUEST nlhr = {}; - nlhr.cbSize = sizeof(nlhr); nlhr.requestType = REQUEST_PUT; nlhr.flags = NLHRF_NODUMPSEND | NLHRF_SSL | NLHRF_REDIRECT; nlhr.szUrl = (char *)szUrl; diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 5d63b0d5a0..e018c39b40 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -882,7 +882,6 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) HNETLIBCONN hHttpCon = nullptr; for (auto &it : avs) { NETLIBHTTPREQUEST nlhr = { 0 }; - nlhr.cbSize = sizeof(nlhr); nlhr.requestType = REQUEST_GET; nlhr.flags = NLHRF_HTTP11 | NLHRF_REDIRECT | NLHRF_PERSISTENT; nlhr.szUrl = it->Url; diff --git a/protocols/NewsAggregator/Src/Utils.cpp b/protocols/NewsAggregator/Src/Utils.cpp index 50f21c817b..328c63bc8e 100644 --- a/protocols/NewsAggregator/Src/Utils.cpp +++ b/protocols/NewsAggregator/Src/Utils.cpp @@ -50,7 +50,6 @@ void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, CFeedEditor NETLIBHTTPREQUEST nlhr = { 0 }; // initialize the netlib request - nlhr.cbSize = sizeof(nlhr); nlhr.requestType = REQUEST_GET; nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_REDIRECT; if (wcsstr(tszUrl, L"https://") != nullptr) @@ -222,7 +221,6 @@ time_t DateToUnixTime(const char *stamp, bool FeedType) bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) { NETLIBHTTPREQUEST nlhr = { 0 }; - nlhr.cbSize = sizeof(nlhr); nlhr.requestType = REQUEST_GET; nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11; char *szUrl = mir_u2a(tszURL); diff --git a/protocols/Non-IM Contact/src/http.cpp b/protocols/Non-IM Contact/src/http.cpp index 466760d790..70804521b4 100644 --- a/protocols/Non-IM Contact/src/http.cpp +++ b/protocols/Non-IM Contact/src/http.cpp @@ -31,16 +31,15 @@ HNETLIBUSER hNetlibUser; // szUrl = URL of the webpage to be retrieved // return value = 0 for success, 1 or HTTP error code for failure // global var used: szData, szInfo = containing the retrieved data -// + int InternetDownloadFile(char *szUrl) { - NETLIBHTTPREQUEST nlhr = { 0 }; - // initialize the netlib request - nlhr.cbSize = sizeof(nlhr); + NETLIBHTTPREQUEST nlhr = {}; nlhr.requestType = REQUEST_GET; nlhr.flags = NLHRF_DUMPASTEXT; nlhr.szUrl = szUrl; + // change the header so the plugin is pretended to be IE 6 + WinXP nlhr.headersCount++; nlhr.headers = (NETLIBHTTPHEADER*)malloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount); diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 6c5dcc8341..4378651b6f 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -1469,7 +1469,6 @@ CMStringW CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport if (GetFileAttributesW(wszFileName) == INVALID_FILE_ATTRIBUTES) { T2Utf szUrl(wszUrl); NETLIBHTTPREQUEST req = {}; - req.cbSize = sizeof(req); req.flags = NLHRF_NODUMP | NLHRF_SSL | NLHRF_HTTP11 | NLHRF_REDIRECT; req.requestType = REQUEST_GET; req.szUrl = szUrl; diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp index 9c222f430c..1597b439ca 100644 --- a/protocols/VKontakte/src/vk_pollserver.cpp +++ b/protocols/VKontakte/src/vk_pollserver.cpp @@ -254,7 +254,6 @@ 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) NETLIBHTTPREQUEST req = {}; - req.cbSize = sizeof(req); req.requestType = REQUEST_GET; req.szUrl = szReqUrl.GetBuffer(); req.flags = VK_NODUMPHEADERS | NLHRF_PERSISTENT | NLHRF_HTTP11 | NLHRF_SSL; diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp index 7be5b1d412..39e521eff3 100644 --- a/protocols/WhatsApp/src/avatars.cpp +++ b/protocols/WhatsApp/src/avatars.cpp @@ -131,7 +131,6 @@ void WhatsAppProto::ServerFetchAvatar(const char *jid) bool CMPlugin::SaveFile(const char *pszUrl, PROTO_AVATAR_INFORMATION &ai) { NETLIBHTTPREQUEST req = {}; - req.cbSize = sizeof(req); req.flags = NLHRF_NODUMP | NLHRF_PERSISTENT | NLHRF_SSL | NLHRF_HTTP11 | NLHRF_REDIRECT; req.requestType = REQUEST_GET; req.szUrl = (char*)pszUrl; diff --git a/protocols/WhatsApp/src/utils.cpp b/protocols/WhatsApp/src/utils.cpp index c49821e21e..3d3650c043 100644 --- a/protocols/WhatsApp/src/utils.cpp +++ b/protocols/WhatsApp/src/utils.cpp @@ -522,7 +522,6 @@ MBinBuffer WhatsAppProto::DownloadEncryptedFile(const char *url, const ProtobufC NETLIBHTTPHEADER headers[1] = {{"Origin", "https://web.whatsapp.com"}}; NETLIBHTTPREQUEST req = {}; - req.cbSize = sizeof(req); req.requestType = REQUEST_GET; req.szUrl = (char*)url; req.headersCount = _countof(headers); diff --git a/src/mir_app/src/MHttpRequest.cpp b/src/mir_app/src/MHttpRequest.cpp index 7935974463..5c165a5130 100644 --- a/src/mir_app/src/MHttpRequest.cpp +++ b/src/mir_app/src/MHttpRequest.cpp @@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. MHttpRequest::MHttpRequest() { - cbSize = sizeof(NETLIBHTTPREQUEST); requestType = REQUEST_GET; } diff --git a/src/mir_app/src/netlib_autoproxy.cpp b/src/mir_app/src/netlib_autoproxy.cpp index f325f3a721..c725166c5c 100644 --- a/src/mir_app/src/netlib_autoproxy.cpp +++ b/src/mir_app/src/netlib_autoproxy.cpp @@ -53,7 +53,6 @@ static void GetFile(char *szUrl, AUTO_PROXY_SCRIPT_BUFFER &buf) // initialize the netlib request NETLIBHTTPREQUEST nlhr = {}; - nlhr.cbSize = sizeof(nlhr); nlhr.requestType = REQUEST_GET; nlhr.flags = NLHRF_HTTP11 | NLHRF_DUMPASTEXT | NLHRF_REDIRECT; nlhr.szUrl = szUrl; diff --git a/src/mir_app/src/netlib_http.cpp b/src/mir_app/src/netlib_http.cpp index a03dd20341..2317329e04 100644 --- a/src/mir_app/src/netlib_http.cpp +++ b/src/mir_app/src/netlib_http.cpp @@ -378,7 +378,7 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr int bytesSent = 0; bool lastFirstLineFail = false; - if (nlhr == nullptr || nlhr->cbSize != sizeof(NETLIBHTTPREQUEST) || nlhr->szUrl == nullptr || nlhr->szUrl[0] == '\0') { + if (nlhr == nullptr || nlhr->szUrl == nullptr || nlhr->szUrl[0] == '\0') { SetLastError(ERROR_INVALID_PARAMETER); return SOCKET_ERROR; } @@ -690,7 +690,7 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr MIR_APP_DLL(bool) Netlib_FreeHttpRequest(NETLIBHTTPREQUEST *nlhr) { - if (nlhr == nullptr || nlhr->cbSize != sizeof(NETLIBHTTPREQUEST) || nlhr->requestType != REQUEST_RESPONSE) { + if (nlhr == nullptr || nlhr->requestType != REQUEST_RESPONSE) { SetLastError(ERROR_INVALID_PARAMETER); return false; } @@ -720,7 +720,6 @@ MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HNETLIBCONN hConnection, uint32_t dwRequestTimeoutTime = GetTickCount() + HTTPRECVDATATIMEOUT; NETLIBHTTPREQUEST *nlhr = (NETLIBHTTPREQUEST*)mir_calloc(sizeof(NETLIBHTTPREQUEST)); - nlhr->cbSize = sizeof(NETLIBHTTPREQUEST); nlhr->nlc = nlc; // Needed to id connection in the protocol HTTP gateway wrapper functions nlhr->requestType = REQUEST_RESPONSE; @@ -810,10 +809,7 @@ MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HNETLIBCONN hConnection, MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_HttpTransaction(HNETLIBUSER nlu, NETLIBHTTPREQUEST *nlhr) { - if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_OUTGOING) || - nlhr == nullptr || nlhr->cbSize != sizeof(NETLIBHTTPREQUEST) || - nlhr->szUrl == nullptr || nlhr->szUrl[0] == 0) - { + if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_OUTGOING) || !nlhr || !nlhr->szUrl || nlhr->szUrl[0] == 0) { SetLastError(ERROR_INVALID_PARAMETER); return nullptr; } diff --git a/src/mir_app/src/netlib_openconn.cpp b/src/mir_app/src/netlib_openconn.cpp index 7d9b0b9114..adbde4d07e 100644 --- a/src/mir_app/src/netlib_openconn.cpp +++ b/src/mir_app/src/netlib_openconn.cpp @@ -308,8 +308,7 @@ static bool NetlibInitHttpsConnection(NetlibConnection *nlc) szUrl.Format("%s:%u", inet_ntoa(*(PIN_ADDR)&ip), url.port); } - NETLIBHTTPREQUEST nlhrSend = { 0 }; - nlhrSend.cbSize = sizeof(nlhrSend); + NETLIBHTTPREQUEST nlhrSend = {}; nlhrSend.requestType = REQUEST_CONNECT; nlhrSend.flags = NLHRF_DUMPPROXY | NLHRF_HTTP11 | NLHRF_NOPROXY | NLHRF_REDIRECT; nlhrSend.szUrl = szUrl.GetBuffer(); -- cgit v1.2.3