Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: endpoint port is dropped #1737

Closed
tbpg opened this issue Jan 21, 2020 · 2 comments
Closed

storage: endpoint port is dropped #1737

tbpg opened this issue Jan 21, 2020 · 2 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@tbpg
Copy link
Contributor

tbpg commented Jan 21, 2020

Client

Storage

Code

e.g.

	c, err := NewClient(ctx, option.WithEndpoint("example.com:8888"))

Expected behavior

Port is retained.

Actual behavior

Port is dropped.

Additional context

Behavior was added in 95bbb7d#diff-efc763a7d18657aa44c013131823cfc9R131.

Docs for (*url.URL).Hostname:

Hostname returns u.Host, stripping any valid port number if present.

Reported in #1619 (comment).

cc @tritone @broady

@tbpg tbpg added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Jan 21, 2020
@tritone tritone self-assigned this Jan 25, 2020
@tritone
Copy link
Contributor

tritone commented Jan 25, 2020

My mistake on this one; posted https://code-review.googlesource.com/c/gocloud/+/50891 with a fix.

@vikstrous
Copy link

Thanks for fixing. I couldn't verify the fix because both before and after the fix, there was no combination of options that worked for connecting to fake gcs storage backend. I'm using the following instead:

	addr := "127.0.0.1:4443"
	opt := option.WithHTTPClient(&http.Client{
		Transport: &http.Transport{
			DialTLS: func(string, string) (net.Conn, error) {
				return tls.Dial("tcp", addr, &tls.Config{
					InsecureSkipVerify: true,
				})
			},
		},
	})
	client, err := storage.NewClient(ctx, opt)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants