From 200f93ef521efb798576f3cccdbb05bcf1a73bbe Mon Sep 17 00:00:00 2001 From: Juan Martinez Ramirez Date: Tue, 26 Mar 2024 17:18:52 -0600 Subject: [PATCH 01/10] Added start and end symbol to match string with full regex to bypass the proxy server. --- .../IntegrationTests/SFConnectionIT.cs | 52 ++++++++++++++++++- Snowflake.Data/Core/HttpUtil.cs | 6 +++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs index 8d69fe606..897a12f07 100644 --- a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs @@ -1540,6 +1540,56 @@ public void TestInvalidProxySettingFromConnectionString() } } + [Test] + [TestCase("*")] + [TestCase("*{0}")] + [TestCase("^*{0}$")] + [TestCase("^nonmatch*{0}$|*")] + [TestCase("*a*", "a")] + [TestCase("*la*", "la")] + public void TestNonProxyHostShouldBypassProxyServer(string regexHost, string proxyHost = null) + { + using (var conn = new SnowflakeDbConnection()) + { + var nonProxyHosts = string.Format(regexHost, $"{testConfig.host}"); + var proxyHostForConnection = proxyHost ?? "proxyserverhost"; + conn.ConnectionString = + $"{ConnectionString}USEPROXY=true;PROXYHOST={proxyHostForConnection};NONPROXYHOSTS={nonProxyHosts};PROXYPORT=3128;"; + conn.Open(); + Assert.AreEqual(ConnectionState.Open, conn.State); + } + } + + [Test] + [TestCase("invalid{0}")] + [TestCase("*invalid{0}*")] + [TestCase("^invalid{0}$")] + [TestCase("*a.b")] + [TestCase("a", "a")] + [TestCase("la", "la")] + public void TestNonProxyHostShouldNotBypassProxyServer(string regexHost, string proxyHost = null) + { + using (var conn = new SnowflakeDbConnection()) + { + var nonProxyHosts = string.Format(regexHost, $"{testConfig.host}"); + var proxyHostForConnection = proxyHost ?? "proxyserverhost"; + conn.ConnectionString = + $"{ConnectionString}connection_timeout=5;USEPROXY=true;PROXYHOST={proxyHostForConnection};NONPROXYHOSTS={nonProxyHosts};PROXYPORT=3128;"; + try + { + conn.Open(); + //Assert.Fail(); + } + catch (SnowflakeDbException e) + { + // Expected + s_logger.Debug("Failed opening connection ", e); + Assert.AreEqual(270001, e.ErrorCode); //Internal error + AssertIsConnectionFailure(e); + } + } + } + [Test] public void TestUseProxyFalseWithInvalidProxyConnectionString() { @@ -1561,7 +1611,7 @@ public void TestInvalidProxySettingWithByPassListFromConnectionString() = ConnectionString + String.Format( ";useProxy=true;proxyHost=Invalid;proxyPort=8080;nonProxyHosts={0}", - "*.foo.com %7C" + testConfig.account + ".snowflakecomputing.com|" + testConfig.host); + $"*.foo.com %7C{testConfig.account}.snowflakecomputing.com|*{testConfig.host}"); conn.Open(); // Because testConfig.host is in the bypass list, the proxy should not be used } diff --git a/Snowflake.Data/Core/HttpUtil.cs b/Snowflake.Data/Core/HttpUtil.cs index 9c5e22442..a234c3e3d 100755 --- a/Snowflake.Data/Core/HttpUtil.cs +++ b/Snowflake.Data/Core/HttpUtil.cs @@ -18,6 +18,8 @@ namespace Snowflake.Data.Core { + using System.Text.RegularExpressions; + public class HttpClientConfig { public HttpClientConfig( @@ -187,6 +189,10 @@ internal HttpMessageHandler SetupCustomHttpHandler(HttpClientConfig config) // * -> .* because * is a quantifier and need a char or group to apply to entry = entry.Replace("*", ".*"); + if (!entry.StartsWith("^") || !entry.EndsWith("$")) + { + entry = $"^{entry}$"; + } // Replace with the valid entry syntax bypassList[i] = entry; From 5bfb46fe89b4a592a00027b9d0873dc13c59c084 Mon Sep 17 00:00:00 2001 From: Juan Martinez Ramirez Date: Wed, 27 Mar 2024 09:43:53 -0600 Subject: [PATCH 02/10] Add examples of expected behavior for NONPROXYHOSTS property. --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cc7aba2ef..9d08a35cc 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ The following table lists all valid connection properties: | PROXYPORT | Depends | The port number of the proxy server.

If USEPROXY is set to `true`, you must set this parameter.

This parameter was introduced in v2.0.4. | | PROXYUSER | No | The username for authenticating to the proxy server.

This parameter was introduced in v2.0.4. | | PROXYPASSWORD | Depends | The password for authenticating to the proxy server.

If USEPROXY is `true` and PROXYUSER is set, you must set this parameter.

This parameter was introduced in v2.0.4. | -| NONPROXYHOSTS | No | The list of hosts that the driver should connect to directly, bypassing the proxy server. Separate the hostnames with a pipe symbol (\|). You can also use an asterisk (`*`) as a wildcard.

This parameter was introduced in v2.0.4. | +| NONPROXYHOSTS | No | The list of hosts that the driver should connect to directly, bypassing the proxy server. Separate the hostnames with a pipe symbol (\|). You can also use an asterisk (`*`) as a wildcard.
The hosts values should match with the full hostname used to be bypassed of the proxy server.

This parameter was introduced in v2.0.4. | | FILE_TRANSFER_MEMORY_THRESHOLD | No | The maximum number of bytes to store in memory used in order to provide a file encryption. If encrypting/decrypting file size exceeds provided value a temporary file will be created and the work will be continued in the temporary file instead of memory.
If no value provided 1MB will be used as a default value (that is 1048576 bytes).
It is possible to configure any integer value bigger than zero representing maximal number of bytes to reside in memory. | | CLIENT_CONFIG_FILE | No | The location of the client configuration json file. In this file you can configure easy logging feature. | | ALLOWUNDERSCORESINHOST | No | Specifies whether to allow underscores in account names. This impacts PrivateLink customers whose account names contain underscores. In this situation, you must override the default value by setting allowUnderscoresInHost to true. | @@ -377,6 +377,22 @@ using (IDbConnection conn = new SnowflakeDbConnection()) } ``` +The NONPROXYHOSTS property could be set to specify if the server proxy should be bypassed by an specified host. This should be defined using the full host url or including the url + `*` wilcard symbol. + +Examples: + +- `*` (Bypassed all hosts from the proxy server) +- `*.snowflakecomputing.com` ('Bypass all host that ends with `snowflakecomputing.com`') +- `https:\\testaccount.snowflakecomputing.com` (Bypass proxy server using full host url). +- `*.myserver.com | *testaccount*` (You can specify multiple regex for the property divided by `|`) + + +> Note: If you only specify the hostname in the property if will not be bypass because should match the full url including the http or https section. + +- `myaccount.snowflakecomputing.com` (This will not be bypassed). + + + ## Using Connection Pools Instead of creating a connection each time your client application needs to access Snowflake, you can define a cache of Snowflake connections that can be reused as needed. Connection pooling usually reduces the lag time to make a connection. However, it can slow down client failover to an alternative DNS when a DNS problem occurs. From 4396742db6055bf1183b872b94d2ddd6195a1693 Mon Sep 17 00:00:00 2001 From: Juan Martinez Ramirez Date: Wed, 27 Mar 2024 11:57:47 -0600 Subject: [PATCH 03/10] Fix to execute test without specified host property in parameters.json --- .../IntegrationTests/SFConnectionIT.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs index 897a12f07..841adbe7a 100644 --- a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs @@ -20,6 +20,7 @@ namespace Snowflake.Data.Tests.IntegrationTests using Snowflake.Data.Tests.Mock; using System.Runtime.InteropServices; using System.Net.Http; + using System.Text.RegularExpressions; [TestFixture] class SFConnectionIT : SFBaseTest @@ -1551,7 +1552,8 @@ public void TestNonProxyHostShouldBypassProxyServer(string regexHost, string pro { using (var conn = new SnowflakeDbConnection()) { - var nonProxyHosts = string.Format(regexHost, $"{testConfig.host}"); + var host = ResolveHostToUseFromTestConfig(ConnectionString); + var nonProxyHosts = string.Format(regexHost, $"{host}"); var proxyHostForConnection = proxyHost ?? "proxyserverhost"; conn.ConnectionString = $"{ConnectionString}USEPROXY=true;PROXYHOST={proxyHostForConnection};NONPROXYHOSTS={nonProxyHosts};PROXYPORT=3128;"; @@ -1840,6 +1842,11 @@ public void TestKeepAlive() Assert.Fail(); } } + + private string ResolveHostToUseFromTestConfig(string connectionString) + { + return testConfig.host ?? $"{testConfig.account}.snowflakecomputing.com"; + } } [TestFixture] @@ -2219,6 +2226,7 @@ public void TestNativeOktaSuccess() Assert.AreEqual(ConnectionState.Open, conn.State); } } + } } From 0392448009a02996178342807fbf6bb7b483c83e Mon Sep 17 00:00:00 2001 From: Juan Martinez Ramirez Date: Wed, 27 Mar 2024 12:16:33 -0600 Subject: [PATCH 04/10] Removed unused using --- Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs index 841adbe7a..cc8355348 100644 --- a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs @@ -20,7 +20,6 @@ namespace Snowflake.Data.Tests.IntegrationTests using Snowflake.Data.Tests.Mock; using System.Runtime.InteropServices; using System.Net.Http; - using System.Text.RegularExpressions; [TestFixture] class SFConnectionIT : SFBaseTest From 870e1c2cb91882b9ba401abac5d3ad24b4db8723 Mon Sep 17 00:00:00 2001 From: Juan Martinez Ramirez Date: Wed, 27 Mar 2024 15:23:45 -0600 Subject: [PATCH 05/10] Fix documentation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d08a35cc..42b49e751 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ The following table lists all valid connection properties: | PROXYPORT | Depends | The port number of the proxy server.

If USEPROXY is set to `true`, you must set this parameter.

This parameter was introduced in v2.0.4. | | PROXYUSER | No | The username for authenticating to the proxy server.

This parameter was introduced in v2.0.4. | | PROXYPASSWORD | Depends | The password for authenticating to the proxy server.

If USEPROXY is `true` and PROXYUSER is set, you must set this parameter.

This parameter was introduced in v2.0.4. | -| NONPROXYHOSTS | No | The list of hosts that the driver should connect to directly, bypassing the proxy server. Separate the hostnames with a pipe symbol (\|). You can also use an asterisk (`*`) as a wildcard.
The hosts values should match with the full hostname used to be bypassed of the proxy server.

This parameter was introduced in v2.0.4. | +| NONPROXYHOSTS | No | The list of hosts that the driver should connect to directly, bypassing the proxy server. Separate the hostnames with a pipe symbol (\|). You can also use an asterisk (`*`) as a wildcard.
The host target value should fully match with the non proxy host list to be bypass of the proxy server.

This parameter was introduced in v2.0.4. | | FILE_TRANSFER_MEMORY_THRESHOLD | No | The maximum number of bytes to store in memory used in order to provide a file encryption. If encrypting/decrypting file size exceeds provided value a temporary file will be created and the work will be continued in the temporary file instead of memory.
If no value provided 1MB will be used as a default value (that is 1048576 bytes).
It is possible to configure any integer value bigger than zero representing maximal number of bytes to reside in memory. | | CLIENT_CONFIG_FILE | No | The location of the client configuration json file. In this file you can configure easy logging feature. | | ALLOWUNDERSCORESINHOST | No | Specifies whether to allow underscores in account names. This impacts PrivateLink customers whose account names contain underscores. In this situation, you must override the default value by setting allowUnderscoresInHost to true. | From 3ced1608b2a446c1fb14168529c4eb4a793a0fdc Mon Sep 17 00:00:00 2001 From: Juan Martinez Ramirez Date: Wed, 27 Mar 2024 16:33:49 -0600 Subject: [PATCH 06/10] Fixed test to be able to run with local parameters. A port should be added to the regex to bypass the server if is different than default 80. --- Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs index cc8355348..da4628588 100644 --- a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs @@ -1542,8 +1542,8 @@ public void TestInvalidProxySettingFromConnectionString() [Test] [TestCase("*")] - [TestCase("*{0}")] - [TestCase("^*{0}$")] + [TestCase("*{0}*")] + [TestCase("^*{0}*$")] [TestCase("^nonmatch*{0}$|*")] [TestCase("*a*", "a")] [TestCase("*la*", "la")] @@ -1612,7 +1612,7 @@ public void TestInvalidProxySettingWithByPassListFromConnectionString() = ConnectionString + String.Format( ";useProxy=true;proxyHost=Invalid;proxyPort=8080;nonProxyHosts={0}", - $"*.foo.com %7C{testConfig.account}.snowflakecomputing.com|*{testConfig.host}"); + $"*.foo.com %7C{testConfig.account}.snowflakecomputing.com|*{testConfig.host}*"); conn.Open(); // Because testConfig.host is in the bypass list, the proxy should not be used } From d320e1bdcfaeeda20be9bc25a0fb1c2073e4bfa1 Mon Sep 17 00:00:00 2001 From: Juan Martinez Ramirez Date: Tue, 2 Apr 2024 10:56:17 -0600 Subject: [PATCH 07/10] Applying PR suggestions --- .../IntegrationTests/SFConnectionIT.cs | 18 ++++++------------ Snowflake.Data/Core/HttpUtil.cs | 10 +++++----- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs index da4628588..32aacdf31 100644 --- a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs @@ -1543,6 +1543,8 @@ public void TestInvalidProxySettingFromConnectionString() [Test] [TestCase("*")] [TestCase("*{0}*")] + [TestCase("^*{0}*")] + [TestCase("*{0}*$")] [TestCase("^*{0}*$")] [TestCase("^nonmatch*{0}$|*")] [TestCase("*a*", "a")] @@ -1576,18 +1578,10 @@ public void TestNonProxyHostShouldNotBypassProxyServer(string regexHost, string var proxyHostForConnection = proxyHost ?? "proxyserverhost"; conn.ConnectionString = $"{ConnectionString}connection_timeout=5;USEPROXY=true;PROXYHOST={proxyHostForConnection};NONPROXYHOSTS={nonProxyHosts};PROXYPORT=3128;"; - try - { - conn.Open(); - //Assert.Fail(); - } - catch (SnowflakeDbException e) - { - // Expected - s_logger.Debug("Failed opening connection ", e); - Assert.AreEqual(270001, e.ErrorCode); //Internal error - AssertIsConnectionFailure(e); - } + var exception = Assert.Throws(() => conn.Open()); + s_logger.Debug("Failed opening connection ", exception); + Assert.AreEqual(270001, exception.ErrorCode); + AssertIsConnectionFailure(exception); } } diff --git a/Snowflake.Data/Core/HttpUtil.cs b/Snowflake.Data/Core/HttpUtil.cs index a234c3e3d..6ed9395ae 100755 --- a/Snowflake.Data/Core/HttpUtil.cs +++ b/Snowflake.Data/Core/HttpUtil.cs @@ -188,11 +188,11 @@ internal HttpMessageHandler SetupCustomHttpHandler(HttpClientConfig config) entry = entry.Replace(".", "[.]"); // * -> .* because * is a quantifier and need a char or group to apply to entry = entry.Replace("*", ".*"); - - if (!entry.StartsWith("^") || !entry.EndsWith("$")) - { - entry = $"^{entry}$"; - } + + entry = entry.StartsWith("^") ? entry : $"^{entry}"; + + entry = entry.EndsWith("$") ? entry : $"{entry}$"; + // Replace with the valid entry syntax bypassList[i] = entry; From 13f0f29734f709019e5d0b99ee85e0704bb8743a Mon Sep 17 00:00:00 2001 From: Juan Martinez Ramirez Date: Wed, 3 Apr 2024 12:45:18 -0600 Subject: [PATCH 08/10] Applying PR suggestions --- README.md | 6 ++-- .../IntegrationTests/SFConnectionIT.cs | 28 +++++++++++-------- Snowflake.Data.Tests/SFBaseTest.cs | 5 ++++ Snowflake.Data/Core/HttpUtil.cs | 3 -- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 42b49e751..0fc3e3325 100644 --- a/README.md +++ b/README.md @@ -387,10 +387,10 @@ Examples: - `*.myserver.com | *testaccount*` (You can specify multiple regex for the property divided by `|`) -> Note: If you only specify the hostname in the property if will not be bypass because should match the full url including the http or https section. - -- `myaccount.snowflakecomputing.com` (This will not be bypassed). +> Note: The nonproxyhost value should match the full url including the http or https section. The '*' wilcard could be added to bypass the hostname successfully. +- `myaccount.snowflakecomputing.com` (Not bypassed). +- `*myaccount.snowflakecomputing.com` (Bypassed). ## Using Connection Pools diff --git a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs index 32aacdf31..ebdd8cc9b 100644 --- a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs @@ -1549,16 +1549,21 @@ public void TestInvalidProxySettingFromConnectionString() [TestCase("^nonmatch*{0}$|*")] [TestCase("*a*", "a")] [TestCase("*la*", "la")] - public void TestNonProxyHostShouldBypassProxyServer(string regexHost, string proxyHost = null) + public void TestNonProxyHostShouldBypassProxyServer(string regexHost, string proxyHost = "proxyserverhost") { using (var conn = new SnowflakeDbConnection()) { + // Arrange var host = ResolveHostToUseFromTestConfig(ConnectionString); var nonProxyHosts = string.Format(regexHost, $"{host}"); - var proxyHostForConnection = proxyHost ?? "proxyserverhost"; conn.ConnectionString = - $"{ConnectionString}USEPROXY=true;PROXYHOST={proxyHostForConnection};NONPROXYHOSTS={nonProxyHosts};PROXYPORT=3128;"; + $"{ConnectionString}USEPROXY=true;PROXYHOST={proxyHost};NONPROXYHOSTS={nonProxyHosts};PROXYPORT=3128;"; + + // Act conn.Open(); + + // Assert + // If the connection is open, it indicates that the server proxy was bypassed. Assert.AreEqual(ConnectionState.Open, conn.State); } } @@ -1570,15 +1575,21 @@ public void TestNonProxyHostShouldBypassProxyServer(string regexHost, string pro [TestCase("*a.b")] [TestCase("a", "a")] [TestCase("la", "la")] - public void TestNonProxyHostShouldNotBypassProxyServer(string regexHost, string proxyHost = null) + public void TestNonProxyHostShouldNotBypassProxyServer(string regexHost, string proxyHost = "proxyserverhost") { using (var conn = new SnowflakeDbConnection()) { + // Arrange var nonProxyHosts = string.Format(regexHost, $"{testConfig.host}"); - var proxyHostForConnection = proxyHost ?? "proxyserverhost"; conn.ConnectionString = - $"{ConnectionString}connection_timeout=5;USEPROXY=true;PROXYHOST={proxyHostForConnection};NONPROXYHOSTS={nonProxyHosts};PROXYPORT=3128;"; + $"{ConnectionString}connection_timeout=5;USEPROXY=true;PROXYHOST={proxyHost};NONPROXYHOSTS={nonProxyHosts};PROXYPORT=3128;"; + + // Act/Assert + // If the nonproxyhosts property fails to bypass the server, the proxy will be use but it will return a exception + // because is not configure in the testing environment so the exception is used to verify that was not bypass. var exception = Assert.Throws(() => conn.Open()); + + // Assert s_logger.Debug("Failed opening connection ", exception); Assert.AreEqual(270001, exception.ErrorCode); AssertIsConnectionFailure(exception); @@ -1835,11 +1846,6 @@ public void TestKeepAlive() Assert.Fail(); } } - - private string ResolveHostToUseFromTestConfig(string connectionString) - { - return testConfig.host ?? $"{testConfig.account}.snowflakecomputing.com"; - } } [TestFixture] diff --git a/Snowflake.Data.Tests/SFBaseTest.cs b/Snowflake.Data.Tests/SFBaseTest.cs index 0bb2e1555..ed2cb7789 100755 --- a/Snowflake.Data.Tests/SFBaseTest.cs +++ b/Snowflake.Data.Tests/SFBaseTest.cs @@ -155,6 +155,11 @@ public SFBaseTestAsync() testConfig.password); protected TestConfig testConfig { get; } + + protected string ResolveHostToUseFromTestConfig() + { + return testConfig.host ?? $"{testConfig.account}.snowflakecomputing.com"; + } } [SetUpFixture] diff --git a/Snowflake.Data/Core/HttpUtil.cs b/Snowflake.Data/Core/HttpUtil.cs index 6ed9395ae..531e76fd7 100755 --- a/Snowflake.Data/Core/HttpUtil.cs +++ b/Snowflake.Data/Core/HttpUtil.cs @@ -12,14 +12,11 @@ using System.Collections.Specialized; using System.Web; using System.Security.Authentication; -using System.Runtime.InteropServices; using System.Linq; using Snowflake.Data.Core.Authenticator; namespace Snowflake.Data.Core { - using System.Text.RegularExpressions; - public class HttpClientConfig { public HttpClientConfig( From c31de84bdc7beca9335f2ab198a9f3dafe3e3363 Mon Sep 17 00:00:00 2001 From: Juan Martinez Ramirez Date: Thu, 4 Apr 2024 07:12:28 -0600 Subject: [PATCH 09/10] Apply PR suggestions --- README.md | 2 +- Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs | 8 +++----- Snowflake.Data.Tests/SFBaseTest.cs | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0fc3e3325..7c7e65356 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ The following table lists all valid connection properties: | PROXYPORT | Depends | The port number of the proxy server.

If USEPROXY is set to `true`, you must set this parameter.

This parameter was introduced in v2.0.4. | | PROXYUSER | No | The username for authenticating to the proxy server.

This parameter was introduced in v2.0.4. | | PROXYPASSWORD | Depends | The password for authenticating to the proxy server.

If USEPROXY is `true` and PROXYUSER is set, you must set this parameter.

This parameter was introduced in v2.0.4. | -| NONPROXYHOSTS | No | The list of hosts that the driver should connect to directly, bypassing the proxy server. Separate the hostnames with a pipe symbol (\|). You can also use an asterisk (`*`) as a wildcard.
The host target value should fully match with the non proxy host list to be bypass of the proxy server.

This parameter was introduced in v2.0.4. | +| NONPROXYHOSTS | No | The list of hosts that the driver should connect to directly, bypassing the proxy server. Separate the hostnames with a pipe symbol (\|). You can also use an asterisk (`*`) as a wildcard.
The host target value should fully match with any item from the proxy host list to bypass the proxy server.

This parameter was introduced in v2.0.4. | | FILE_TRANSFER_MEMORY_THRESHOLD | No | The maximum number of bytes to store in memory used in order to provide a file encryption. If encrypting/decrypting file size exceeds provided value a temporary file will be created and the work will be continued in the temporary file instead of memory.
If no value provided 1MB will be used as a default value (that is 1048576 bytes).
It is possible to configure any integer value bigger than zero representing maximal number of bytes to reside in memory. | | CLIENT_CONFIG_FILE | No | The location of the client configuration json file. In this file you can configure easy logging feature. | | ALLOWUNDERSCORESINHOST | No | Specifies whether to allow underscores in account names. This impacts PrivateLink customers whose account names contain underscores. In this situation, you must override the default value by setting allowUnderscoresInHost to true. | diff --git a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs index ebdd8cc9b..ca7325f08 100644 --- a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs @@ -1554,7 +1554,7 @@ public void TestNonProxyHostShouldBypassProxyServer(string regexHost, string pro using (var conn = new SnowflakeDbConnection()) { // Arrange - var host = ResolveHostToUseFromTestConfig(ConnectionString); + var host = this.ResolveHost(); var nonProxyHosts = string.Format(regexHost, $"{host}"); conn.ConnectionString = $"{ConnectionString}USEPROXY=true;PROXYHOST={proxyHost};NONPROXYHOSTS={nonProxyHosts};PROXYPORT=3128;"; @@ -1563,7 +1563,7 @@ public void TestNonProxyHostShouldBypassProxyServer(string regexHost, string pro conn.Open(); // Assert - // If the connection is open, it indicates that the server proxy was bypassed. + // The connection would fail to open if the web proxy would be used because the proxy is configured to a non-existent host. Assert.AreEqual(ConnectionState.Open, conn.State); } } @@ -1585,12 +1585,10 @@ public void TestNonProxyHostShouldNotBypassProxyServer(string regexHost, string $"{ConnectionString}connection_timeout=5;USEPROXY=true;PROXYHOST={proxyHost};NONPROXYHOSTS={nonProxyHosts};PROXYPORT=3128;"; // Act/Assert - // If the nonproxyhosts property fails to bypass the server, the proxy will be use but it will return a exception - // because is not configure in the testing environment so the exception is used to verify that was not bypass. + // The connection would fail to open if the web proxy would be used because the proxy is configured to a non-existent host. var exception = Assert.Throws(() => conn.Open()); // Assert - s_logger.Debug("Failed opening connection ", exception); Assert.AreEqual(270001, exception.ErrorCode); AssertIsConnectionFailure(exception); } diff --git a/Snowflake.Data.Tests/SFBaseTest.cs b/Snowflake.Data.Tests/SFBaseTest.cs index ed2cb7789..6aacb94f9 100755 --- a/Snowflake.Data.Tests/SFBaseTest.cs +++ b/Snowflake.Data.Tests/SFBaseTest.cs @@ -156,7 +156,7 @@ public SFBaseTestAsync() protected TestConfig testConfig { get; } - protected string ResolveHostToUseFromTestConfig() + protected string ResolveHost() { return testConfig.host ?? $"{testConfig.account}.snowflakecomputing.com"; } From 67b376fdfa3be94f40e930107d32ee8f972af425 Mon Sep 17 00:00:00 2001 From: Juan Martinez Ramirez Date: Thu, 4 Apr 2024 07:49:24 -0600 Subject: [PATCH 10/10] Removed this from method call --- Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs index ca7325f08..c248ef575 100644 --- a/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs @@ -1554,7 +1554,7 @@ public void TestNonProxyHostShouldBypassProxyServer(string regexHost, string pro using (var conn = new SnowflakeDbConnection()) { // Arrange - var host = this.ResolveHost(); + var host = ResolveHost(); var nonProxyHosts = string.Format(regexHost, $"{host}"); conn.ConnectionString = $"{ConnectionString}USEPROXY=true;PROXYHOST={proxyHost};NONPROXYHOSTS={nonProxyHosts};PROXYPORT=3128;";