MCPcopy Create free account
hub / github.com/s3tools/s3cmd / get_hostname

Method get_hostname

S3/S3.py:269–288  ·  view source on GitHub ↗
(self, bucket)

Source from the content-addressed store, hash-verified

267 return cls
268
269 def get_hostname(self, bucket):
270 if bucket and bucket in S3Request.redir_map:
271 host = S3Request.redir_map[bucket]
272 elif bucket and check_bucket_name_dns_support(self.config.host_bucket, bucket):
273 host = getHostnameFromBucket(bucket)
274 else:
275 host = self.config.host_base.lower()
276 # The following hack is needed because it looks like that some servers
277 # are not respecting the HTTP spec and so will fail the signature check
278 # if the port is specified in the "Host" header for default ports.
279 # STUPIDIEST THING EVER FOR A SERVER...
280 # See: https://github.com/minio/minio/issues/9169
281 if self.config.use_https:
282 if host.endswith(':443'):
283 host = host[:-4]
284 elif host.endswith(':80'):
285 host = host[:-3]
286
287 debug('get_hostname(%s): %s' % (bucket, host))
288 return host
289
290 def set_hostname(self, bucket, redir_hostname):
291 S3Request.redir_map[bucket] = redir_hostname.lower()

Callers 5

format_uriMethod · 0.95
send_requestMethod · 0.95
send_fileMethod · 0.95
recv_fileMethod · 0.95
signMethod · 0.80

Calls 2

getHostnameFromBucketFunction · 0.85

Tested by

no test coverage detected