Skip to content

Commit

Permalink
ddtrace/tracer: replace Windows path characters in fake UDS host (#1713)
Browse files Browse the repository at this point in the history
We still need to give a full URL to the HTTP client, with the "http"
scheme, but we want the URL to somewhat resemble the UDS path. Windows
paths contain colons and back-slashes. Colons in particular cause
trouble because they're usually followed by a port. Replace those
characters with something else.
  • Loading branch information
nsrip-dd authored Feb 2, 2023
1 parent 6f0dc43 commit 863b9b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ddtrace/tracer/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func newConfig(opts ...StartOption) *config {
c.httpClient = udsClient(c.agentURL.Path)
c.agentURL = &url.URL{
Scheme: "http",
Host: fmt.Sprintf("UDS_%s", strings.ReplaceAll(c.agentURL.Path, "/", "_")),
Host: fmt.Sprintf("UDS_%s", strings.NewReplacer(":", "_", "/", "_", `\`, "_").Replace(c.agentURL.Path)),
}
} else if c.httpClient == nil {
c.httpClient = defaultClient
Expand Down

0 comments on commit 863b9b2

Please sign in to comment.