aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-08-31 00:24:17 -0700
committerchrislu <chris.lu@gmail.com>2022-08-31 00:24:17 -0700
commit870a30665b69da95bba304e8d2c4b7affa29896f (patch)
tree62e89cb4114a93e9b2b5f685d393964ee967a91d
parentef78631a7c2a1fc3de874d85ea08b7e8d9d3ca02 (diff)
downloadseaweedfs-870a30665b69da95bba304e8d2c4b7affa29896f.tar.xz
seaweedfs-870a30665b69da95bba304e8d2c4b7affa29896f.zip
close responses
-rw-r--r--unmaintained/s3/presigned_put/presigned_put.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/unmaintained/s3/presigned_put/presigned_put.go b/unmaintained/s3/presigned_put/presigned_put.go
index e8368d124..ba135ff25 100644
--- a/unmaintained/s3/presigned_put/presigned_put.go
+++ b/unmaintained/s3/presigned_put/presigned_put.go
@@ -1,15 +1,16 @@
package main
import (
+ "crypto/md5"
+ "encoding/base64"
+ "fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
- "encoding/base64"
- "fmt"
- "crypto/md5"
+ "github.com/seaweedfs/seaweedfs/weed/util"
+ "net/http"
"strings"
"time"
- "net/http"
)
// Downloads an item from an S3 Bucket in the region configured in the shared config
@@ -63,6 +64,7 @@ func main() {
fmt.Printf("error put request: %v\n", err)
return
}
+ defer util.CloseResponse(resp)
fmt.Printf("response: %+v\n", resp)
}
@@ -70,4 +72,4 @@ var stringContent = `Generate a Pre-Signed URL for an Amazon S3 PUT Operation wi
You can generate a pre-signed URL for a PUT operation that checks whether users upload the correct content. When the SDK pre-signs a request, it computes the checksum of the request body and generates an MD5 checksum that is included in the pre-signed URL. Users must upload the same content that produces the same MD5 checksum generated by the SDK; otherwise, the operation fails. This is not the Content-MD5, but the signature. To enforce Content-MD5, simply add the header to the request.
The following example adds a Body field to generate a pre-signed PUT operation that requires a specific payload to be uploaded by users.
-` \ No newline at end of file
+`