Skip to content

Commit

Permalink
Applying PR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jmartinezramirez committed Apr 3, 2024
1 parent 3449eb5 commit 613710e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
18 changes: 6 additions & 12 deletions Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,8 @@ public void TestInvalidProxySettingFromConnectionString()
[Test]
[TestCase("*")]
[TestCase("*{0}*")]
[TestCase("^*{0}*")]
[TestCase("*{0}*$")]
[TestCase("^*{0}*$")]
[TestCase("^nonmatch*{0}$|*")]
[TestCase("*a*", "a")]
Expand Down Expand Up @@ -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<SnowflakeDbException>(() => conn.Open());
s_logger.Debug("Failed opening connection ", exception);
Assert.AreEqual(270001, exception.ErrorCode);
AssertIsConnectionFailure(exception);
}
}

Expand Down
10 changes: 5 additions & 5 deletions Snowflake.Data/Core/HttpUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 613710e

Please sign in to comment.