From 9f126095a6f70fdd850228f9ca9632ba0acbc357 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 7 Nov 2012 22:01:47 +0000 Subject: merge of rev. 14316 git-svn-id: http://svn.miranda-ng.org/main/trunk@2240 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/netlib/netlibopenconn.cpp | 36 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'src/modules/netlib') diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp index 1f23c7e197..ae4526f70f 100644 --- a/src/modules/netlib/netlibopenconn.cpp +++ b/src/modules/netlib/netlibopenconn.cpp @@ -708,34 +708,22 @@ bool NetlibDoConnect(NetlibConnection *nlc) } } -retry: - if (usingProxy) { - if ( !my_connect(nlc, nloc)) { - usingProxy = false; - nlc->proxyType = 0; - } - } - - if ( !usingProxy) - my_connect(nlc, nloc); - - if (nlc->s == INVALID_SOCKET) { + while (!my_connect(nlc, nloc)) { + // Fallback to direct only when using HTTP proxy, as this is what used by companies + // If other type of proxy used it's an indication of security nutcase, leave him alone if (usingProxy && (nlc->proxyType == PROXYTYPE_HTTPS || nlc->proxyType == PROXYTYPE_HTTP)) { usingProxy = false; - if ( !NetlibHttpFallbackToDirect(nlc, nlu, nloc)) { - NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "connect", WSAGetLastError()); - return false; - } + nlc->proxyType = 0; + NetlibLogf(nlu,"Fallback to direct connection"); + continue; } - else { - if (nlu->settings.useProxy && !usingProxy && nlu->settings.proxyType == PROXYTYPE_IE && !forceHttps) { - forceHttps = true; - usingProxy = NetlibGetIeProxyConn(nlc, true); - if (usingProxy) goto retry; - } - NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "connect", WSAGetLastError()); - return false; + if (nlu->settings.useProxy && !usingProxy && nlu->settings.proxyType == PROXYTYPE_IE && !forceHttps) { + forceHttps = true; + usingProxy = NetlibGetIeProxyConn(nlc, true); + if (usingProxy) continue; } + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "connect", WSAGetLastError()); + return false; } if (usingProxy && !((nloc->flags & (NLOCF_HTTP | NLOCF_SSL)) == NLOCF_HTTP && (nlc->proxyType == PROXYTYPE_HTTP || nlc->proxyType == PROXYTYPE_HTTPS))) { -- cgit v1.2.3