MCPcopy
hub / github.com/minio/minio-go / isVirtualHostStyleRequest

Method isVirtualHostStyleRequest

api.go:1118–1146  ·  view source on GitHub ↗

returns true if virtual hosted style requests are to be used.

(url url.URL, bucketName string)

Source from the content-addressed store, hash-verified

1116
1117// returns true if virtual hosted style requests are to be used.
1118func (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
1149func (c *Client) CredContext() *credentials.CredContext {

Callers 6

createSessionRequestMethod · 0.95
newRequestMethod · 0.95
PresignedPostPolicyMethod · 0.95
TestMakeTargetURLFunction · 0.80

Calls 1

IsVirtualHostSupportedFunction · 0.92

Tested by 2

TestMakeTargetURLFunction · 0.64