|
@ -115,7 +115,7 @@ func (s3a *S3ApiServer) PutObjectHandler(w http.ResponseWriter, r *http.Request) |
|
|
dataReader = mimeDetect(r, dataReader) |
|
|
dataReader = mimeDetect(r, dataReader) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
etag, errCode := s3a.putToFiler(r, uploadUrl, dataReader, "") |
|
|
|
|
|
|
|
|
etag, errCode := s3a.putToFiler(r, uploadUrl, dataReader, "", bucket) |
|
|
|
|
|
|
|
|
if errCode != s3err.ErrNone { |
|
|
if errCode != s3err.ErrNone { |
|
|
s3err.WriteErrorResponse(w, r, errCode) |
|
|
s3err.WriteErrorResponse(w, r, errCode) |
|
@ -457,7 +457,7 @@ func passThroughResponse(proxyResponse *http.Response, w http.ResponseWriter) (s |
|
|
return statusCode |
|
|
return statusCode |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (s3a *S3ApiServer) putToFiler(r *http.Request, uploadUrl string, dataReader io.Reader, destination string) (etag string, code s3err.ErrorCode) { |
|
|
|
|
|
|
|
|
func (s3a *S3ApiServer) putToFiler(r *http.Request, uploadUrl string, dataReader io.Reader, destination string, bucket string) (etag string, code s3err.ErrorCode) { |
|
|
|
|
|
|
|
|
hash := md5.New() |
|
|
hash := md5.New() |
|
|
var body = io.TeeReader(dataReader, hash) |
|
|
var body = io.TeeReader(dataReader, hash) |
|
@ -474,6 +474,12 @@ func (s3a *S3ApiServer) putToFiler(r *http.Request, uploadUrl string, dataReader |
|
|
proxyReq.Header.Set(s3_constants.SeaweedStorageDestinationHeader, destination) |
|
|
proxyReq.Header.Set(s3_constants.SeaweedStorageDestinationHeader, destination) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if s3a.option.FilerGroup != "" { |
|
|
|
|
|
query := proxyReq.URL.Query() |
|
|
|
|
|
query.Add("collection", s3a.getCollectionName(bucket)) |
|
|
|
|
|
proxyReq.URL.RawQuery = query.Encode() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
for header, values := range r.Header { |
|
|
for header, values := range r.Header { |
|
|
for _, value := range values { |
|
|
for _, value := range values { |
|
|
proxyReq.Header.Add(header, value) |
|
|
proxyReq.Header.Add(header, value) |
|
|