summaryrefslogtreecommitdiff
path: root/src/modules/netlib
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-02-11 12:15:06 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-02-11 12:15:06 +0000
commitb93e076795f7998aef8a63f7602998cdc6632a80 (patch)
tree117b7d8cbbb83f34328c4469d4f1f64cf825e44e /src/modules/netlib
parent433cefc1e5c20517728904a925f0f45381e86939 (diff)
core: copyright update to year 2013
git-svn-id: http://svn.miranda-ng.org/main/trunk@3549 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/netlib')
-rw-r--r--src/modules/netlib/netlib.cpp13
-rw-r--r--src/modules/netlib/netlib.h17
-rw-r--r--src/modules/netlib/netlibautoproxy.cpp42
-rw-r--r--src/modules/netlib/netlibbind.cpp11
-rw-r--r--src/modules/netlib/netlibhttp.cpp89
-rw-r--r--src/modules/netlib/netlibhttpproxy.cpp27
-rw-r--r--src/modules/netlib/netliblog.cpp2
-rw-r--r--src/modules/netlib/netlibopenconn.cpp41
-rw-r--r--src/modules/netlib/netlibopts.cpp53
-rw-r--r--src/modules/netlib/netlibpktrecver.cpp5
-rw-r--r--src/modules/netlib/netlibsecurity.cpp51
-rw-r--r--src/modules/netlib/netlibsock.cpp25
-rw-r--r--src/modules/netlib/netlibssl.cpp2
-rw-r--r--src/modules/netlib/netlibupnp.cpp57
14 files changed, 224 insertions, 211 deletions
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp
index 92d638382d..4245a0e5d6 100644
--- a/src/modules/netlib/netlib.cpp
+++ b/src/modules/netlib/netlib.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2012 Miranda ICQ/IM project,
+Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "..\..\core\commonheaders.h"
#include "netlib.h"
@@ -432,9 +433,9 @@ INT_PTR NetlibHttpUrlEncode(WPARAM, LPARAM lParam)
return (INT_PTR)(unsigned char*)NULL;
}
for (pszOut = szOutput, pszIn = szInput;*pszIn;pszIn++) {
- if ((48 <= *pszIn && *pszIn <= 57) ||
- (65 <= *pszIn && *pszIn <= 90) ||
- (97 <= *pszIn && *pszIn <= 122) ||
+ if ((48 <= *pszIn && *pszIn <= 57) ||
+ (65 <= *pszIn && *pszIn <= 90) ||
+ (97 <= *pszIn && *pszIn <= 122) ||
*pszIn == '-' || *pszIn == '_' || *pszIn == '.') *pszOut++=*pszIn;
else if (*pszIn == ' ') *pszOut++='+';
else {
@@ -600,7 +601,7 @@ int LoadNetlibModule(void)
case 0x1c:
break;
- case 0x02: // Vista Home Basic edition have connection limit of 2 / sec
+ case 0x02: // Vista Home Basic edition have connection limit of 2 / sec
case 0x05:
connectionTimeout = 1000;
break;
diff --git a/src/modules/netlib/netlib.h b/src/modules/netlib/netlib.h
index 07316635ac..c7ca929e0c 100644
--- a/src/modules/netlib/netlib.h
+++ b/src/modules/netlib/netlib.h
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2012 Miranda ICQ/IM project,
+Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#define GetNetlibHandleType(h) (h?*(int*)h:NLH_INVALID)
#define NLH_INVALID 0
#define NLH_USER 'USER'
@@ -27,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define NLH_BOUNDPORT 'BIND'
#define NLH_PACKETRECVER 'PCKT'
-struct NetlibUser
+struct NetlibUser
{
int handleType;
NETLIBUSER user;
@@ -45,7 +46,7 @@ struct NetlibNestedCriticalSection
int lockCount;
};
-struct NetlibHTTPProxyPacketQueue
+struct NetlibHTTPProxyPacketQueue
{
struct NetlibHTTPProxyPacketQueue *next;
PBYTE dataBuffer;
@@ -55,10 +56,10 @@ struct NetlibHTTPProxyPacketQueue
typedef union _SOCKADDR_INET_M {
SOCKADDR_IN Ipv4;
SOCKADDR_IN6 Ipv6;
- USHORT si_family;
+ USHORT si_family;
} SOCKADDR_INET_M, *PSOCKADDR_INET_M;
-struct NetlibConnection
+struct NetlibConnection
{
int handleType;
SOCKET s, s2;
@@ -192,7 +193,7 @@ void NetlibGetConnectionInfo(NetlibConnection* nlc, NETLIBCONNINFO *connInfo);
NETLIBIPLIST* GetMyIp(unsigned flags);
//netlibupnp.c
-bool NetlibUPnPAddPortMapping(WORD intport, char *proto,
+bool NetlibUPnPAddPortMapping(WORD intport, char *proto,
WORD *extport, DWORD *extip, bool search);
void NetlibUPnPDeletePortMapping(WORD extport, char* proto);
void NetlibUPnPCleanup(void*);
@@ -205,7 +206,7 @@ void NetlibSecurityDestroy(void);
void NetlibDestroySecurityProvider(HANDLE hSecurity);
HANDLE NetlibInitSecurityProvider(const TCHAR* szProvider, const TCHAR* szPrincipal);
HANDLE NetlibInitSecurityProvider(const char* szProvider, const char* szPrincipal);
-char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, const TCHAR* login, const TCHAR* psw,
+char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, const TCHAR* login, const TCHAR* psw,
bool http, unsigned& complete);
static __inline INT_PTR NLSend(struct NetlibConnection *nlc, const char *buf, int len, int flags) {
diff --git a/src/modules/netlib/netlibautoproxy.cpp b/src/modules/netlib/netlibautoproxy.cpp
index 33992028dc..3d46a739f8 100644
--- a/src/modules/netlib/netlibautoproxy.cpp
+++ b/src/modules/netlib/netlibautoproxy.cpp
@@ -1,7 +1,7 @@
/*
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2010-2011 Miranda ICQ/IM project,
+Copyright 2010-2011 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -10,7 +10,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -19,18 +19,20 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "..\..\core\commonheaders.h"
#include "netlib.h"
#include <wininet.h>
+
/*
/////////////////////////////////////////////////////////////////////
// ResolveHostName (a helper function)
/////////////////////////////////////////////////////////////////////
-DWORD __stdcall ResolveHostName(LPSTR lpszHostName,
+DWORD __stdcall ResolveHostName(LPSTR lpszHostName,
LPSTR lpszIPAddress, LPDWORD lpdwIPAddressSize)
{
- if (*lpdwIPAddressSize < 17 || lpszIPAddress == NULL)
+ if (*lpdwIPAddressSize < 17 || lpszIPAddress == NULL)
{
*lpdwIPAddressSize = 17;
return ERROR_INSUFFICIENT_BUFFER;
@@ -46,7 +48,7 @@ DWORD __stdcall ResolveHostName(LPSTR lpszHostName,
else
return SOCKET_ERROR;
}
- mir_snprintf(lpszIPAddress, *lpdwIPAddressSize, "%u.%u.%u.%u",
+ mir_snprintf(lpszIPAddress, *lpdwIPAddressSize, "%u.%u.%u.%u",
ip.s_net, ip.s_host, ip.s_lh, ip.s_impno);
return 0;
@@ -90,22 +92,22 @@ BOOL __stdcall IsInNet(LPSTR lpszIPAddress, LPSTR lpszDest, LPSTR lpszMask)
dwDest = inet_addr(lpszDest);
dwMask = inet_addr(lpszMask);
- if ((dwDest == INADDR_NONE) ||
+ if ((dwDest == INADDR_NONE) ||
(dwIpAddr == INADDR_NONE) || ((dwIpAddr & dwMask) != dwDest))
return (FALSE);
return (TRUE);
}
-static const AutoProxyHelperVtbl OurVtbl =
+static const AutoProxyHelperVtbl OurVtbl =
{
- IsResolvable,
- GetIPAddress,
- ResolveHostName,
- IsInNet,
- NULL,
- NULL,
- NULL,
+ IsResolvable,
+ GetIPAddress,
+ ResolveHostName,
+ IsInNet,
+ NULL,
+ NULL,
+ NULL,
NULL
};
@@ -162,7 +164,7 @@ bool NetlibGetIeProxyConn(NetlibConnection *nlc, bool forceHttps)
bool usingSsl = false;
char szUrl[256] = "";
- if ((nlc->nloc.flags & (NLOCF_HTTP | NLOCF_HTTPGATEWAY) && nlc->nloc.flags & NLOCF_SSL) ||
+ if ((nlc->nloc.flags & (NLOCF_HTTP | NLOCF_HTTPGATEWAY) && nlc->nloc.flags & NLOCF_SSL) ||
nlc->nloc.wPort == 443 || forceHttps)
{
mir_snprintf(szUrl, sizeof(szUrl), "https://%s", nlc->nloc.szHost);
@@ -219,7 +221,7 @@ bool NetlibGetIeProxyConn(NetlibConnection *nlc, bool forceHttps)
nlc->wProxyPort = p ? atol(p) : 1080;
nlc->szProxyServer = mir_strdup(h);
}
- else
+ else
return false;
return true;
@@ -261,7 +263,7 @@ struct IeProxyParam
{
char *szUrl;
char *szHost;
- char *szProxy;
+ char *szProxy;
};
static unsigned __stdcall NetlibIeProxyThread(void * arg)
@@ -299,7 +301,7 @@ static unsigned __stdcall NetlibIeProxyThread(void * arg)
char *proxy = proxyBuffer;
DWORD dwProxyLen = sizeof(proxyBuffer);
- if (pInternetGetProxyInfo(param->szUrl, (DWORD)strlen(param->szUrl),
+ if (pInternetGetProxyInfo(param->szUrl, (DWORD)strlen(param->szUrl),
param->szHost, (DWORD)strlen(param->szHost), &proxy, &dwProxyLen))
param->szProxy = mir_strdup(lrtrim(proxy));
@@ -337,7 +339,7 @@ char* NetlibGetIeProxy(char *szUrl)
int ind = -1;
if (strstr(szUrl, "http://"))
ind = szProxyHost[0] ? 0 : 2;
- else if (strstr(szUrl, "https://"))
+ else if (strstr(szUrl, "https://"))
ind = bOneProxy ? 0 : (szProxyHost[1] ? 1 : 2);
else
ind = szProxyHost[2] ? 2 : (bOneProxy ? 0 : (szProxyHost[1] ? 1 : 2));
@@ -365,7 +367,7 @@ char* NetlibGetIeProxy(char *szUrl)
void NetlibLoadIeProxy(void)
{
HKEY hSettings;
- if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
+ if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
0, KEY_QUERY_VALUE, &hSettings))
return;
diff --git a/src/modules/netlib/netlibbind.cpp b/src/modules/netlib/netlibbind.cpp
index 86bbc70b20..01ed2b7413 100644
--- a/src/modules/netlib/netlibbind.cpp
+++ b/src/modules/netlib/netlibbind.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2012 Miranda ICQ/IM project,
+Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "..\..\core\commonheaders.h"
#include "netlib.h"
@@ -77,7 +78,7 @@ bool BindSocketToPort(const char *szPorts, SOCKET s, SOCKET s6, int* portn)
if (s == INVALID_SOCKET) continue;
if ( !before && portnum <= *portn) continue;
- if (before && portnum >= *portn)
+ if (before && portnum >= *portn)
return false;
sin.sin_port = htons((WORD)port);
@@ -299,10 +300,10 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam)
}
DWORD extIP;
- if (nlu->settings.enableUPnP &&
+ if (nlu->settings.enableUPnP &&
NetlibUPnPAddPortMapping(nlb->wPort, "TCP", &nlbp->wExPort, &extIP, nlb->cbSize > NETLIBBIND_SIZEOF_V2))
{
- NetlibLogf(NULL, "UPnP port mapping succeeded. Internal Port: %u External Port: %u\n",
+ NetlibLogf(NULL, "UPnP port mapping succeeded. Internal Port: %u External Port: %u\n",
nlb->wPort, nlbp->wExPort);
if (nlb->cbSize > NETLIBBIND_SIZEOF_V2)
{
diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp
index a871f6957a..f675ba8c0f 100644
--- a/src/modules/netlib/netlibhttp.cpp
+++ b/src/modules/netlib/netlibhttp.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "..\..\core\commonheaders.h"
#include "../plugins/zlib/src/zlib.h"
#include "netlib.h"
@@ -27,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define HTTPRECVHEADERSTIMEOUT 30000 //in ms
#define HTTPRECVDATATIMEOUT 20000
-struct ResizableCharBuffer
+struct ResizableCharBuffer
{
char *sz;
int iEnd, cbAlloced;
@@ -138,7 +139,7 @@ static int RecvWithTimeoutTime(struct NetlibConnection *nlc, unsigned dwTimeoutT
static char* NetlibHttpFindHeader(NETLIBHTTPREQUEST *nlhrReply, const char *hdr)
{
- for (int i=0; i < nlhrReply->headersCount; i++)
+ for (int i=0; i < nlhrReply->headersCount; i++)
{
if (_stricmp(nlhrReply->headers[i].szName, hdr) == 0)
{
@@ -257,7 +258,7 @@ struct HttpSecurityContext
return m_hNtlmSecurity && m_szProvider && _stricmp(m_szProvider, "Basic");
}
- char* Execute(NetlibConnection *nlc, char* szHost, const char* szProvider,
+ char* Execute(NetlibConnection *nlc, char* szHost, const char* szProvider,
const char* szChallenge, unsigned& complete)
{
char* szAuthHdr = NULL;
@@ -296,11 +297,11 @@ struct HttpSecurityContext
szPassw = mir_a2t(nlc->nlu->settings.szProxyAuthPassword);
}
- szAuthHdr = NtlmCreateResponseFromChallenge(m_hNtlmSecurity,
+ szAuthHdr = NtlmCreateResponseFromChallenge(m_hNtlmSecurity,
szChallenge, szLogin, szPassw, true, complete);
if ( !szAuthHdr) {
- NetlibLogf(NULL, "Security login %s failed, user: " TCHAR_STR_PARAM " pssw: " TCHAR_STR_PARAM,
+ NetlibLogf(NULL, "Security login %s failed, user: " TCHAR_STR_PARAM " pssw: " TCHAR_STR_PARAM,
szProvider, szLogin ? szLogin : _T("(no user)"), szPassw ? _T("(exist)") : _T("(no psw)"));
}
else if (justCreated)
@@ -315,8 +316,8 @@ struct HttpSecurityContext
}
};
-static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime,
- DWORD recvFlags, int *resultCode,
+static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime,
+ DWORD recvFlags, int *resultCode,
char **ppszResultDescr, int *length)
{
int bytesPeeked;
@@ -325,7 +326,7 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime,
for (;;)
{
- bytesPeeked = RecvWithTimeoutTime(nlc, dwTimeoutTime, buffer, SIZEOF(buffer) - 1,
+ bytesPeeked = RecvWithTimeoutTime(nlc, dwTimeoutTime, buffer, SIZEOF(buffer) - 1,
MSG_PEEK | recvFlags);
if (bytesPeeked == 0)
@@ -374,7 +375,7 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime,
size_t off = strcspn(buffer, " \t");
if (off >= (unsigned)bytesPeeked)
return 0;
-
+
char* pResultCode = buffer + off;
*(pResultCode++) = 0;
@@ -397,16 +398,16 @@ static int SendHttpRequestAndData(struct NetlibConnection *nlc, struct Resizable
else
AppendToCharBuffer(httpRequest, "\r\n");
- DWORD hflags = (nlhr->flags & NLHRF_DUMPASTEXT ? MSG_DUMPASTEXT : 0) |
- (nlhr->flags & (NLHRF_NODUMP | NLHRF_NODUMPSEND | NLHRF_NODUMPHEADERS) ?
+ DWORD hflags = (nlhr->flags & NLHRF_DUMPASTEXT ? MSG_DUMPASTEXT : 0) |
+ (nlhr->flags & (NLHRF_NODUMP | NLHRF_NODUMPSEND | NLHRF_NODUMPHEADERS) ?
MSG_NODUMP : (nlhr->flags & NLHRF_DUMPPROXY ? MSG_DUMPPROXY : 0)) |
(nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0);
int bytesSent = NLSend(nlc, httpRequest->sz, httpRequest->iEnd, hflags);
if (bytesSent != SOCKET_ERROR && sendData && nlhr->dataLength)
{
- DWORD sflags = (nlhr->flags & NLHRF_DUMPASTEXT ? MSG_DUMPASTEXT : 0) |
- (nlhr->flags & (NLHRF_NODUMP | NLHRF_NODUMPSEND) ?
+ DWORD sflags = (nlhr->flags & NLHRF_DUMPASTEXT ? MSG_DUMPASTEXT : 0) |
+ (nlhr->flags & (NLHRF_NODUMP | NLHRF_NODUMPSEND) ?
MSG_NODUMP : (nlhr->flags & NLHRF_DUMPPROXY ? MSG_DUMPPROXY : 0)) |
(nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0);
@@ -520,18 +521,18 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam)
mir_snprintf(szHost, 64, "%s%s", inet_ntoa(*(PIN_ADDR)&ip), cln ? cln : "");
}
/*
- if (ip && pszUrl[0] != '/')
+ if (ip && pszUrl[0] != '/')
{
mir_free(szNewUrl);
szNewUrl = (char*)mir_alloc(strlen(pszUrl) + 60);
szNewUrl[0] = 0;
-
+
phost = strstr(pszUrl, "://");
if (phost)
{
phost += 3;
size_t len = phost - pszUrl;
- memcpy(szNewUrl, pszUrl, len);
+ memcpy(szNewUrl, pszUrl, len);
szNewUrl[len] = 0;
}
strcat(szNewUrl, inet_ntoa(*(PIN_ADDR)&ip));
@@ -603,11 +604,11 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam)
{
NetlibLogf(nlc->nlu, "%s %d: %s Failed (%u %u)", __FILE__, __LINE__, "HttpPeekFirstResponseLine", GetLastError(), count);
DWORD err = GetLastError();
- if (err == ERROR_TIMEOUT || err == ERROR_BAD_FORMAT || err == ERROR_BUFFER_OVERFLOW ||
+ if (err == ERROR_TIMEOUT || err == ERROR_BAD_FORMAT || err == ERROR_BUFFER_OVERFLOW ||
lastFirstLineFail || nlc->termRequested || nlhr->requestType == REQUEST_CONNECT)
{
bytesSent = SOCKET_ERROR;
- break;
+ break;
}
else
{
@@ -617,11 +618,11 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam)
}
lastFirstLineFail = false;
- DWORD hflags = (nlhr->flags & (NLHRF_NODUMP|NLHRF_NODUMPHEADERS|NLHRF_NODUMPSEND) ?
+ DWORD hflags = (nlhr->flags & (NLHRF_NODUMP|NLHRF_NODUMPHEADERS|NLHRF_NODUMPSEND) ?
MSG_NODUMP : (nlhr->flags & NLHRF_DUMPPROXY ? MSG_DUMPPROXY : 0)) |
(nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0);
- DWORD dflags = (nlhr->flags & (NLHRF_NODUMP | NLHRF_NODUMPSEND) ?
+ DWORD dflags = (nlhr->flags & (NLHRF_NODUMP | NLHRF_NODUMPSEND) ?
MSG_NODUMP : MSG_DUMPASTEXT | MSG_DUMPPROXY) |
(nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0) | MSG_NODUMP;
@@ -651,7 +652,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam)
phost = strstr(pszFullUrl, "://");
phost = phost ? phost + 3 : pszFullUrl;
ppath = strchr(phost, '/');
- rlen = ppath ? ppath - pszFullUrl : strlen(pszFullUrl);
+ rlen = ppath ? ppath - pszFullUrl : strlen(pszFullUrl);
}
nlc->szNewUrl = (char*)mir_realloc(nlc->szNewUrl, rlen + strlen(tmpUrl) * 3 + 1);
@@ -694,7 +695,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam)
char *szAuthStr = NULL;
if ( !complete)
{
- szAuthStr = NetlibHttpFindAuthHeader(nlhrReply, "WWW-Authenticate",
+ szAuthStr = NetlibHttpFindAuthHeader(nlhrReply, "WWW-Authenticate",
httpSecurity.m_szProvider);
if (szAuthStr)
{
@@ -704,7 +705,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam)
}
if (complete && httpSecurity.m_hNtlmSecurity)
{
- szAuthStr = httpSecurity.TryBasic() ?
+ szAuthStr = httpSecurity.TryBasic() ?
NetlibHttpFindAuthHeader(nlhrReply, "WWW-Authenticate", "Basic") : NULL;
}
@@ -737,7 +738,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam)
char *szAuthStr = NULL;
if ( !complete)
{
- szAuthStr = NetlibHttpFindAuthHeader(nlhrReply, "Proxy-Authenticate",
+ szAuthStr = NetlibHttpFindAuthHeader(nlhrReply, "Proxy-Authenticate",
httpSecurity.m_szProvider);
if (szAuthStr)
{
@@ -747,7 +748,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam)
}
if (complete && httpSecurity.m_hNtlmSecurity)
{
- szAuthStr = httpSecurity.TryBasic() ?
+ szAuthStr = httpSecurity.TryBasic() ?
NetlibHttpFindAuthHeader(nlhrReply, "Proxy-Authenticate", "Basic") : NULL;
}
@@ -849,7 +850,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam)
nlhr->nlc = nlc; // Needed to id connection in the protocol HTTP gateway wrapper functions
nlhr->requestType = REQUEST_RESPONSE;
- if ( !HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, lParam | MSG_PEEK,
+ if ( !HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, lParam | MSG_PEEK,
&nlhr->resultCode, &nlhr->szResultDescr, &firstLineLength))
{
NetlibLeaveNestedCS(&nlc->ncsRecv);
@@ -884,7 +885,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam)
buffer = (char*)mir_alloc(bufferSize + 1);
}
- bytesPeeked = RecvWithTimeoutTime(nlc, dwRequestTimeoutTime, buffer, bufferSize,
+ bytesPeeked = RecvWithTimeoutTime(nlc, dwRequestTimeoutTime, buffer, bufferSize,
MSG_PEEK | MSG_NODUMP | lParam);
if (bytesPeeked == 0) break;
@@ -923,7 +924,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam)
nlhr->headersCount = headersCount;
nlhr->headers = (NETLIBHTTPHEADER*)mir_calloc(sizeof(NETLIBHTTPHEADER) * headersCount);
- for (pbuffer = buffer, headersCount = 0;; pbuffer = peol + 1, ++headersCount)
+ for (pbuffer = buffer, headersCount = 0;; pbuffer = peol + 1, ++headersCount)
{
peol = strchr(pbuffer, '\n');
if (peol == NULL || peol == pbuffer || (peol == (pbuffer + 1) && *pbuffer == '\r')) break;
@@ -953,8 +954,8 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam)
NETLIBHTTPREQUEST *nlhr = (NETLIBHTTPREQUEST*)lParam, *nlhrReply;
DWORD dflags, hflags;
- if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_OUTGOING) ||
- nlhr == NULL || nlhr->cbSize < NETLIBHTTPREQUEST_V1_SIZE ||
+ if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_OUTGOING) ||
+ nlhr == NULL || nlhr->cbSize < NETLIBHTTPREQUEST_V1_SIZE ||
nlhr->szUrl == NULL || nlhr->szUrl[0] == 0)
{
SetLastError(ERROR_INVALID_PARAMETER);
@@ -1016,7 +1017,7 @@ 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);
- hflags =
+ hflags =
(nlhr->flags & NLHRF_NODUMP ? MSG_NODUMP : (nlhr->flags & NLHRF_DUMPPROXY ? MSG_DUMPPROXY : 0)) |
(nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0);
@@ -1044,7 +1045,7 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam)
void NetlibHttpSetLastErrorUsingHttpResult(int result)
{
- if (result >= 200 && result < 300)
+ if (result >= 200 && result < 300)
{
SetLastError(ERROR_SUCCESS);
return;
@@ -1150,7 +1151,7 @@ NETLIBHTTPREQUEST* NetlibHttpRecv(NetlibConnection* nlc, DWORD hflags, DWORD dfl
next:
NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)NetlibHttpRecvHeaders((WPARAM)nlc, hflags);
- if (nlhrReply == NULL)
+ if (nlhrReply == NULL)
return NULL;
if (nlhrReply->resultCode == 100)
@@ -1176,7 +1177,7 @@ next:
if ( !lstrcmpiA(nlhrReply->headers[i].szName, "Connection"))
close = !lstrcmpiA(nlhrReply->headers[i].szValue, "close");
- if ( !lstrcmpiA(nlhrReply->headers[i].szName, "Transfer-Encoding") &&
+ if ( !lstrcmpiA(nlhrReply->headers[i].szName, "Transfer-Encoding") &&
!lstrcmpiA(nlhrReply->headers[i].szValue, "chunked"))
{
chunked = true;
@@ -1193,7 +1194,7 @@ next:
if (chunked)
{
chunksz = NetlibHttpRecvChunkHeader(nlc, true, dflags);
- if (chunksz == SOCKET_ERROR)
+ if (chunksz == SOCKET_ERROR)
{
NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
return NULL;
@@ -1207,9 +1208,9 @@ next:
{
for (;;)
{
- recvResult = RecvWithTimeoutTime(nlc, GetTickCount() + HTTPRECVDATATIMEOUT,
- nlhrReply->pData + nlhrReply->dataLength,
- dataBufferAlloced - nlhrReply->dataLength - 1,
+ recvResult = RecvWithTimeoutTime(nlc, GetTickCount() + HTTPRECVDATATIMEOUT,
+ nlhrReply->pData + nlhrReply->dataLength,
+ dataBufferAlloced - nlhrReply->dataLength - 1,
dflags | (cenctype ? MSG_NODUMP : 0));
if (recvResult == 0) break;
@@ -1260,7 +1261,7 @@ next:
nlhrReply->pData[nlhrReply->dataLength] = '\0';
}
-
+
if (chunked)
{
nlhrReply->headers[chunkhdr].szName = (char*)mir_realloc(nlhrReply->headers[chunkhdr].szName, 16);
@@ -1306,12 +1307,12 @@ next:
{
mir_free(nlhrReply->pData);
nlhrReply->pData = NULL;
- nlhrReply->dataLength = 0;
+ nlhrReply->dataLength = 0;
}
}
- if (close &&
- (nlc->proxyType != PROXYTYPE_HTTP || nlc->nloc.flags & NLOCF_SSL) &&
+ if (close &&
+ (nlc->proxyType != PROXYTYPE_HTTP || nlc->nloc.flags & NLOCF_SSL) &&
( !isConnect || nlhrReply->resultCode != 200))
NetlibDoClose(nlc);
diff --git a/src/modules/netlib/netlibhttpproxy.cpp b/src/modules/netlib/netlibhttpproxy.cpp
index 78e3d31491..efdb0a5ab4 100644
--- a/src/modules/netlib/netlibhttpproxy.cpp
+++ b/src/modules/netlib/netlibhttpproxy.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2012 Miranda ICQ/IM project,
+Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -20,16 +20,17 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "..\..\core\commonheaders.h"
#include "netlib.h"
typedef enum
{
- reqHelloGet,
- reqOldGet,
- reqOldPost,
- reqNewPost,
-}
+ reqHelloGet,
+ reqOldGet,
+ reqOldPost,
+ reqNewPost,
+}
RequestType;
static int HttpGatewayReadSetResult(NetlibConnection *nlc, char *buf, int num, int peek)
@@ -143,7 +144,7 @@ static bool NetlibHttpGatewaySend(struct NetlibConnection *nlc, RequestType reqT
// nlhrSend.headers[3].szName = "Accept-Encoding";
// nlhrSend.headers[3].szValue = "deflate, gzip";
- return NetlibHttpSendRequest((WPARAM)nlc, (LPARAM)&nlhrSend) != SOCKET_ERROR;
+ return NetlibHttpSendRequest((WPARAM)nlc, (LPARAM)&nlhrSend) != SOCKET_ERROR;
}
static bool NetlibHttpGatewayStdPost(NetlibConnection *nlc, int& numPackets)
@@ -327,7 +328,7 @@ int NetlibHttpGatewayRecv(struct NetlibConnection *nlc, char *buf, int len, int
if (nlc->nlu->user.pfnHttpGatewayUnwrapRecv && !(flags & MSG_NOHTTPGATEWAYWRAP))
{
- nlhrReply->pData = (char*)nlc->nlu->user.pfnHttpGatewayUnwrapRecv(nlhrReply,
+ nlhrReply->pData = (char*)nlc->nlu->user.pfnHttpGatewayUnwrapRecv(nlhrReply,
(PBYTE)nlhrReply->pData, nlhrReply->dataLength, &nlhrReply->dataLength, mir_realloc);
}
@@ -365,7 +366,7 @@ int NetlibHttpGatewayRecv(struct NetlibConnection *nlc, char *buf, int len, int
nlc->dataBufferLen = rbytes;
NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
-
+
return HttpGatewayReadSetResult(nlc, buf, len, peek);
}
else
@@ -450,9 +451,9 @@ INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam, LPARAM lParam)
NETLIBHTTPPROXYINFO *nlhpi = (NETLIBHTTPPROXYINFO*)lParam;
struct NetlibConnection *nlc = (struct NetlibConnection*)wParam;
- if (GetNetlibHandleType(nlc) != NLH_CONNECTION || nlhpi == NULL ||
- nlhpi->cbSize < (sizeof(NETLIBHTTPPROXYINFO) - sizeof(int)) ||
- nlhpi->szHttpPostUrl == NULL)
+ if (GetNetlibHandleType(nlc) != NLH_CONNECTION || nlhpi == NULL ||
+ nlhpi->cbSize < (sizeof(NETLIBHTTPPROXYINFO) - sizeof(int)) ||
+ nlhpi->szHttpPostUrl == NULL)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp
index 05b4e899dd..085c9e27d5 100644
--- a/src/modules/netlib/netliblog.cpp
+++ b/src/modules/netlib/netliblog.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp
index 8d2a5e74fc..4b4a5ea4d8 100644
--- a/src/modules/netlib/netlibopenconn.cpp
+++ b/src/modules/netlib/netlibopenconn.cpp
@@ -2,8 +2,8 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2012 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
+Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
+all portions of this codebase are copyrighted to the people
listed in contributors.txt.
This program is free software; you can redistribute it and/or
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "..\..\core\commonheaders.h"
#include "netlib.h"
@@ -39,7 +40,7 @@ DWORD DnsLookup(struct NetlibUser *nlu, const char *szHost)
if (ip != INADDR_NONE)
return ip;
- __try
+ __try
{
host = gethostbyname(szHost);
if (host)
@@ -96,7 +97,7 @@ bool RecvUntilTimeout(struct NetlibConnection *nlc, char *buf, int len, int flag
DWORD dwTimeNow, dwCompleteTime = GetTickCount() + dwTimeout;
while ((dwTimeNow = GetTickCount()) < dwCompleteTime) {
- if (WaitUntilReadable(nlc->s, dwCompleteTime - dwTimeNow) <= 0) return false;
+ if (WaitUntilReadable(nlc->s, dwCompleteTime - dwTimeNow) <= 0) return false;
nReceived = NLRecv(nlc, buf, len, flags);
if (nReceived <= 0) return false;
@@ -125,9 +126,9 @@ static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NE
if (nUserLen <= 1) pInit[8] = 0;
else memcpy(&pInit[8], nlu->settings.szProxyAuthUser, nUserLen);
- //if cannot resolve host, try resolving through proxy (requires SOCKS4a)
+ //if cannot resolve host, try resolving through proxy (requires SOCKS4a)
DWORD ip = DnsLookup(nlu, nloc->szHost);
- *(PDWORD)&pInit[4] = ip ? ip : 0x01000000;
+ *(PDWORD)&pInit[4] = ip ? ip : 0x01000000;
if ( !ip) {
memcpy(&pInit[len], nloc->szHost, nHostLen);
len += nHostLen;
@@ -252,7 +253,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc, struct Netli
}
if (buf[0] != 5 || buf[1]) {
- const char* err = "Unknown response";
+ const char* err = "Unknown response";
if (buf[0] != 5)
SetLastError(ERROR_BAD_FORMAT);
else {
@@ -290,7 +291,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc, struct Netli
if ( !RecvUntilTimeout(nlc, (char*)buf, nRecvSize, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
- }
+ }
//connected
return 1;
@@ -305,7 +306,7 @@ static bool NetlibInitHttpsConnection(struct NetlibConnection *nlc, struct Netli
nlhrSend.cbSize = sizeof(nlhrSend);
nlhrSend.requestType = REQUEST_CONNECT;
nlhrSend.flags = NLHRF_GENERATEHOST | NLHRF_DUMPPROXY | NLHRF_SMARTAUTHHEADER | NLHRF_HTTP11 | NLHRF_NOPROXY | NLHRF_REDIRECT;
- if (nlc->dnsThroughProxy)
+ if (nlc->dnsThroughProxy)
mir_snprintf(szUrl, SIZEOF(szUrl), "%s:%u", nloc->szHost, nloc->wPort);
else {
DWORD ip = DnsLookup(nlu, nloc->szHost);
@@ -363,8 +364,8 @@ static void FreePartiallyInitedConnection(struct NetlibConnection *nlc)
static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc)
{
int rc = 0, retrycnt = 0;
- u_long notblocking = 1;
- DWORD lasterr = 0;
+ u_long notblocking = 1;
+ DWORD lasterr = 0;
static const TIMEVAL tv = { 1, 0 };
unsigned int dwTimeout = (nloc->cbSize == sizeof(NETLIBOPENCONNECTION) && nloc->flags & NLOCF_V2) ? nloc->timeout : 0;
@@ -425,7 +426,7 @@ retry:
if (nlc->nlu->settings.specifyOutgoingPorts && nlc->nlu->settings.szOutgoingPorts && nlc->nlu->settings.szOutgoingPorts[0]) {
if ( !BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, nlc->s, INVALID_SOCKET, &nlc->nlu->inportnum))
NetlibLogf(nlc->nlu, "Netlib connect: Not enough ports for outgoing connections specified");
- }
+ }
// try a connect
if (connect(nlc->s, (LPSOCKADDR)&sin, sizeof(sin)) == 0) {
@@ -447,7 +448,7 @@ retry:
FD_SET(nlc->s, &r);
FD_SET(nlc->s, &w);
FD_SET(nlc->s, &e);
- if ((rc = select(0, &r, &w, &e, &tv)) == SOCKET_ERROR)
+ if ((rc = select(0, &r, &w, &e, &tv)) == SOCKET_ERROR)
break;
if (rc > 0) {
@@ -471,12 +472,12 @@ retry:
}
}
break;
- }
+ }
else if (Miranda_Terminated()) {
rc = SOCKET_ERROR;
lasterr = ERROR_TIMEOUT;
break;
- }
+ }
else if (nloc->cbSize == sizeof(NETLIBOPENCONNECTION) && nloc->flags & NLOCF_V2 && nloc->waitcallback != NULL && nloc->waitcallback(&dwTimeout) == 0) {
rc = SOCKET_ERROR;
lasterr = ERROR_TIMEOUT;
@@ -504,8 +505,8 @@ retry:
static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc)
{
int rc = SOCKET_ERROR, retrycnt = 0;
- u_long notblocking = 1;
- DWORD lasterr = 0;
+ u_long notblocking = 1;
+ DWORD lasterr = 0;
static const TIMEVAL tv = { 1, 0 };
unsigned int dwTimeout = (nloc->cbSize == sizeof(NETLIBOPENCONNECTION) && nloc->flags & NLOCF_V2) ? nloc->timeout : 0;
@@ -601,7 +602,7 @@ retry:
continue;
}
- while (true) { // timeout loop
+ while (true) { // timeout loop
fd_set r, w, e;
FD_ZERO(&r); FD_ZERO(&w); FD_ZERO(&e);
FD_SET(nlc->s, &r);
@@ -788,7 +789,7 @@ bool NetlibDoConnect(NetlibConnection *nlc)
bool NetlibReconnect(NetlibConnection *nlc)
{
char buf[4];
- bool opened = nlc->s != INVALID_SOCKET;
+ bool opened = nlc->s != INVALID_SOCKET;
if (opened) {
switch (WaitUntilReadable(nlc->s, 0, true)) {
case SOCKET_ERROR:
diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp
index 1a28e62df4..49be304e5b 100644
--- a/src/modules/netlib/netlibopts.cpp
+++ b/src/modules/netlib/netlibopts.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -20,10 +20,11 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "..\..\core\commonheaders.h"
#include "netlib.h"
-struct NetlibTempSettings
+struct NetlibTempSettings
{
DWORD flags;
char *szSettingsModule;
@@ -32,37 +33,37 @@ struct NetlibTempSettings
static LIST <NetlibTempSettings> tempSettings(5);
-static const UINT outgoingConnectionsControls[] =
+static const UINT outgoingConnectionsControls[] =
{
- IDC_STATIC12,
- IDC_USEPROXY,
- IDC_STATIC21, IDC_PROXYTYPE,
- IDC_STATIC22, IDC_PROXYHOST, IDC_STATIC23, IDC_PROXYPORT, IDC_STOFTENPORT,
- IDC_PROXYAUTH,
- IDC_STATIC31, IDC_PROXYUSER, IDC_STATIC32, IDC_PROXYPASS,
- IDC_PROXYDNS,
- IDC_SPECIFYPORTSO,
- IDC_PORTSRANGEO,
- IDC_STATIC54,
+ IDC_STATIC12,
+ IDC_USEPROXY,
+ IDC_STATIC21, IDC_PROXYTYPE,
+ IDC_STATIC22, IDC_PROXYHOST, IDC_STATIC23, IDC_PROXYPORT, IDC_STOFTENPORT,
+ IDC_PROXYAUTH,
+ IDC_STATIC31, IDC_PROXYUSER, IDC_STATIC32, IDC_PROXYPASS,
+ IDC_PROXYDNS,
+ IDC_SPECIFYPORTSO,
+ IDC_PORTSRANGEO,
+ IDC_STATIC54,
IDC_VALIDATESSL};
static const UINT useProxyControls[] = {
- IDC_STATIC21, IDC_PROXYTYPE,
- IDC_STATIC22, IDC_PROXYHOST, IDC_STATIC23, IDC_PROXYPORT, IDC_STOFTENPORT,
- IDC_PROXYAUTH,
- IDC_STATIC31, IDC_PROXYUSER, IDC_STATIC32, IDC_PROXYPASS,
+ IDC_STATIC21, IDC_PROXYTYPE,
+ IDC_STATIC22, IDC_PROXYHOST, IDC_STATIC23, IDC_PROXYPORT, IDC_STOFTENPORT,
+ IDC_PROXYAUTH,
+ IDC_STATIC31, IDC_PROXYUSER, IDC_STATIC32, IDC_PROXYPASS,
IDC_PROXYDNS};
static const UINT specifyOPortsControls[] = {
- IDC_PORTSRANGEO,
+ IDC_PORTSRANGEO,
IDC_STATIC54
};
static const UINT incomingConnectionsControls[] = {
- IDC_STATIC43,
- IDC_SPECIFYPORTS,
- IDC_PORTSRANGE,
- IDC_STATIC52,
+ IDC_STATIC43,
+ IDC_SPECIFYPORTS,
+ IDC_PORTSRANGE,
+ IDC_STATIC52,
IDC_ENABLEUPNP};
static const UINT specifyPortsControls[] = {
- IDC_PORTSRANGE,
+ IDC_PORTSRANGE,
IDC_STATIC52};
static const TCHAR* szProxyTypes[] = {_T("<mixed>"), _T("SOCKS4"), _T("SOCKS5"), _T("HTTP"), _T("HTTPS"), _T("Internet Explorer")};
@@ -345,7 +346,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
EnableMultipleControls(hwndDlg, useProxyControls, SIZEOF(useProxyControls), TRUE);
if (selectedProxyType == 0) {
for (int i=0; i < tempSettings.getCount(); i++) {
- if ( !tempSettings[i]->settings.useProxy ||
+ if ( !tempSettings[i]->settings.useProxy ||
tempSettings[i]->flags & NUF_NOOPTIONS || !(tempSettings[i]->flags & NUF_OUTGOING))
continue;
@@ -478,7 +479,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
for (iUser = 0; iUser < tempSettings.getCount(); iUser++)
- NetlibSaveUserSettingsStruct(tempSettings[iUser]->szSettingsModule,
+ NetlibSaveUserSettingsStruct(tempSettings[iUser]->szSettingsModule,
&tempSettings[iUser]->settings);
return TRUE;
}
diff --git a/src/modules/netlib/netlibpktrecver.cpp b/src/modules/netlib/netlibpktrecver.cpp
index 4e887b1177..45e39344c5 100644
--- a/src/modules/netlib/netlibpktrecver.cpp
+++ b/src/modules/netlib/netlibpktrecver.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "..\..\core\commonheaders.h"
#include "netlib.h"
diff --git a/src/modules/netlib/netlibsecurity.cpp b/src/modules/netlib/netlibsecurity.cpp
index 05ee106aa7..33656dc868 100644
--- a/src/modules/netlib/netlibsecurity.cpp
+++ b/src/modules/netlib/netlibsecurity.cpp
@@ -1,7 +1,8 @@
/*
+
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -10,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -67,7 +68,7 @@ static HANDLE hSecMutex;
static void ReportSecError(SECURITY_STATUS scRet, int line)
{
char szMsgBuf[256];
- FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, scRet, LANG_USER_DEFAULT, szMsgBuf, SIZEOF(szMsgBuf), NULL);
char *p = strchr(szMsgBuf, 13); if (p) *p = 0;
@@ -123,7 +124,7 @@ HANDLE NetlibInitSecurityProvider(const TCHAR* szProvider, const TCHAR* szPrinci
WaitForSingleObject(hSecMutex, INFINITE);
- if (secCnt == 0)
+ if (secCnt == 0)
{
LoadSecurityLibrary();
secCnt += g_hSecurity != NULL;
@@ -193,17 +194,17 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls
NtlmHandleType* hNtlm = (NtlmHandleType*)hSecurity;
unsigned char inDataBuffer[1024];
- SecBuffer inBuffers[2] =
+ SecBuffer inBuffers[2] =
{
- { sizeof(inDataBuffer), SECBUFFER_DATA, inDataBuffer },
- { chlsz, SECBUFFER_STREAM, szChallenge },
+ { sizeof(inDataBuffer), SECBUFFER_DATA, inDataBuffer },
+ { chlsz, SECBUFFER_STREAM, szChallenge },
};
SecBufferDesc inBuffersDesc = { SECBUFFER_VERSION, 2, inBuffers };
unsigned long qop = 0;
SECURITY_STATUS sc = g_pSSPI->DecryptMessage(&hNtlm->hClientContext, &inBuffersDesc, 0, &qop);
- if (sc != SEC_E_OK)
+ if (sc != SEC_E_OK)
{
ReportSecError(sc, __LINE__);
return NULL;
@@ -225,10 +226,10 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls
unsigned char outDataBuffer[4] = { 1, 0, 16, 0 };
- SecBuffer outBuffers[3] =
+ SecBuffer outBuffers[3] =
{
- { sizes.cbSecurityTrailer, SECBUFFER_TOKEN, tokenBuffer },
- { sizeof(outDataBuffer), SECBUFFER_DATA, outDataBuffer },
+ { sizes.cbSecurityTrailer, SECBUFFER_TOKEN, tokenBuffer },
+ { sizeof(outDataBuffer), SECBUFFER_DATA, outDataBuffer },
{ sizes.cbBlockSize, SECBUFFER_PADDING, paddingBuffer }
};
SecBufferDesc outBuffersDesc = { SECBUFFER_VERSION, 3, outBuffers };
@@ -245,7 +246,7 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls
ressz += outBuffersDesc.pBuffers[i].cbBuffer;
unsigned char *response = (unsigned char*)alloca(ressz), *p = response;
- for (i=0; i < outBuffersDesc.cBuffers; i++)
+ for (i=0; i < outBuffersDesc.cBuffers; i++)
{
memcpy(p, outBuffersDesc.pBuffers[i].pvBuffer, outBuffersDesc.pBuffers[i].cbBuffer);
p += outBuffersDesc.pBuffers[i].cbBuffer;
@@ -259,7 +260,7 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls
if ( !NetlibBase64Encode(0, (LPARAM)&nlb64)) return NULL;
return mir_strdup(nlb64.pszEncoded);
-}
+}
char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, const TCHAR* login, const TCHAR* psw, bool http, unsigned& complete)
{
@@ -333,14 +334,14 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
}
}
}
- else
+ else
{
if (SecIsValidHandle(&hNtlm->hClientContext)) g_pSSPI->DeleteSecurityContext(&hNtlm->hClientContext);
if (SecIsValidHandle(&hNtlm->hClientCredential)) g_pSSPI->FreeCredentialsHandle(&hNtlm->hClientCredential);
SEC_WINNT_AUTH_IDENTITY auth;
- if (login != NULL && login[0] != '\0')
+ if (login != NULL && login[0] != '\0')
{
memset(&auth, 0, sizeof(auth));
@@ -357,7 +358,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
domainLen = domainName - login;
domainName = login;
}
- else if ((domainName = _tcschr(login, '@')) != NULL)
+ else if ((domainName = _tcschr(login, '@')) != NULL)
{
loginName = login;
loginLen = domainName - login;
@@ -375,8 +376,8 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
hNtlm->hasDomain = domainLen != 0;
}
- sc = g_pSSPI->AcquireCredentialsHandle(NULL, szProvider,
- SECPKG_CRED_OUTBOUND, NULL, hNtlm->hasDomain ? &auth : NULL, NULL, NULL,
+ sc = g_pSSPI->AcquireCredentialsHandle(NULL, szProvider,
+ SECPKG_CRED_OUTBOUND, NULL, hNtlm->hasDomain ? &auth : NULL, NULL, NULL,
&hNtlm->hClientCredential, &tokenExpiration);
if (sc != SEC_E_OK)
{
@@ -392,10 +393,10 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
outputSecurityToken.cbBuffer = hNtlm->cbMaxToken;
outputSecurityToken.pvBuffer = alloca(outputSecurityToken.cbBuffer);
- sc = g_pSSPI->InitializeSecurityContext(&hNtlm->hClientCredential,
- hasChallenge ? &hNtlm->hClientContext : NULL,
- hNtlm->szPrincipal, isGSSAPI ? ISC_REQ_MUTUAL_AUTH | ISC_REQ_STREAM : 0, 0, SECURITY_NATIVE_DREP,
- hasChallenge ? &inputBufferDescriptor : NULL, 0, &hNtlm->hClientContext,
+ sc = g_pSSPI->InitializeSecurityContext(&hNtlm->hClientCredential,
+ hasChallenge ? &hNtlm->hClientContext : NULL,
+ hNtlm->szPrincipal, isGSSAPI ? ISC_REQ_MUTUAL_AUTH | ISC_REQ_STREAM : 0, 0, SECURITY_NATIVE_DREP,
+ hasChallenge ? &inputBufferDescriptor : NULL, 0, &hNtlm->hClientContext,
&outputBufferDescriptor, &contextAttributes, &tokenExpiration);
complete = (sc != SEC_I_COMPLETE_AND_CONTINUE && sc != SEC_I_CONTINUE_NEEDED);
@@ -486,7 +487,7 @@ static INT_PTR NtlmCreateResponseService(WPARAM wParam, LPARAM lParam)
NETLIBNTLMREQUEST* req = (NETLIBNTLMREQUEST*)lParam;
unsigned complete;
- char* response = NtlmCreateResponseFromChallenge((HANDLE)wParam, req->szChallenge,
+ char* response = NtlmCreateResponseFromChallenge((HANDLE)wParam, req->szChallenge,
StrConvT(req->userName), StrConvT(req->password), false, complete);
return (INT_PTR)response;
@@ -501,14 +502,14 @@ static INT_PTR NtlmCreateResponseService2(WPARAM wParam, LPARAM lParam)
if (req->flags & NNR_UNICODE)
{
- response = NtlmCreateResponseFromChallenge((HANDLE)wParam, req->szChallenge,
+ response = NtlmCreateResponseFromChallenge((HANDLE)wParam, req->szChallenge,
req->szUserName, req->szPassword, false, req->complete);
}
else
{
TCHAR *szLogin = mir_a2t((char*)req->szUserName);
TCHAR *szPassw = mir_a2t((char*)req->szPassword);
- response = NtlmCreateResponseFromChallenge((HANDLE)wParam, req->szChallenge,
+ response = NtlmCreateResponseFromChallenge((HANDLE)wParam, req->szChallenge,
szLogin, szPassw, false, req->complete);
mir_free(szLogin);
mir_free(szPassw);
diff --git a/src/modules/netlib/netlibsock.cpp b/src/modules/netlib/netlibsock.cpp
index 5918263110..03138ef389 100644
--- a/src/modules/netlib/netlibsock.cpp
+++ b/src/modules/netlib/netlibsock.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2012 Miranda ICQ/IM project,
+Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "..\..\core\commonheaders.h"
#include "netlib.h"
@@ -88,7 +89,7 @@ INT_PTR NetlibRecv(WPARAM wParam, LPARAM lParam)
recvResult = recv(nlc->s, nlb->buf, nlb->len, nlb->flags & 0xFFFF);
}
NetlibLeaveNestedCS(&nlc->ncsRecv);
- if (recvResult <= 0)
+ if (recvResult <= 0)
return recvResult;
NetlibDumpData(nlc, (PBYTE)nlb->buf, recvResult, 0, nlb->flags);
@@ -184,7 +185,7 @@ INT_PTR NetlibSelectEx(WPARAM, LPARAM lParam)
This happens for read/write/except */
NetlibConnection *conn = NULL;
int j;
- for (j = 0; j < FD_SETSIZE; j++)
+ for (j = 0; j < FD_SETSIZE; j++)
{
conn = (NetlibConnection*)nls->hReadConns[j];
if (conn == NULL || conn == INVALID_HANDLE_VALUE) break;
@@ -228,7 +229,7 @@ bool NetlibStringToAddress(const char* str, SOCKADDR_INET_M* addr)
addr->Ipv4.sin_addr.s_addr = iaddr;
addr->Ipv4.sin_family = AF_INET;
- return true;
+ return true;
}
}
@@ -250,7 +251,7 @@ char* NetlibAddressToString(SOCKADDR_INET_M* addr)
mir_snprintf(saddr, sizeof(saddr), "%s:%d", szIp, htons(addr->Ipv4.sin_port));
return mir_strdup(saddr);
}
- else
+ else
return mir_strdup(szIp);
}
return NULL;
@@ -284,7 +285,7 @@ inline bool IsAddrGlobal(const IN6_ADDR *a)
static NETLIBIPLIST* GetMyIpv6(unsigned flags)
{
addrinfo *air = NULL, *ai, hints = {0};
- const char *szMyHost = "";
+ const char *szMyHost = "";
hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_PASSIVE;
@@ -296,8 +297,8 @@ static NETLIBIPLIST* GetMyIpv6(unsigned flags)
for (ai = air; ai; ai = ai->ai_next)
{
SOCKADDR_INET_M* iaddr = (SOCKADDR_INET_M*)ai->ai_addr;
- if (ai->ai_family == AF_INET ||
- (ai->ai_family == AF_INET6 &&
+ if (ai->ai_family == AF_INET ||
+ (ai->ai_family == AF_INET6 &&
( !(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr))))
++n;
}
@@ -309,8 +310,8 @@ static NETLIBIPLIST* GetMyIpv6(unsigned flags)
for (ai = air; ai; ai = ai->ai_next)
{
SOCKADDR_INET_M* iaddr = (SOCKADDR_INET_M*)ai->ai_addr;
- if (ai->ai_family == AF_INET ||
- (ai->ai_family == AF_INET6 &&
+ if (ai->ai_family == AF_INET ||
+ (ai->ai_family == AF_INET6 &&
( !(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr))))
{
@@ -336,7 +337,7 @@ static NETLIBIPLIST* GetMyIpv4(void)
NETLIBIPLIST *addr = (NETLIBIPLIST*)mir_calloc(n * 64 + 4);
addr->cbNum = n;
- for (unsigned i=0; i < n; i++)
+ for (unsigned i=0; i < n; i++)
strcpy(addr->szIp[i], inet_ntoa(*(PIN_ADDR)he->h_addr_list[i]));
return addr;
diff --git a/src/modules/netlib/netlibssl.cpp b/src/modules/netlib/netlibssl.cpp
index 6327edb459..0a989ff9b7 100644
--- a/src/modules/netlib/netlibssl.cpp
+++ b/src/modules/netlib/netlibssl.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp
index 50f6e421f9..564d7093a7 100644
--- a/src/modules/netlib/netlibupnp.cpp
+++ b/src/modules/netlib/netlibupnp.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2012 Miranda ICQ/IM project,
+Copyright 2000-12 Miranda IM, 2012-13 Miranda NG project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -20,10 +20,11 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "..\..\core\commonheaders.h"
#include "netlib.h"
-static const char search_request_msg[] =
+static const char search_request_msg[] =
"M-SEARCH * HTTP/1.1\r\n"
"HOST: 239.255.255.250:1900\r\n"
"MAN: \"ssdp:discover\"\r\n"
@@ -31,12 +32,12 @@ static const char search_request_msg[] =
"ST: urn:schemas-upnp-org:service:%s\r\n"
"\r\n";
-static const char xml_get_hdr[] =
+static const char xml_get_hdr[] =
"GET %s HTTP/1.1\r\n"
"HOST: %s:%u\r\n"
"ACCEPT-LANGUAGE: *\r\n\r\n";
-static const char soap_post_hdr[] =
+static const char soap_post_hdr[] =
"POST %s HTTP/1.1\r\n"
"HOST: %s:%u\r\n"
"CONTENT-LENGTH: %u\r\n"
@@ -44,7 +45,7 @@ static const char soap_post_hdr[] =
"SOAPACTION: \"%s#%s\"\r\n\r\n"
"%s";
-static const char soap_post_hdr_m[] =
+static const char soap_post_hdr_m[] =
"M-POST %s URL HTTP/1.1\r\n"
"HOST: %s:%u\r\n"
"CONTENT-LENGTH: %u\r\n"
@@ -53,10 +54,10 @@ static const char soap_post_hdr_m[] =
"01-SOAPACTION: \"%s#%s\"\r\n\r\n"
"%s";
-static const char search_device[] =
+static const char search_device[] =
"<serviceType>%s</serviceType>";
-static const char soap_action[] =
+static const char soap_action[] =
"<?xml version = \"1.0\"?>\r\n"
"<s:Envelope\r\n"
" xmlns:s = \"http://schemas.xmlsoap.org/soap/envelope/\"\r\n"
@@ -68,10 +69,10 @@ static const char soap_action[] =
" </s:Body>\r\n"
"</s:Envelope>\r\n";
-static const char soap_query[] =
+static const char soap_query[] =
"<s:Envelope\r\n"
- " xmlns:s = \"http://schemas.xmlsoap.org/soap/envelope/\"\r\n"
- " s:encodingStyle = \"http://schemas.xmlsoap.org/soap/encoding/\">\r\n"
+ " xmlns:s = \"http://schemas.xmlsoap.org/soap/envelope/\"\r\n"
+ " s:encodingStyle = \"http://schemas.xmlsoap.org/soap/encoding/\">\r\n"
" <s:Body>\r\n"
" <u:QueryStateVariable xmlns:u = \"urn:schemas-upnp-org:control-1-0\">\r\n"
" <u:varName>%s</u:varName>\r\n"
@@ -79,7 +80,7 @@ static const char soap_query[] =
" </s:Body>\r\n"
"</s:Envelope>\r\n";
-static const char add_port_mapping[] =
+static const char add_port_mapping[] =
" <NewRemoteHost></NewRemoteHost>\r\n"
" <NewExternalPort>%i</NewExternalPort>\r\n"
" <NewProtocol>%s</NewProtocol>\r\n"
@@ -89,12 +90,12 @@ static const char add_port_mapping[] =
" <NewPortMappingDescription>Miranda</NewPortMappingDescription>\r\n"
" <NewLeaseDuration>0</NewLeaseDuration>\r\n";
-static const char delete_port_mapping[] =
+static const char delete_port_mapping[] =
" <NewRemoteHost></NewRemoteHost>\r\n"
" <NewExternalPort>%i</NewExternalPort>\r\n"
" <NewProtocol>%s</NewProtocol>\r\n";
-static const char get_port_mapping[] =
+static const char get_port_mapping[] =
" <NewPortMappingIndex>%i</NewPortMappingIndex>\r\n";
static bool gatewayFound;
@@ -115,12 +116,12 @@ static char szCtlUrl[256], szDev[256];
typedef enum
{
- DeviceGetReq,
- ControlAction,
+ DeviceGetReq,
+ ControlAction,
ControlQuery
} ReqType;
-static bool txtParseParam(char* szData, char* presearch,
+static bool txtParseParam(char* szData, char* presearch,
char* start, char* finish, char* param, size_t size)
{
char *cp, *cp1;
@@ -271,11 +272,11 @@ static int httpTransact(char* szUrl, char* szResult, int resSize, char* szAction
char szData1[1024];
szReq = mir_strdup(szResult);
- sz = mir_snprintf (szData1, sizeof(szData1),
+ sz = mir_snprintf (szData1, sizeof(szData1),
soap_action, szActionName, szDev, szReq, szActionName);
- sz = mir_snprintf (szData, 4096,
- szPostHdr, szPath, szHost, sPort,
+ sz = mir_snprintf (szData, 4096,
+ szPostHdr, szPath, szHost, sPort,
sz, szDev, szActionName, szData1);
}
break;
@@ -284,11 +285,11 @@ static int httpTransact(char* szUrl, char* szResult, int resSize, char* szAction
{
char szData1[1024];
- sz = mir_snprintf (szData1, sizeof(szData1),
+ sz = mir_snprintf (szData1, sizeof(szData1),
soap_query, szActionName);
- sz = mir_snprintf (szData, 4096,
- szPostHdr, szPath, szHost, sPort,
+ sz = mir_snprintf (szData, 4096,
+ szPostHdr, szPath, szHost, sPort,
sz, "urn:schemas-upnp-org:control-1-0", "QueryStateVariable", szData1);
}
break;
@@ -438,7 +439,7 @@ retrycon:
if (hdrend != NULL)
{
// Get packet size if provided
- if (txtParseParam(szResult, NULL, "Content-Length:", "\n", szRes, sizeof(szRes)) ||
+ if (txtParseParam(szResult, NULL, "Content-Length:", "\n", szRes, sizeof(szRes)) ||
txtParseParam(szResult, NULL, "CONTENT-LENGTH:", "\n", szRes, sizeof(szRes)))
{
// Add size of HTTP header to the packet size to compute full transmission size
@@ -659,7 +660,7 @@ static void discoverUPnP(void)
buf[buflen] = 0;
LongLog(buf);
- if (txtParseParam(buf, NULL, "LOCATION:", "\n", szUrl, sizeof(szUrl)) ||
+ if (txtParseParam(buf, NULL, "LOCATION:", "\n", szUrl, sizeof(szUrl)) ||
txtParseParam(buf, NULL, "Location:", "\n", szUrl, sizeof(szUrl)))
{
char age[30];
@@ -739,7 +740,7 @@ bool NetlibUPnPAddPortMapping(WORD intport, char *proto, WORD *extport, DWORD *e
do
{
++*extport;
- mir_snprintf(szData, 4096, add_port_mapping,
+ mir_snprintf(szData, 4096, add_port_mapping,
*extport, proto, intport, inet_ntoa(locIP.sin_addr));
res = httpTransact(szCtlUrl, szData, 4096, "AddPortMapping", ControlAction);
txtParseParam(szData, NULL, "<errorCode>", "</errorCode>", szExtIP, sizeof(szExtIP));
@@ -752,7 +753,7 @@ bool NetlibUPnPAddPortMapping(WORD intport, char *proto, WORD *extport, DWORD *e
if (res == 200)
{
unsigned ip = getExtIP();
- if (ip) *extip = ip;
+ if (ip) *extip = ip;
if (numports >= numportsAlloc)
mir_realloc(portList, sizeof(WORD)*(numportsAlloc += 10));
@@ -845,7 +846,7 @@ void NetlibUPnPCleanup(void*)
{
WORD mport = (WORD)atol(buf);
- if (j >= SIZEOF(ports))
+ if (j >= SIZEOF(ports))
break;
for (k = 0; k<numports; ++k)