aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-09-02 22:55:35 -0700
committerChris Lu <chris.lu@gmail.com>2021-09-02 22:55:35 -0700
commit958125bd02917c3e627a845d7e60da90a596fc17 (patch)
tree2920ab4420da405af2cadd9b393ad43e0c076c0e
parent11a496404b9af6d435e5f9f2bb7ec8d0fe9d02bc (diff)
downloadseaweedfs-958125bd02917c3e627a845d7e60da90a596fc17.tar.xz
seaweedfs-958125bd02917c3e627a845d7e60da90a596fc17.zip
conforming to http user agent common practice
-rw-r--r--weed/remote_storage/s3/s3_storage_client.go4
-rw-r--r--weed/util/constants.go2
2 files changed, 5 insertions, 1 deletions
diff --git a/weed/remote_storage/s3/s3_storage_client.go b/weed/remote_storage/s3/s3_storage_client.go
index 0eb36a3c9..8a764e67b 100644
--- a/weed/remote_storage/s3/s3_storage_client.go
+++ b/weed/remote_storage/s3/s3_storage_client.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
+ "github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session"
v4 "github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/service/s3"
@@ -49,6 +50,9 @@ func (s s3RemoteStorageMaker) Make(conf *remote_pb.RemoteConf) (remote_storage.R
if conf.S3V4Signature {
sess.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
}
+ sess.Handlers.Build.PushBack(func(r *request.Request) {
+ r.HTTPRequest.Header.Set("User-Agent", "SeaweedFS/"+util.VERSION)
+ })
sess.Handlers.Build.PushFront(skipSha256PayloadSigning)
client.conn = s3.New(sess)
return client, nil
diff --git a/weed/util/constants.go b/weed/util/constants.go
index d2a90f874..08705585f 100644
--- a/weed/util/constants.go
+++ b/weed/util/constants.go
@@ -5,7 +5,7 @@ import (
)
var (
- VERSION = fmt.Sprintf("%s %.02f", sizeLimit, 2.65)
+ VERSION = fmt.Sprintf("%.02f (%s)", 2.65, sizeLimit)
COMMIT = ""
)