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 --- 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 +-- 4 files changed, 4 insertions(+), 11 deletions(-) (limited to 'src') 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