Skip to content

Commit

Permalink
Merge pull request #121 from plivo/proxy_support
Browse files Browse the repository at this point in the history
Proxy support
  • Loading branch information
nixonsam committed Jul 30, 2019
2 parents ccb8200 + f0fd112 commit 53c6bd3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
service_name: travis-ci
language: node_js
node_js:
- "node"
# - "node" commenting this as we have to find out a solution for node12 & gulp3
- "lts/*"
- "8"
- "7"
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Change Log

## [4.1.2](https://github.com/plivo/plivo-node/releases/tag/v4.1.0)(2019-03-11)
## [4.1.3](https://github.com/plivo/plivo-node/releases/tag/v4.1.3)(2019-07-30)
- Add proxy-support for Signature Validation
- Add HTTP status codes in responses

## [4.1.2](https://github.com/plivo/plivo-node/releases/tag/v4.1.2)(2019-03-19)
- Add support: Handling circular reference stringify logic

## [4.1.1](https://github.com/plivo/plivo-node/releases/tag/v4.1.0)(2019-03-11)
## [4.1.1](https://github.com/plivo/plivo-node/releases/tag/v4.1.1)(2019-03-11)
- Add PHLO support
- Add Multiparty call triggers

Expand Down
4 changes: 4 additions & 0 deletions lib/rest/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export function Request(config) {
}
} else {
let body = response.body;
let isObj = typeof _body === 'object' && _body !== null && !(_body instanceof Array) && !(_body instanceof Date)
if (isObj) {
_body['statusCode'] = response.statusCode;
}
resolve({ response: response, body: body });
}
});
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/security.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export function validateSignature(uri: string, nonce: string, signature: string,
uri = utf8.encode(uri);
let parsed_uri = parser.parse(uri);
let url_protocol = parsed_uri.protocol == '' ? 'http://' : parsed_uri.protocol+'://';
let base_url = buildUrl(url_protocol+parsed_uri.host, { path: parsed_uri.path });
let proxy = parsed_uri.port == '' ? parsed_uri.host : parsed_uri.host + ':' + parsed_uri.port;
let base_url = buildUrl(url_protocol + proxy , { path: parsed_uri.path });
let hmac = crypto.createHmac('sha256', auth_token);
let hmacBytes = base64.decode(hmac.update(base_url+nonce).digest('base64'));
let authentication_string = base64.encode(hmacBytes);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "plivo",
"version": "4.1.2",
"description": "A Node.js SDK to make voice calls & send SMS using Plivo and to generate Plivo XML",
"version": "4.1.3",
"description": "A Node.js SDK to make voice calls and send SMS using Plivo and to generate Plivo XML",
"homepage": "https://github.com/plivo/plivo-node",
"files": [
"dist"
Expand Down

0 comments on commit 53c6bd3

Please sign in to comment.