diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2022-04-07 15:18:48 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2022-04-07 15:18:48 +0000 |
commit | 5bdcfd3d930293e86da5bfcc386cdebb37d03b31 (patch) | |
tree | 6fbb5fc21889f5e529a0b3e8a586d287710c8294 /src/VBox/Main/src-client/CloudGateway.cpp | |
parent | d64adf20a40a5c417071ad2ecf6802b91317fd15 (diff) | |
download | VirtualBox-svn-5bdcfd3d930293e86da5bfcc386cdebb37d03b31.tar.gz |
libs/libssh,Main,FE/VBoxManage,Devices/Network/DrvCloudTunnel|ai: Add support for proxies, bugref:9469
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@94521 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/Main/src-client/CloudGateway.cpp')
-rw-r--r-- | src/VBox/Main/src-client/CloudGateway.cpp | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/src/VBox/Main/src-client/CloudGateway.cpp b/src/VBox/Main/src-client/CloudGateway.cpp index 4793cc574aa..9995acdd7d4 100644 --- a/src/VBox/Main/src-client/CloudGateway.cpp +++ b/src/VBox/Main/src-client/CloudGateway.cpp @@ -194,138 +194,6 @@ HRESULT startCloudGateway(ComPtr<IVirtualBox> virtualBox, ComPtr<ICloudNetwork> } -#if 0 /* Disabled until proxy support is implemented */ -static bool getProxyForIpAddr(ComPtr<IVirtualBox> virtualBox, const com::Utf8Str &strIpAddr, Bstr &strProxyType, Bstr &strProxyHost, Bstr &strProxyPort) -{ -#ifndef VBOX_WITH_PROXY_INFO - RT_NOREF(virtualBox, strIpAddr, strProxyType, strProxyHost, strProxyPort); - LogRel(("CLOUD-NET: Proxy support is disabled. Using direct connection.\n")); - return false; -#else /* VBOX_WITH_PROXY_INFO */ - ComPtr<ISystemProperties> systemProperties; - ProxyMode_T enmProxyMode; - HRESULT hrc = virtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam()); - if (FAILED(hrc)) - { - LogRel(("CLOUD-NET: Failed to obtain system properties. hrc=%x\n", hrc)); - return false; - } - hrc = systemProperties->COMGETTER(ProxyMode)(&enmProxyMode); - if (FAILED(hrc)) - { - LogRel(("CLOUD-NET: Failed to obtain default machine folder. hrc=%x\n", hrc)); - return false; - } - if (enmProxyMode == ProxyMode_NoProxy) - return false; - - Bstr proxyUrl; - if (enmProxyMode == ProxyMode_Manual) - { - hrc = systemProperties->COMGETTER(ProxyURL)(proxyUrl.asOutParam()); - if (FAILED(hrc)) - { - LogRel(("CLOUD-NET: Failed to obtain proxy URL. hrc=%x\n", hrc)); - return false; - } - Utf8Str strProxyUrl = proxyUrl; - if (!strProxyUrl.contains("://")) - strProxyUrl = "http://" + strProxyUrl; - const char *pcszProxyUrl = strProxyUrl.c_str(); - RTURIPARSED Parsed; - int rc = RTUriParse(pcszProxyUrl, &Parsed); - if (RT_FAILURE(rc)) - { - LogRel(("CLOUD-NET: Failed to parse proxy URL: %ls (rc=%d)\n", proxyUrl.raw(), rc)); - return false; - } - char *pszHost = RTUriParsedAuthorityHost(pcszProxyUrl, &Parsed); - if (!pszHost) - { - LogRel(("CLOUD-NET: Failed to get proxy host name from proxy URL: %s\n", pcszProxyUrl)); - return false; - } - strProxyHost = pszHost; - RTStrFree(pszHost); - char *pszScheme = RTUriParsedScheme(pcszProxyUrl, &Parsed); - if (!pszScheme) - { - LogRel(("CLOUD-NET: Failed to get proxy scheme from proxy URL: %s\n", pcszProxyUrl)); - return false; - } - strProxyType = Utf8Str(pszScheme).toUpper(); - RTStrFree(pszScheme); - uint32_t uProxyPort = RTUriParsedAuthorityPort(pcszProxyUrl, &Parsed); - if (uProxyPort == UINT32_MAX) - if (!pszScheme) - { - LogRel(("CLOUD-NET: Failed to get proxy port from proxy URL: %s\n", pcszProxyUrl)); - return false; - } - strProxyPort = BstrFmt("%d", uProxyPort); - } - else - { - /* Attempt to use system proxy settings (ProxyMode_System) */ - RTHTTP hHttp; - int rc = RTHttpCreate(&hHttp); - if (RT_FAILURE(rc)) - { - LogRel(("CLOUD-NET: Failed to create HTTP context (rc=%Rrc)\n", rc)); - return false; - } - rc = RTHttpUseSystemProxySettings(hHttp); - if (RT_FAILURE(rc)) - { - LogRel(("CLOUD-NET: Failed to use system proxy (rc=%Rrc)\n", rc)); - RTHttpDestroy(hHttp); - return false; - } - - RTHTTPPROXYINFO proxy; - rc = RTHttpQueryProxyInfoForUrl(hHttp, ("http://" + strIpAddr).c_str(), &proxy); - if (RT_FAILURE(rc)) - { - LogRel(("CLOUD-NET: Failed to get proxy for %s (rc=%Rrc)\n", strIpAddr.c_str(), rc)); - RTHttpDestroy(hHttp); - return false; - } - switch (proxy.enmProxyType) - { - case RTHTTPPROXYTYPE_NOPROXY: - RTHttpFreeProxyInfo(&proxy); - RTHttpDestroy(hHttp); - return false; - case RTHTTPPROXYTYPE_HTTP: - strProxyType = "HTTP"; - break; - case RTHTTPPROXYTYPE_HTTPS: - strProxyType = "HTTPS"; - break; - case RTHTTPPROXYTYPE_SOCKS4: - strProxyType = "SOCKS4"; - break; - case RTHTTPPROXYTYPE_SOCKS5: - strProxyType = "SOCKS5"; - break; - case RTHTTPPROXYTYPE_UNKNOWN: - case RTHTTPPROXYTYPE_INVALID: - case RTHTTPPROXYTYPE_END: - case RTHTTPPROXYTYPE_32BIT_HACK: - break; - } - AssertStmt(strProxyType.isNotEmpty(), LogRel(("CLOUD-NET: Unknown proxy type: %d\n", proxy.enmProxyType))); - strProxyHost = proxy.pszProxyHost; - if (proxy.uProxyPort != UINT32_MAX) - strProxyPort.printf("%d", proxy.uProxyPort); - RTHttpFreeProxyInfo(&proxy); - RTHttpDestroy(hHttp); - } - return true; -#endif /* VBOX_WITH_PROXY_INFO */ -} -#endif - HRESULT stopCloudGateway(ComPtr<IVirtualBox> virtualBox, GatewayInfo& gateway) { if (gateway.mGatewayInstanceId.isEmpty()) |