mhart / aws4

Signs and prepares Node.js requests using AWS Signature Version 4
MIT License
700 stars 175 forks source link

fix: no service host in header #92

Closed yugasun closed 5 years ago

yugasun commented 5 years ago

When I set Host in headers like .us-east-1.amazonaws.com, I just want to use empty string for sevice, but it parsed service to us-east-1 which is equal to region, so I fix RequestSigner.prototype.matchHost function for it.

mhart commented 5 years ago

Can you explain why you want to set the Host header? aws4 will do that for you.

Also, .us-east-1.amazonaws.com isn't a valid host

yugasun commented 5 years ago

I just want to verify aws4 signature, so I need use headers and query from other server, when we mock a host using empty service prefix like .us-east-1.amazonaws.com, aws4 will set service to us-east-1 automatically.

mhart commented 5 years ago

But that's not a valid host – a host name cannot start with a period. aws4 isn't going to support invalid hosts

yugasun commented 5 years ago

Well, I'll close this pr.