Skip to content

aws/ec2metadata: Avoid unnecessary redirect #198

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

Closed
jasdel opened this issue Jul 12, 2018 · 3 comments · Fixed by #356
Closed

aws/ec2metadata: Avoid unnecessary redirect #198

jasdel opened this issue Jul 12, 2018 · 3 comments · Fixed by #356
Labels

Comments

@jasdel
Copy link
Contributor

jasdel commented Jul 12, 2018

V2 port of the v1 SDK's aws-sdk-go#2037. Removes unneeded redirect when making ec2 metadata calls for ec2 instance roll credentials.

@jasdel jasdel added the v1-sync label Jul 12, 2018
@stefansundin
Copy link

I had a thought that maybe in v2, there is no need for an sdkuri.PathJoin method to preserve the behavior.. One reason for a v2 is the ability to break things in the desire to simplify things, right?

Anyway, just a thought. :)

@jasdel
Copy link
Contributor Author

jasdel commented Jul 13, 2018

Agreed, one of the the ways to address this is using URI.ResolveReference. This method will preserve trailing slashes when joining components of a URI path. I think using ResolveReference for v2 would be the best approach. And probably should be applied to how the SDK computes URIs in general.

@stefansundin
Copy link

Hi @jasdel,

I just gave URL.ResolveReference a quick try, and I'm not sure if it will produce the results you want. See https://play.golang.org/p/TrL2Jas6CKw

base = http://169.254.169.254/latest/meta-data/iam/security-credentials/
base + /test/ => http://169.254.169.254/test/
base + test/ => http://169.254.169.254/latest/meta-data/iam/security-credentials/test/
base + test// => http://169.254.169.254/latest/meta-data/iam/security-credentials/test//

I think you want base + /test/ to return the same as base + test/, right?

@jasdel jasdel changed the title aws/ec2metadata: Prevent Avoid unnecessary redirect aws/ec2metadata: Avoid unnecessary redirect Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants