diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-12 21:27:03 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-12 21:27:03 +0300 |
commit | 3cb3883908e3168e5f955be3143771721614307a (patch) | |
tree | e160797994b28577e5fa71a4c790e1670e6f4035 /src | |
parent | 6461f17159c83bfaeba1ecbd124ab53551f3e22d (diff) |
Netlib_FreeHttpRequest() instead of MS_NETLIB_FREEHTTPREQUESTSTRUCT
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/mir_app.def | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 2 | ||||
-rw-r--r-- | src/mir_app/src/netlib.cpp | 3 | ||||
-rw-r--r-- | src/mir_app/src/netlib.h | 25 | ||||
-rw-r--r-- | src/mir_app/src/netlibautoproxy.cpp | 11 | ||||
-rw-r--r-- | src/mir_app/src/netlibhttp.cpp | 71 | ||||
-rw-r--r-- | src/mir_app/src/netlibhttpproxy.cpp | 18 | ||||
-rw-r--r-- | src/mir_app/src/netlibopenconn.cpp | 6 |
8 files changed, 65 insertions, 73 deletions
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 98b5cf622c..430ecaa097 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -354,3 +354,5 @@ Netlib_LogW @354 Netlib_Logf @355
Netlib_LogfW @356
Netlib_GetConnNlu @357
+Netlib_RecvHttpHeaders @358
+Netlib_HttpTransaction @359
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index b777b03b2e..d3bff9758a 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -354,3 +354,5 @@ Netlib_LogW @354 Netlib_Logf @355
Netlib_LogfW @356
Netlib_GetConnNlu @357
+Netlib_RecvHttpHeaders @358
+Netlib_HttpTransaction @359
diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp index 69b4195b37..0ae2a3a7d4 100644 --- a/src/mir_app/src/netlib.cpp +++ b/src/mir_app/src/netlib.cpp @@ -503,9 +503,6 @@ int LoadNetlibModule(void) CreateServiceFunction(MS_NETLIB_SETSTICKYHEADERS, NetlibHttpSetSticky);
CreateServiceFunction(MS_NETLIB_GETSOCKET, NetlibGetSocket);
CreateServiceFunction(MS_NETLIB_SENDHTTPREQUEST, NetlibHttpSendRequest);
- CreateServiceFunction(MS_NETLIB_RECVHTTPHEADERS, NetlibHttpRecvHeaders);
- CreateServiceFunction(MS_NETLIB_FREEHTTPREQUESTSTRUCT, NetlibHttpFreeRequestStruct);
- CreateServiceFunction(MS_NETLIB_HTTPTRANSACTION, NetlibHttpTransaction);
CreateServiceFunction(MS_NETLIB_SELECT, NetlibSelect);
CreateServiceFunction(MS_NETLIB_SELECTEX, NetlibSelectEx);
CreateServiceFunction(MS_NETLIB_SHUTDOWN, NetlibShutdown);
diff --git a/src/mir_app/src/netlib.h b/src/mir_app/src/netlib.h index 738242b0ae..c327339945 100644 --- a/src/mir_app/src/netlib.h +++ b/src/mir_app/src/netlib.h @@ -201,27 +201,24 @@ INT_PTR NetlibHttpUrlEncode(WPARAM wParam, LPARAM lParam); extern mir_cs csNetlibUser;
extern LIST<NetlibUser> netlibUser;
-//netlibautoproxy.c
+// netlibautoproxy.c
void NetlibLoadIeProxy(void);
void NetlibUnloadIeProxy(void);
char* NetlibGetIeProxy(char *szUrl);
bool NetlibGetIeProxyConn(NetlibConnection *nlc, bool forceHttps);
-//netlibbind.c
+// netlibbind.c
int NetlibFreeBoundPort(NetlibBoundPort *nlbp);
INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam);
bool BindSocketToPort(const char *szPorts, SOCKET s, SOCKET s6, int* portn);
-//netlibhttp.c
+// netlibhttp.c
INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam);
-INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam);
-INT_PTR NetlibHttpFreeRequestStruct(WPARAM wParam, LPARAM lParam);
-INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam);
void NetlibHttpSetLastErrorUsingHttpResult(int result);
NETLIBHTTPREQUEST* NetlibHttpRecv(NetlibConnection* nlc, DWORD hflags, DWORD dflags, bool isConnect = false);
void NetlibConnFromUrl(const char* szUrl, bool secur, NETLIBOPENCONNECTION &nloc);
-//netlibhttpproxy.c
+// netlibhttpproxy.c
int NetlibInitHttpConnection(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENCONNECTION *nloc);
int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags);
int NetlibHttpGatewayPost(NetlibConnection *nlc, const char *buf, int len, int flags);
@@ -231,13 +228,13 @@ INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam, LPARAM lParam); INT_PTR NetlibHttpSetPollingTimeout(WPARAM wParam, LPARAM lParam);
INT_PTR NetlibHttpSetSticky(WPARAM wParam, LPARAM lParam);
-//netliblog.c
+// netliblog.c
void NetlibLogShowOptions(void);
void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int flags);
void NetlibLogInit(void);
void NetlibLogShutdown(void);
-//netlibopenconn.c
+// netlibopenconn.c
DWORD DnsLookup(NetlibUser *nlu, const char *szHost);
int WaitUntilReadable(SOCKET s, DWORD dwTimeout, bool check = false);
int WaitUntilWritable(SOCKET s, DWORD dwTimeout);
@@ -246,15 +243,15 @@ bool NetlibReconnect(NetlibConnection *nlc); INT_PTR NetlibOpenConnection(WPARAM wParam, LPARAM lParam);
INT_PTR NetlibStartSsl(WPARAM wParam, LPARAM lParam);
-//netlibopts.c
+// netlibopts.c
int NetlibOptInitialise(WPARAM wParam, LPARAM lParam);
void NetlibSaveUserSettingsStruct(const char *szSettingsModule, NETLIBUSERSETTINGS *settings);
-//netlibpktrecver.c
+// netlibpktrecver.c
INT_PTR NetlibPacketRecverCreate(WPARAM wParam, LPARAM lParam);
INT_PTR NetlibPacketRecverGetMore(WPARAM wParam, LPARAM lParam);
-//netlibsock.c
+// netlibsock.c
#define NL_SELECT_READ 0x0001
#define NL_SELECT_WRITE 0x0002
#define NL_SELECT_ALL (NL_SELECT_READ+NL_SELECT_WRITE)
@@ -268,7 +265,7 @@ char* NetlibAddressToString(SOCKADDR_INET_M* addr); void NetlibGetConnectionInfo(NetlibConnection* nlc, NETLIBCONNINFO *connInfo);
NETLIBIPLIST* GetMyIp(unsigned flags);
-//netlibupnp.c
+// netlibupnp.c
bool NetlibUPnPAddPortMapping(WORD intport, char *proto,
WORD *extport, DWORD *extip, bool search);
void NetlibUPnPDeletePortMapping(WORD extport, char* proto);
@@ -276,7 +273,7 @@ void NetlibUPnPCleanup(void*); void NetlibUPnPInit(void);
void NetlibUPnPDestroy(void);
-//netlibsecurity.c
+// netlibsecurity.c
void NetlibSecurityInit(void);
void NetlibDestroySecurityProvider(HANDLE hSecurity);
HANDLE NetlibInitSecurityProvider(const wchar_t* szProvider, const wchar_t* szPrincipal);
diff --git a/src/mir_app/src/netlibautoproxy.cpp b/src/mir_app/src/netlibautoproxy.cpp index 3e2e070df9..15fb93b3a2 100644 --- a/src/mir_app/src/netlibautoproxy.cpp +++ b/src/mir_app/src/netlibautoproxy.cpp @@ -144,19 +144,16 @@ static void GetFile(char* szUrl, AUTO_PROXY_SCRIPT_BUFFER &buf) nlhr.szUrl = szUrl;
// download the page
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)NetlibHttpTransaction((WPARAM)&nlu, (LPARAM)&nlhr);
-
- if (nlhrReply)
- {
- if (nlhrReply->resultCode == 200)
- {
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(&nlu, &nlhr);
+ if (nlhrReply) {
+ if (nlhrReply->resultCode == 200) {
buf.lpszScriptBuffer = nlhrReply->pData;
buf.dwScriptBufferSize = nlhrReply->dataLength + 1;
nlhrReply->dataLength = 0;
nlhrReply->pData = NULL;
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
}
}
diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp index b37a14e6dd..3ff0e83ba4 100644 --- a/src/mir_app/src/netlibhttp.cpp +++ b/src/mir_app/src/netlibhttp.cpp @@ -550,13 +550,13 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) (nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0) | MSG_NODUMP;
if (resultCode == 100)
- nlhrReply = (NETLIBHTTPREQUEST*)NetlibHttpRecvHeaders((WPARAM)nlc, hflags);
+ nlhrReply = (NETLIBHTTPREQUEST*)Netlib_RecvHttpHeaders(nlc, hflags);
else if (resultCode == 307 || ((resultCode == 301 || resultCode == 302) && (nlhr->flags & NLHRF_REDIRECT))) { // redirect
pszUrl = NULL;
if (nlhr->requestType == REQUEST_HEAD)
- nlhrReply = (NETLIBHTTPREQUEST*)NetlibHttpRecvHeaders((WPARAM)nlc, hflags);
+ nlhrReply = (NETLIBHTTPREQUEST*)Netlib_RecvHttpHeaders(nlc, hflags);
else
nlhrReply = NetlibHttpRecv(nlc, hflags, dflags);
@@ -598,7 +598,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) }
else if (resultCode == 401 && !doneAuthHeader) { //auth required
if (nlhr->requestType == REQUEST_HEAD)
- nlhrReply = (NETLIBHTTPREQUEST*)NetlibHttpRecvHeaders((WPARAM)nlc, hflags);
+ nlhrReply = (NETLIBHTTPREQUEST*)Netlib_RecvHttpHeaders(nlc, hflags);
else
nlhrReply = NetlibHttpRecv(nlc, hflags, dflags);
@@ -632,7 +632,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) }
else if (resultCode == 407 && !doneProxyAuthHeader) { //proxy auth required
if (nlhr->requestType == REQUEST_HEAD)
- nlhrReply = (NETLIBHTTPREQUEST*)NetlibHttpRecvHeaders((WPARAM)nlc, hflags);
+ nlhrReply = Netlib_RecvHttpHeaders(nlc, hflags);
else
nlhrReply = NetlibHttpRecv(nlc, hflags, dflags);
@@ -673,14 +673,14 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) replaceStr(pszAuthHdr, NULL);
if (nlhrReply) {
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
nlhrReply = NULL;
}
}
if (count == 0) bytesSent = SOCKET_ERROR;
if (nlhrReply)
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
//clean up
mir_free(pszProxyAuthHdr);
@@ -694,14 +694,13 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) return bytesSent;
}
-INT_PTR NetlibHttpFreeRequestStruct(WPARAM, LPARAM lParam)
+MIR_APP_DLL(bool) Netlib_FreeHttpRequest(NETLIBHTTPREQUEST *nlhr)
{
- NETLIBHTTPREQUEST *nlhr = (NETLIBHTTPREQUEST*)lParam;
-
if (nlhr == NULL || nlhr->cbSize != sizeof(NETLIBHTTPREQUEST) || nlhr->requestType != REQUEST_RESPONSE) {
SetLastError(ERROR_INVALID_PARAMETER);
- return 0;
+ return false;
}
+
if (nlhr->headers) {
for (int i = 0; i < nlhr->headersCount; i++) {
NETLIBHTTPHEADER &p = nlhr->headers[i];
@@ -714,16 +713,16 @@ INT_PTR NetlibHttpFreeRequestStruct(WPARAM, LPARAM lParam) mir_free(nlhr->szResultDescr);
mir_free(nlhr->szUrl);
mir_free(nlhr);
- return 1;
+ return true;
}
#define NHRV_BUF_SIZE 8192
-INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HANDLE hConnection, int flags)
{
- NetlibConnection *nlc = (NetlibConnection*)wParam;
+ NetlibConnection *nlc = (NetlibConnection*)hConnection;
if (!NetlibEnterNestedCS(nlc, NLNCS_RECV))
- return 0;
+ return NULL;
DWORD dwRequestTimeoutTime = GetTickCount() + HTTPRECVDATATIMEOUT;
NETLIBHTTPREQUEST *nlhr = (NETLIBHTTPREQUEST*)mir_calloc(sizeof(NETLIBHTTPREQUEST));
@@ -732,20 +731,20 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam) nlhr->requestType = REQUEST_RESPONSE;
int firstLineLength = 0;
- if (!HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, lParam | MSG_PEEK, &nlhr->resultCode, &nlhr->szResultDescr, &firstLineLength)) {
+ if (!HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, flags | MSG_PEEK, &nlhr->resultCode, &nlhr->szResultDescr, &firstLineLength)) {
NetlibLeaveNestedCS(&nlc->ncsRecv);
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhr);
- return 0;
+ Netlib_FreeHttpRequest(nlhr);
+ return NULL;
}
char *buffer = (char*)_alloca(NHRV_BUF_SIZE + 1);
- int bytesPeeked = Netlib_Recv(nlc, buffer, min(firstLineLength, NHRV_BUF_SIZE), lParam | MSG_DUMPASTEXT);
+ int bytesPeeked = Netlib_Recv(nlc, buffer, min(firstLineLength, NHRV_BUF_SIZE), flags | MSG_DUMPASTEXT);
if (bytesPeeked != firstLineLength) {
NetlibLeaveNestedCS(&nlc->ncsRecv);
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhr);
+ Netlib_FreeHttpRequest(nlhr);
if (bytesPeeked != SOCKET_ERROR)
SetLastError(ERROR_HANDLE_EOF);
- return 0;
+ return NULL;
}
// Make sure all headers arrived
@@ -753,7 +752,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam) int headersCount = 0;
bytesPeeked = 0;
for (bool headersCompleted = false; !headersCompleted;) {
- bytesPeeked = RecvWithTimeoutTime(nlc, dwRequestTimeoutTime, buffer, NHRV_BUF_SIZE, lParam | MSG_DUMPASTEXT | MSG_NOTITLE);
+ bytesPeeked = RecvWithTimeoutTime(nlc, dwRequestTimeoutTime, buffer, NHRV_BUF_SIZE, flags | MSG_DUMPASTEXT | MSG_NOTITLE);
if (bytesPeeked == 0)
break;
@@ -780,8 +779,8 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam) // Receive headers
if (bytesPeeked <= 0) {
NetlibLeaveNestedCS(&nlc->ncsRecv);
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhr);
- return 0;
+ Netlib_FreeHttpRequest(nlhr);
+ return NULL;
}
nlhr->headersCount = headersCount;
@@ -796,7 +795,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam) char *pColon = strchr(pbuffer, ':');
if (pColon == NULL) {
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhr); nlhr = NULL;
+ Netlib_FreeHttpRequest(nlhr); nlhr = NULL;
SetLastError(ERROR_INVALID_DATA);
break;
}
@@ -814,14 +813,11 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam) }
NetlibLeaveNestedCS(&nlc->ncsRecv);
- return (INT_PTR)nlhr;
+ return nlhr;
}
-INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_HttpTransaction(HNETLIBUSER nlu, NETLIBHTTPREQUEST *nlhr)
{
- NetlibUser *nlu = (NetlibUser*)wParam;
- NETLIBHTTPREQUEST *nlhr = (NETLIBHTTPREQUEST*)lParam, *nlhrReply;
-
if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_OUTGOING) ||
nlhr == NULL || nlhr->cbSize != sizeof(NETLIBHTTPREQUEST) ||
nlhr->szUrl == NULL || nlhr->szUrl[0] == 0)
@@ -888,8 +884,9 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam) (nlhr->flags & NLHRF_NODUMP ? MSG_NODUMP : (nlhr->flags & NLHRF_DUMPPROXY ? MSG_DUMPPROXY : 0)) |
(nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0);
+ NETLIBHTTPREQUEST *nlhrReply;
if (nlhr->requestType == REQUEST_HEAD)
- nlhrReply = (NETLIBHTTPREQUEST*)NetlibHttpRecvHeaders((WPARAM)nlc, 0);
+ nlhrReply = Netlib_RecvHttpHeaders(nlc);
else
nlhrReply = NetlibHttpRecv(nlc, hflags, dflags);
@@ -905,7 +902,7 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam) }
else nlhrReply->nlc = nlc;
- return (INT_PTR)nlhrReply;
+ return nlhrReply;
}
void NetlibHttpSetLastErrorUsingHttpResult(int result)
@@ -1011,12 +1008,12 @@ NETLIBHTTPREQUEST* NetlibHttpRecv(NetlibConnection *nlc, DWORD hflags, DWORD dfl int cenc = 0, cenctype = 0, close = 0;
next:
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)NetlibHttpRecvHeaders((WPARAM)nlc, hflags);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_RecvHttpHeaders(nlc, hflags);
if (nlhrReply == NULL)
return NULL;
if (nlhrReply->resultCode == 100) {
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
goto next;
}
@@ -1050,7 +1047,7 @@ next: if (chunked) {
chunksz = NetlibHttpRecvChunkHeader(nlc, true, dflags | (cenctype ? MSG_NODUMP : 0));
if (chunksz == SOCKET_ERROR) {
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
return NULL;
}
dataLen = chunksz;
@@ -1067,7 +1064,7 @@ next: if (recvResult == 0) break;
if (recvResult == SOCKET_ERROR) {
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
return NULL;
}
nlhrReply->dataLength += recvResult;
@@ -1081,7 +1078,7 @@ next: nlhrReply->pData = (char*)mir_realloc(nlhrReply->pData, dataBufferAlloced);
if (nlhrReply->pData == NULL) {
SetLastError(ERROR_OUTOFMEMORY);
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
return NULL;
}
}
@@ -1093,7 +1090,7 @@ next: chunksz = NetlibHttpRecvChunkHeader(nlc, false, dflags | MSG_NODUMP);
if (chunksz == SOCKET_ERROR) {
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
return NULL;
}
dataLen += chunksz;
diff --git a/src/mir_app/src/netlibhttpproxy.cpp b/src/mir_app/src/netlibhttpproxy.cpp index d34d67985e..db4cdcb70e 100644 --- a/src/mir_app/src/netlibhttpproxy.cpp +++ b/src/mir_app/src/netlibhttpproxy.cpp @@ -185,7 +185,7 @@ static bool NetlibHttpGatewayOscarPost(NetlibConnection *nlc, const char *buf, i NetlibHttpSetLastErrorUsingHttpResult(nlhrReply->resultCode);
res = false;
}
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
}
else res = false;
}
@@ -304,7 +304,7 @@ int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags) if (nlhrReply->resultCode >= 300) {
int resultCode = nlhrReply->resultCode;
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
if (nlc->nlhpi.szHttpGetUrl && resultCode != 404) {
Netlib_Logf(nlu, "Error received from proxy, retrying");
@@ -324,7 +324,7 @@ int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags) if (nlhrReply->dataLength) {
if (peek) {
nlc->szProxyBuf.Append(nlhrReply->pData, nlhrReply->dataLength);
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
return HttpGatewayReadSetResult(nlc, buf, len, peek);
}
@@ -337,16 +337,16 @@ int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags) else
nlc->szProxyBuf.Empty();
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
return bytes;
}
else {
if ((peek && nlc->szProxyBuf.GetLength() != 0) || nlhrReply->pData) {
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
return HttpGatewayReadSetResult(nlc, buf, len, peek);
}
}
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
}
SetLastError(ERROR_GEN_FAILURE);
@@ -371,15 +371,15 @@ int NetlibInitHttpConnection(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENC if (nlhrReply->resultCode != 200) {
NetlibHttpSetLastErrorUsingHttpResult(nlhrReply->resultCode);
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
return 0;
}
}
if (!nlu->user.pfnHttpGatewayInit(nlc, nloc, nlhrReply)) {
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
return 0;
}
- NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
/*
* Gena01 - Ok, we should be able to use just POST. Needed for Yahoo, NO GET requests
diff --git a/src/mir_app/src/netlibopenconn.cpp b/src/mir_app/src/netlibopenconn.cpp index 18216f1c51..de29ab3b44 100644 --- a/src/mir_app/src/netlibopenconn.cpp +++ b/src/mir_app/src/netlibopenconn.cpp @@ -324,17 +324,17 @@ static bool NetlibInitHttpsConnection(NetlibConnection *nlc, NetlibUser *nlu, NE if (nlhrReply->resultCode < 200 || nlhrReply->resultCode >= 300) { if (nlhrReply->resultCode == 403 && nlc->dnsThroughProxy) { - NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply); + Netlib_FreeHttpRequest(nlhrReply); nlc->dnsThroughProxy = 0; return NetlibInitHttpsConnection(nlc, nlu, nloc); } NetlibHttpSetLastErrorUsingHttpResult(nlhrReply->resultCode); Netlib_Logf(nlu, "%s %d: %s request failed (%u %s)", __FILE__, __LINE__, nlu->settings.proxyType == PROXYTYPE_HTTP ? "HTTP" : "HTTPS", nlhrReply->resultCode, nlhrReply->szResultDescr); - NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply); + Netlib_FreeHttpRequest(nlhrReply); return 0; } - NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply); + Netlib_FreeHttpRequest(nlhrReply); return true; // connected } |