smithy-lang / smithy-kotlin

Smithy code generator for Kotlin (in development)
Apache License 2.0
64 stars 26 forks source link

https.nonProxyHosts does not handle * wildcard #1092

Closed grassehh closed 1 month ago

grassehh commented 1 month ago

Describe the bug

The * wildcard does not work when using https.nonProxyHosts

Expected behavior

As described in the Java specifications: http.nonProxyHosts:a list of hosts that should be reached directly, bypassing the proxy. This is a list of patterns separated by '|'. *The patterns may start or end with a '' for wildcards**. Any host matching one of these patterns will be reached through a direct connection instead of through a proxy.

So when configuring a host which starts or ends with a wildcard should match. For example: my.host should both match the non proxy hosts `.hostandmy.*`

Current behavior

The host does not match non proxy hosts when using . For example: my.host won't match the non proxy hosts `.hostandmy.*`

Steps to Reproduce

Simply configure a client using environment while having defined *.host in http.nonProxyHosts system property. For example:

S3Client.fromEnvironment {}

Then if you make a request to the host my-host defined in the system property, the http client will still try to go through the proxy because it has not matched the non proxy host.

Possible Solution

Fix this method so that it handle hostMatch that starts or ends with * wildcard

Context

No response

Smithy-Kotlin version

1.2.2

Platform (JVM/JS/Native)

Java 21

Operating system and version

Debian 12

ianbotsf commented 1 month ago

Thanks for the bug report, @grassehh! We've merged a fix to main and we'll work on getting it out in tomorrow's SDK release.