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

Request PATH includes FQDN and Protocol? #944

Closed
charz opened this issue Nov 16, 2016 · 5 comments
Closed

Request PATH includes FQDN and Protocol? #944

charz opened this issue Nov 16, 2016 · 5 comments
Labels
guidance Question that needs advice or information.

Comments

@charz
Copy link

charz commented Nov 16, 2016

I tried to use go sdk to head an object to an s3 compatible APIs, but I noticed the HEAD request include the FQDN and protocol (by tcpdump). Is that normal?

sws-sdk-go

HEAD http://swift.chhsu.com/test/test.zip HTTP/1.1
Host: swift.chhsu.com
User-Agent: aws-sdk-go/1.5.5 (go1.7.3; darwin; amd64)
Authorization: AWS4-HMAC-SHA256 Credential=demo/20161116/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=8597a1900784b56b31e41f8af88b9ca848c53f3c4d7d929a80264af12e817f23
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20161116T100714Z

s3cmd

HEAD /test/test.zip HTTP/1.1
Host: swift.chhsu.com
Accept-Encoding: identity
Content-Length: 0
Authorization: AWS demo:zrUAEJ5wCKgh2EsjcsU7LS3Ij1c=
x-amz-date: Wed, 16 Nov 2016 10:29:51 +0000
@jasdel
Copy link
Contributor

jasdel commented Nov 16, 2016

Hi @charz this is correct. This is a valid HTTP request, but some server applications do not correctly support the absolute URL in the request's header.

The http.Client may use the absolute URL in the request's initial header if the request was built where the URL.Opaque field is set. The SDK does this to ensure no unexpected escaping is performed by the Go http Client that would break the request signature.

@jasdel jasdel added the guidance Question that needs advice or information. label Nov 16, 2016
@charz
Copy link
Author

charz commented Nov 16, 2016

Hi @jasdel,

Thanks for explaining that! I'm a newbie in Go, how can I switch to the common form of Request-URI (disable absolute URI)? just leave URL.Opaque as empty?

@jasdel
Copy link
Contributor

jasdel commented Nov 16, 2016

In Go 1.5+ there is the URL.RawPath which is a better version of URL.Opaque as its just the URI Path and does not include the hostname. Switching to using RawPath instead of Opaque should prevent the need for the http client from using absolute URL.

@charz
Copy link
Author

charz commented Nov 21, 2016

Thx, it works.

@charz
Copy link
Author

charz commented Dec 7, 2017

BTW, use newer version sdk will fix the problem (> 1.6.12).

skotambkar pushed a commit to skotambkar/aws-sdk-go that referenced this issue May 20, 2021
Updates the SDK's internal changelog utility to be more restrictive of
the acceptable values from VISUAL/EDITOR environment variable usage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

2 participants