Merge pull request #950 from harshavardhana/pr_out_support_virtual_host_styled_requests_convert_them_to_path_style_properly

This commit is contained in:
Harshavardhana
2015-07-29 23:45:20 -07:00
+7
View File
@@ -61,6 +61,13 @@ func New(config *Config) (client.Client, error) {
if err != nil {
return nil, iodine.New(err, nil)
}
// convert any virtual host styled requests
match, _ := filepath.Match("*.s3*.amazonaws.com", u.Host)
if match {
hostSplits := strings.SplitN(u.Host, ".", 2)
u.Path = hostSplits[0]
u.Host = hostSplits[1]
}
var transport http.RoundTripper
switch {
case config.Debug == true: