aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/s3api_handlers.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-07-21 10:39:02 -0700
committerChris Lu <chris.lu@gmail.com>2018-07-21 10:39:02 -0700
commit8480008a9a64ed8b922c786c70bc38e1f0353478 (patch)
tree44529e24b43f2d5691b8e3f6b3028a82da8b6d07 /weed/s3api/s3api_handlers.go
parent80d80daf64370d6a3d37afa6ce06258335ac856f (diff)
downloadseaweedfs-8480008a9a64ed8b922c786c70bc38e1f0353478.tar.xz
seaweedfs-8480008a9a64ed8b922c786c70bc38e1f0353478.zip
add s3 upload, and removing mono and multi part upload analyzer
removing mono and multi part upload analyzer, which were used just to determine the file name
Diffstat (limited to 'weed/s3api/s3api_handlers.go')
-rw-r--r--weed/s3api/s3api_handlers.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/weed/s3api/s3api_handlers.go b/weed/s3api/s3api_handlers.go
index 229b3a740..13dfc8d15 100644
--- a/weed/s3api/s3api_handlers.go
+++ b/weed/s3api/s3api_handlers.go
@@ -11,6 +11,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/util"
"bytes"
"encoding/xml"
+ "encoding/base64"
)
type mimeType string
@@ -93,3 +94,14 @@ func writeSuccessResponseXML(w http.ResponseWriter, response []byte) {
func writeSuccessResponseEmpty(w http.ResponseWriter) {
writeResponse(w, http.StatusOK, nil, mimeNone)
}
+
+func validateContentMd5(h http.Header) ([]byte, error) {
+ md5B64, ok := h["Content-Md5"]
+ if ok {
+ if md5B64[0] == "" {
+ return nil, fmt.Errorf("Content-Md5 header set to empty value")
+ }
+ return base64.StdEncoding.DecodeString(md5B64[0])
+ }
+ return []byte{}, nil
+}