Skip to content

Commit

Permalink
feat: callback supports callbackSNI (#1291)
Browse files Browse the repository at this point in the history
* feat: callback support for callbackSNI

* feat: support list buckets headers

* feat: support list buckets headers

* feat: support list buckets headers

* feat: support list buckets headers

* fix: error detail from header

* feat: support list buckets headers

* feat: support list buckets headers

* feat: callback support for callbackSNI

* feat: callback support for callbackSNI

* feat: callback support for callbackSNI

* feat: callback support for callbackSNI

* feat: callback support for callbackSNI

* feat: callback support for callbackSNI

* feat: callback support for callbackSNI

* feat: callback support for callbackSNI

* feat: callback support for callbackSNI

---------

Co-authored-by: csg01123119 <csg01123119@alibaba-inc.com>
  • Loading branch information
shungang and csg01123119 authored Aug 6, 2024
1 parent b4fb361 commit fc6040b
Show file tree
Hide file tree
Showing 16 changed files with 134 additions and 20,342 deletions.
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

0 comments on commit fc6040b

Please sign in to comment.