returns true if virtual hosted style requests are to be used.
(url url.URL, bucketName string)
| 1116 | |
| 1117 | // returns true if virtual hosted style requests are to be used. |
| 1118 | func (c *Client) isVirtualHostStyleRequest(url url.URL, bucketName string) bool { |
| 1119 | if c.lookupFn != nil { |
| 1120 | lookup := c.lookupFn(url, bucketName) |
| 1121 | switch lookup { |
| 1122 | case BucketLookupDNS: |
| 1123 | return true |
| 1124 | case BucketLookupPath: |
| 1125 | return false |
| 1126 | } |
| 1127 | // if its auto then we fallback to default detection. |
| 1128 | return s3utils.IsVirtualHostSupported(url, bucketName) |
| 1129 | } |
| 1130 | |
| 1131 | if bucketName == "" { |
| 1132 | return false |
| 1133 | } |
| 1134 | |
| 1135 | if c.lookup == BucketLookupDNS { |
| 1136 | return true |
| 1137 | } |
| 1138 | |
| 1139 | if c.lookup == BucketLookupPath { |
| 1140 | return false |
| 1141 | } |
| 1142 | |
| 1143 | // default to virtual only for Amazon/Google storage. In all other cases use |
| 1144 | // path style requests |
| 1145 | return s3utils.IsVirtualHostSupported(url, bucketName) |
| 1146 | } |
| 1147 | |
| 1148 | // CredContext returns the context for fetching credentials |
| 1149 | func (c *Client) CredContext() *credentials.CredContext { |