Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: callback support for callbackSNI #1291

Merged
merged 21 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1724,6 +1724,7 @@ parameters:
- [host] {String} The host header value for initiating callback requests.
- body {String} The value of the request body when a callback is initiated, for example, `key=${key}&etag=${etag}&my_var=${x:my_var}`.
- [contentType] {String} The Content-Type of the callback requests initiatiated, It supports application/x-www-form-urlencoded and application/json, and the former is the default value.
- [callbackSNI] {Boolean} Specifies whether OSS sends Server Name Indication (SNI) to the origin address specified by callbackUrl when a callback request is initiated from the client.
- [customValue] {Object} Custom parameters are a map of key-values<br>
e.g.:
```js
Expand Down Expand Up @@ -1849,6 +1850,7 @@ parameters:
- [host] {String} The host header value for initiating callback requests.
- body {String} The value of the request body when a callback is initiated, for example, key=${key}&etag=${etag}&my_var=${x:my_var}.
- [contentType] {String} The Content-Type of the callback requests initiatiated, It supports application/x-www-form-urlencoded and application/json, and the former is the default value.
- [callbackSNI] {Boolean} Specifies whether OSS sends Server Name Indication (SNI) to the origin address specified by callbackUrl when a callback request is initiated from the client.
- [customValue] {Object} Custom parameters are a map of key-values<br>
e.g.:
```js
Expand Down Expand Up @@ -2653,6 +2655,7 @@ parameters:
- [host] {String} set the host for callback
- body {String} set the body for callback
- [contentType] {String} set the type for body
- [callbackSNI] {Boolean} Specifies whether OSS sends Server Name Indication (SNI) to the origin address specified by callbackUrl when a callback request is initiated from the client
- [customValue] {Object} set the custom value for callback,eg. {var1: value1,var2:value2}
- [strictObjectNameValidation] {boolean} the flag of verifying object name strictly, default is true

Expand Down Expand Up @@ -2739,6 +2742,7 @@ parameters:
- [host] {String} set the host for callback
- body {String} set the body for callback
- [contentType] {String} set the type for body
- [callbackSNI] {Boolean} Specifies whether OSS sends Server Name Indication (SNI) to the origin address specified by callbackUrl when a callback request is initiated from the client
- [customValue] {Object} set the custom value for callback,eg. {var1: value1,var2:value2}
- [strictObjectNameValidation] {boolean} the flag of verifying object name strictly, default is true

Expand Down Expand Up @@ -3265,6 +3269,7 @@ parameters:
- [host] {String} The host header value for initiating callback requests.
- body {String} The value of the request body when a callback is initiated, for example, key=${key}&etag=${etag}&my_var=${x:my_var}.
- [contentType] {String} The Content-Type of the callback requests initiatiated, It supports application/x-www-form-urlencoded and application/json, and the former is the default value.
- [callbackSNI] {Boolean} Specifies whether OSS sends Server Name Indication (SNI) to the origin address specified by callbackUrl when a callback request is initiated from the client.
- [customValue] {Object} Custom parameters are a map of key-values<br>
e.g.:
```js
Expand Down Expand Up @@ -3350,6 +3355,7 @@ parameters:
- [host] {String} The host header value for initiating callback requests.
- body {String} The value of the request body when a callback is initiated, for example, key=${key}&etag=${etag}&my_var=${x:my_var}.
- [contentType] {String} The Content-Type of the callback requests initiatiated, It supports application/x-www-form-urlencoded and application/json, and the former is the default value.
- [callbackSNI] {Boolean} Specifies whether OSS sends Server Name Indication (SNI) to the origin address specified by callbackUrl when a callback request is initiated from the client.
- [customValue] {Object} Custom parameters are a map of key-values<br>
e.g.:
```js
Expand Down
1 change: 1 addition & 0 deletions lib/browser/managed-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const proto = exports;
* {String} options.callback.host The host header value for initiating callback requests
* {String} options.callback.body The value of the request body when a callback is initiated
* {String} options.callback.contentType The Content-Type of the callback requests initiatiated
* {Boolean} options.callback.callbackSNI Do you want to send the Server Name Indication
* {Object} options.callback.customValue Custom parameters are a map of key-values, e.g:
* customValue = {
* key1: 'value1',
Expand Down
3 changes: 3 additions & 0 deletions lib/common/callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ exports.encodeCallback = function encodeCallback(reqParams, options) {
if (options.callback.contentType) {
json.callbackBodyType = options.callback.contentType;
}
if (options.callback.callbackSNI) {
json.callbackSNI = options.callback.callbackSNI;
}
const callback = Buffer.from(JSON.stringify(json)).toString('base64');
reqParams.headers['x-oss-callback'] = callback;

Expand Down
1 change: 1 addition & 0 deletions lib/common/multipart.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ proto.uploadPart = async function uploadPart(name, uploadId, partNo, file, start
* {String} options.callback.host The host header value for initiating callback requests
* {String} options.callback.body The value of the request body when a callback is initiated
* {String} options.callback.contentType The Content-Type of the callback requests initiatiated
* {Boolean} options.callback.callbackSNI Do you want to send the Server Name Indication
* {Object} options.callback.customValue Custom parameters are a map of key-values, e.g:
* customValue = {
* key1: 'value1',
Expand Down
3 changes: 3 additions & 0 deletions lib/common/signUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ exports._signatureForURL = function _signatureForURL(accessKeySecret, options =
if (options.callback.contentType) {
json.callbackBodyType = options.callback.contentType;
}
if (options.callback.callbackSNI) {
json.callbackSNI = options.callback.callbackSNI;
}
subResource.callback = Buffer.from(JSON.stringify(json)).toString('base64');

if (options.callback.customValue) {
Expand Down
1 change: 1 addition & 0 deletions lib/managed-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const proto = exports;
* {String} options.callback.host The host header value for initiating callback requests
* {String} options.callback.body The value of the request body when a callback is initiated
* {String} options.callback.contentType The Content-Type of the callback requests initiatiated
* {Boolean} options.callback.callbackSNI Do you want to send the Server Name Indication
* {Object} options.callback.customValue Custom parameters are a map of key-values, e.g:
* customValue = {
* key1: 'value1',
Expand Down
1 change: 1 addition & 0 deletions lib/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ proto.append = async function append(name, file, options) {
* {String} options.callback.host The host header value for initiating callback requests
* {String} options.callback.body The value of the request body when a callback is initiated
* {String} options.callback.contentType The Content-Type of the callback requests initiatiated
* {Boolean} options.callback.callbackSNI Do you want to send the Server Name Indication
* {Object} options.callback.customValue Custom parameters are a map of key-values, e.g:
* customValue = {
* key1: 'value1',
Expand Down
Loading
Loading