1
1
#pragma once
2
2
3
+ #include < ctime>
3
4
#include < utility>
4
5
#include " auth/Signer.h"
5
6
#include " common/Common.h"
@@ -45,12 +46,14 @@ class HttpRange {
45
46
};
46
47
class RequestBuilder {
47
48
public:
48
- RequestBuilder (std::shared_ptr<Signer> signer, std::string scheme, std::string host, std::string bucket ,
49
- std::string object, int urlMode, std::map<std:: string, std::string> headers ,
50
- std::map<std::string, std::string> query, bool isCustomDomain)
49
+ RequestBuilder (std::shared_ptr<Signer> signer, std::string scheme, std::string host, std::string controlHost_ ,
50
+ std::string accountID, std::string bucket , std::string object, int urlMode ,
51
+ std::map<std::string, std::string> headers, std::map<std::string, std::string> query, bool isCustomDomain)
51
52
: signer_(std::move(signer)),
52
53
scheme_ (std::move(scheme)),
53
54
host_(std::move(host)),
55
+ controlHost_(std::move(controlHost_)),
56
+ accountID_(std::move(accountID)),
54
57
bucket_(std::move(bucket)),
55
58
object_(std::move(object)),
56
59
URLMode_(urlMode),
@@ -105,17 +108,29 @@ class RequestBuilder {
105
108
query_[key] = value;
106
109
}
107
110
}
111
+ std::time_t getRequestDate () const {
112
+ return requestDate_;
113
+ }
114
+ void setRequestDate (std::time_t requestDate) {
115
+ requestDate_ = requestDate;
116
+ }
117
+
108
118
std::shared_ptr<TosRequest> Build (const std::string& method);
119
+ std::shared_ptr<TosRequest> BuildControlRequest (const std::string& method);
109
120
std::shared_ptr<TosRequest> Build (const std::string& method, std::shared_ptr<std::iostream> content);
121
+ std::shared_ptr<TosRequest> BuildControlRequest (const std::string& method, std::shared_ptr<std::iostream> content);
110
122
std::shared_ptr<TosRequest> BuildWithCopySource (const std::string& method, const std::string& srcBucket,
111
123
const std::string& srcObject);
112
124
std::shared_ptr<TosRequest> build (const std::string& method);
125
+ std::shared_ptr<TosRequest> buildControlRequest (const std::string& method);
113
126
std::shared_ptr<TosRequest> buildSignedURL (const std::string& method);
114
127
115
128
private:
116
129
std::shared_ptr<Signer> signer_;
117
130
std::string scheme_;
118
131
std::string host_;
132
+ std::string controlHost_;
133
+ std::string accountID_;
119
134
std::string bucket_;
120
135
std::string object_;
121
136
int URLMode_ = 0 ;
@@ -125,5 +140,7 @@ class RequestBuilder {
125
140
std::map<std::string, std::string> query_;
126
141
bool autoRecognizeContentType_ = true ;
127
142
bool isCustomDomain_ = false ;
143
+
144
+ std::time_t requestDate_ = 0 ;
128
145
};
129
146
} // namespace VolcengineTos
0 commit comments