kopia lustrzana https://github.com/gaul/s3proxy
more compatibility fixes for s3cmd
s3cmd uses virtual hostname for bucket name, with the host header including the port. need to strip out the port to find out the bucket namepull/22/merge
rodzic
004d12761e
commit
617b3ae3e9
|
@ -49,6 +49,7 @@ import com.google.common.collect.TreeMultimap;
|
|||
import com.google.common.hash.HashCode;
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.common.net.HttpHeaders;
|
||||
|
||||
import org.eclipse.jetty.server.Request;
|
||||
|
@ -121,6 +122,7 @@ final class S3ProxyHandler extends AbstractHandler {
|
|||
logger.debug("request: {}", request);
|
||||
String hostHeader = request.getHeader(HttpHeaders.HOST);
|
||||
if (hostHeader != null && virtualHost.isPresent()) {
|
||||
hostHeader = HostAndPort.fromString(hostHeader).getHostText();
|
||||
String virtualHostSuffix = "." + virtualHost.get();
|
||||
if (hostHeader.endsWith(virtualHostSuffix)) {
|
||||
String bucket = hostHeader.substring(0,
|
||||
|
|
Ładowanie…
Reference in New Issue