Socket
Socket
Sign inDemoInstall

cordova-plugin-advanced-http

Package Overview
Dependencies
0
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.4.1 to 2.5.1

9

CHANGELOG.md
# Changelog
## 2.5.1
- Fixed #334: empty JSON response triggers error even though request is successful (thanks antikalk)
- Fixed #248: clearCookies() does not work on iOS
## 2.5.0
- Feature #56: add support for X.509 client certificate based authentication
## 2.4.1

@@ -4,0 +13,0 @@

2

package.json
{
"name": "cordova-plugin-advanced-http",
"version": "2.4.1",
"version": "2.5.1",
"description": "Cordova / Phonegap plugin for communicating with HTTP servers using SSL pinning",

@@ -5,0 +5,0 @@ "scripts": {

@@ -19,2 +19,3 @@ Cordova Advanced HTTP

- CORS restrictions do not apply
- X.509 client certificate based authentication
- Handling of HTTP code 401 - read more at [Issue CB-2415](https://issues.apache.org/jira/browse/CB-2415)

@@ -118,3 +119,3 @@

### setRequestTimeout
Set how long to wait for a request to respond, in seconds.
Set the "read" timeout in seconds. This is the timeout interval to use when waiting for additional data.

@@ -191,2 +192,25 @@ ```js

### setClientAuthMode<a name="setClientAuthMode"></a>
Configure X.509 client certificate authentication. Takes mode and options. `mode` being one of following values:
* `none`: disable client certificate authentication
* `systemstore` (only on Android): use client certificate installed in the Android system store; user will be presented with a list of all installed certificates
* `buffer`: use given client certificate; you will need to provide an options object:
* `rawPkcs`: ArrayBuffer containing raw PKCS12 container with client certificate and private key
* `pkcsPassword`: password of the PKCS container
```js
// enable client auth using PKCS12 container given in ArrayBuffer `myPkcs12ArrayBuffer`
cordova.plugin.http.setClientAuthMode('buffer', {
rawPkcs: myPkcs12ArrayBuffer,
pkcsPassword: 'mySecretPassword'
}, success, fail);
// enable client auth using certificate in system store (only on Android)
cordova.plugin.http.setClientAuthMode('systemstore', {}, success, fail);
// disable client auth
cordova.plugin.http.setClientAuthMode('none', {}, success, fail);
```
### disableRedirect (deprecated)

@@ -219,5 +243,5 @@ This function was deprecated in 2.0.9. Use ["setFollowRedirect"](#setFollowRedirect) instead.

* `text`: data is returned as decoded string, use this for all kinds of string responses (e.g. XML, HTML, plain text, etc.)
* `json` data is treated as JSON and returned as parsed object
* `arraybuffer`: data is returned as [ArrayBuffer instance](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)
* `blob`: data is returned as [Blob instance](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
* `json` data is treated as JSON and returned as parsed object, returns `undefined` when response body is empty
* `arraybuffer`: data is returned as [ArrayBuffer instance](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), returns `null` when response body is empty
* `blob`: data is returned as [Blob instance](https://developer.mozilla.org/en-US/docs/Web/API/Blob), returns `null` when response body is empty
* `timeout`: timeout value for the request in seconds, defaults to global timeout value

@@ -224,0 +248,0 @@ * `followRedirect`: enable or disable automatically following redirects

@@ -298,3 +298,5 @@ module.exports = function init(global, jsUtil, cookieHandler, messages, base64, errorCodes, dependencyValidator, ponyfills) {

if (responseType === validResponseTypes[1]) {
response.data = JSON.parse(response.data);
response.data = response.data === ''
? undefined
: JSON.parse(response.data);
}

@@ -304,3 +306,5 @@

else if (responseType === validResponseTypes[2]) {
response.data = base64.toArrayBuffer(response.data);
response.data = response.data === ''
? null
: base64.toArrayBuffer(response.data);
}

@@ -310,6 +314,10 @@

else if (responseType === validResponseTypes[3]) {
var buffer = base64.toArrayBuffer(response.data);
var type = response.headers['content-type'] || '';
var blob = new Blob([ buffer ], { type: type });
response.data = blob;
if (response.data === '') {
response.data = null;
} else {
var buffer = base64.toArrayBuffer(response.data);
var type = response.headers['content-type'] || '';
var blob = new Blob([buffer], { type: type });
response.data = blob;
}
}

@@ -390,3 +398,3 @@

allowedInstanceTypes.forEach(function(type) {
allowedInstanceTypes.forEach(function (type) {
if ((global[type] && data instanceof global[type]) || (ponyfills[type] && data instanceof ponyfills[type])) {

@@ -447,3 +455,3 @@ isCorrectInstanceType = true;

reader.onload = function() {
reader.onload = function () {
result.buffers.push(base64.fromArrayBuffer(reader.result));

@@ -450,0 +458,0 @@ result.names.push(entry.value[0]);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc