Giter Site home page Giter Site logo

cordova-http's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-http's Issues

Headers application/json

I just installed this plugin and I want to make requests previously made with ajax using now features on this plugin.

Before a get request was as follows:
========================= AJAX CODE ==========================
$.ajax({
beforeSend: function(xhr){
xhr.setRequestHeader("Authorization", "Basic " + btoa("user" + ":" + "passwd"));
},
url: "myUrl",
type: 'GET',
dataType: 'json',
success: function(){},
error: function(jqXHR, textStatus, errorThrown){}

});

and this worked perfectly.
Now using the following code:

=================== PLUGIN CODE ==========================
cordovaHTTP.useBasicAuth(userPass[0], userPass[1],
function() {
console.log('success!');
}, function() {
console.log('error :(');
}
);

cordovaHTTP.get("myUrl",
{}, // optional params
{}, // optional headers
function(response) {
console.log(response.status);
try {
response.data = JSON.parse(response.data);
// prints test
console.log(response.data.message);
} catch(e) {
console.error("JSON parsing error");
}
}, function(response) {
console.error(response.error);
}

);

I receive the following response from the server
==================== SERVER RESPONSE ====================

{"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Not Acceptable","status":406,"detail":"Cannot honor Accept type specified"}"

How I can use my request headers to resemble the ajax request?

Thanks

Double URL encoding gotcha on Android

Just a heads up, found this issue out on Android after a few hours of debugging...

Issuing a GET call with a query string (not passed as an object) will double urlencode the already urlencoded url argument:

cordovaHTTP.get('http://test/?parameter=some+escaped+string', {}, {}, function() { ... });

will hit this line in the plugin which in turn will call this code in http request library - which will re-encode the url.

Expected outcome - don't re encode input url.

HTTP status 401 answer is reported as "500 / There was an error with the request"

We have a web service expecting specific authorization tokens (cookies or HTTP headers) to be included to authorize the request. If such information isn't found, the script answers with an HTTP 401 code (not authorized) and a custom JSON content.

When testing a GET to this script (without any token) using cordovaHTTP.get, the error status sent back is "500" with a message "There was an error with the request".
When debugging, I found that this is caused by an exception (java.io.IOException: No authentication challenges found) triggered in CordovaHttpGet on line int code = request.code(); and caught by returning this 500 status.
In such a case I would expect the code to be sent as such so that the calling application can know that authorization tokens are either missing or no longer valid (e.g.ask again for authorization before calling again web service).

Gzipped XML Response

When making the call the zipped data is what's returned if I simply add application/zip to the list of acceptable types in the text serializer. How would one make a call to a server that returns gzipped responses? I'd make it non-gzipped if I had any control over the server.

Cheers,
PJ

SSLPinning

In README.md (https://github.com/wymsee/cordova-HTTP) said:

"As an alternative, you can store your .cer files in the www/certificates folder."

but my application (build in Intel xdk) not find it on my device (android).

Although the exact package certificate is:

connect.android.20141212030243.apk\assets\www\certificates\server.cer

Where should I place the certificate in the intel XDK project?

Accessing a php page

Hi, I'm trying to use window.cordovaHTTP within the ripple emulator and although it is visible in the debugger global variable when I use the window.cordovaHTTP.get(..) methond I get told
"missing exec:CordovaHttpPlugin.get".

Still if I run the code on the device it works OK.
Must be a problem of Ripple.

I'm using your sample code for testing and the 200 status code!

window.cordovaHTTP.get("https://google.com/", {
id: 12,
message: "test"
}, { Authorization: "OAuth2: token" }, function(response) {
console.log(response.status);
alert("Status = "+response.status, "OK");
}, function(response) {
console.error(response.error);
alert("Error = "+response.error, "OK");
});

But on the device I cannot make work the following

//http://193.206.215.17/BVE/result.php?dove=base&autore=frontinus&numschede=5&cerca=Avvia+la+ricerca

window.cordovaHTTP.get("http://193.206.215.17/BVE/result.php?", {
dove: base,
autore: frontinus,
numschede: 5,
cerca: "Avvia la ricerca"
}, { }, function(response) {
console.log(response.status);
alert("Status = "+response.status, "OK");
}, function(response) {
console.error(response.error);
alert("Error = "+response.error, "OK");
});
}

I just don't get any alert (right or wrong).
Any Idea of what I'm doing wrong? I removed the headers 'cause at present I would leave the default.

Thanks

Ionic Framework Issues

I'm trying to use this within an Ionic (angular + cordova) application but don't seem to be able to see cordovaHTTP to use when passing it in to the module or window.cordovaHTTP. Any pointers in the right direction would be hugely appreciated.

Should it appear in this list from the debug log?

2014-10-07 06:57:32.244 iH CX Check-In[17858:60b] Apache Cordova native platform version 3.6.3 is starting.
2014-10-07 06:57:32.246 iH CX Check-In[17858:60b] Multi-tasking -> Device: YES, App: YES
2014-10-07 06:57:32.382 iH CX Check-In[17858:60b] Unlimited access to network resources
2014-10-07 06:57:32.513 iH CX Check-In[17858:60b] [CDVTimer][keyboard] 0.100017ms
2014-10-07 06:57:32.537 iH CX Check-In[17858:60b] [CDVTimer][file] 23.380995ms
2014-10-07 06:57:32.796 iH CX Check-In[17858:60b] [CDVTimer][splashscreen] 258.446038ms
2014-10-07 06:57:32.845 iH CX Check-In[17858:60b] [CDVTimer][statusbar] 48.129976ms
2014-10-07 06:57:32.846 iH CX Check-In[17858:60b] [CDVTimer][TotalPluginStartup] 332.625985ms

Cheers,
PJ

If there is somewhere else (mailing list, group, etc) that's a more appropriate place to ask this, just let me know.

Using cordovaHTTP in javascript example

Hello wymsee,
I'm having trouble in trying out cordova-HTTP within my javascript (EmployeeServie.js from the cordova tutorial code).

this.findByName = function(searchKey) {
....
cordovaHTTP.setHeader("Header", "Value", function() {
console.log('success!');
}, function() {
console.log('error :(');
});
....
};

I get this error: "Uncaught ReferenceError: cordovaHTTP is not defined "

com.synconset.cordovaHTTP is listed in my plugins project directory
and I have installed it with
cordova plugin add https://github.com/wymsee/cordova-HTTP.git

I am developing for the android platform with cordova 3.5.0-0.2.7.

I have no clue on how to use it WITH angularJs or WITHOUT angularJs.

Hope you can support me with some usage examples.

Many thanks,

Giulio

HTTP Referer Header

Does this plugin allows arbitrary setting of the HTTP Referer header value? As far as I know normal XHR requests doesn't allow this. Some API services check the referer header against a whitelist of allowed domains, so it would be great of this is possible.

Not found

Hi -

I think you've built exactly what I'm looking for, but the plugin doesn't seem to be recognized. I'm using Angular/Ionic along with Cordova 3.5 and testing on an iPhone 4s at the moment (iOS only).

I have installed the plugin via the cli and it is listed in my plugins directory.

I added the 'cordovaHTTP' module as a dependency to my app - but the app hangs as it is unable to find the module.

I'm hoping I'm just missing something simple here, any ideas?

Progress?

Is there any way to be notified of download progress, via a callback or some other method?

PhoneGap Build - submit cordova-HTTP

Hi, congrats for the fancy plugin!

Has anyone tried to submit cordovaHTTP plugin to the PhoneGap build repository ?

If yes there was a technical reason for the plugin have been rejected? I'm trying to build an app with PB and it claims "plugin unsupported: com.synconset.cordovaHTTP"

I have a paid account and I would not mind to request the plugin's approval at PhoneGap Build, can I do it?

About "Submitting your plugin":

http://docs.build.phonegap.com/en_US/developer_contributing_plugins.md.html

Question: Compatibility with Embedded Youtube Player

I'm using the embedded YT player on a cordova app. It works fine on iOS, but there are videos that work on iOS that don't work on Android. On android, I get the 'playback is restricted on certain sites' message instead of the video. I read that this might have something to do with the http referrer being sent to youtube with the get request of each video. Is there a way for your plugin to modify those requests? I'm also using xwalk, but the issue is there whether or not I have xwalk included.

Thanks

Large amounts of data (10 meg) cause POST to fail

When submitting a large amount of data, in this case about 10Meg, the plugin crashes cordova. Here is a test case that crashes:

    test: function() {
            var strlength = 524288*20;
            var str = "";
            for (var i = 0; i < strlength; i++) {
                    str += "a";
            }
            var data = { name: "ATest", group: "", content: str };
            var url = "http://192.168.56.101/testapp/save";
            cordovaHTTP.useBasicAuth("admin", "admin", function() {
                    console.log('Set Basic Auth');
            }, function() {
                    console.log('Set Basic Auth: FAIL');
            });
            cordovaHTTP.post(url, data, { },
            function(response) {
                    console.log("HTTP response: "+response.status);
                    console.log(response.data);
            }, function(response) {
                    console.log("HTTP response: "+response.status);
            });
    }

Shortening the string length by removing the multiplication by 20 from strlength allows it to work. No information is displayed in the logcat, it just crashes to the launcher.

Creating a POST request with JSON payload

I want to send json-data to a server using the POST method but I can't just send the JSON-string in the body of the request and I can't change the content-type to 'application/json'

Module not instantiating with Angular JS

I am trying to use CordovaHTTP with Angular JS but am unable to get it to work when I inject the Cordova module as a dependency. The following is the way I have done things.
I am manually bootstrapping my Angular app once Cordova fires the device ready event.

document.addEventListener("deviceready", function() {
console.log("Ready");
var domElement = document.querySelector('body');
angular.bootstrap(domElement, ["myAppName"]);
}, false);

In the app definition, I am adding 'cordovaHTTP' as follows:

angular.module('myAppName', ['ngRoute','mobile-angular-ui','mobile-angular-ui.gestures','cordovaHTTP'])

But its just not working. Please help out. Thanks.

No follow

Hello,

I`m trying to retrieve content using this header
HTTP/1.1 302 Found Date: Mon, 09 Mar 2015 22:31:06 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked Connection: close
Set-Cookie: __cfduid=xxxxxxxxxxxxxxxxxxxxxx; expires=Tue, 08-Mar-16 22:31:05 GMT; path=/; domain=.example.tv;
HttpOnly X-Powered-By: PHP/5.3.3
P3P: policyref="http://www.example.com/w3c/p3p.xml", CP="CURa ADMa DEVa CONo HISa OUR IND DSP ALL COR"
Location: /404.php
Server: cloudflare-nginx CF-RAY: xxxxxxx-ORD 26a5

Theres content on that page. but because of this header, I cant get it. Is it possible to set a no follow option?

Thank you!

Timeout

Simple Question: Can I define my own timeout for a request?

Thanks in advance.

Promises don't get called

Hi,
if I run cordovaHTTP without angular fashion, everything works well.
If I try to run it with angular, my promises never got called.

Here is the way I'm using it:

cordovaHTTP.get("/").then(function(response) {
    alert('ok');
  }, function(response) {
    alert('err');
});

Could this be a bug, or I'm misusing it?

Range requests.

Doesn't work.

Tried it with MP3s. Just requests the whole thing.

E.G.:

window.cordovaHTTP.setHeader ('Range', 'bytes=0-159999', function () {
 window.cordovaHTTP.setHeader ('Content-Length', '159999', function () {
  ...
 })
})

cannot install with cordova

cannot install with the following command

cordova plugin add https://github.com/wymsee/cordova-HTTP.git

got the following error

e:\Javascript\MapAm>cordova plugin add https://github.com/wymsee/cordova-HTTP.gi
t
Fetching plugin "https://github.com/wymsee/cordova-HTTP.git" via git clone
Repository "https://github.com/wymsee/cordova-HTTP.git" checked out to git ref "
master".
Installing "com.synconset.cordovaHTTP" for android
Notice: org.apache.cordova.file has been automatically converted to cordova-plug
in-file and fetched from npm. This is due to our old plugins registry shutting d
own.
Fetching plugin "https://github.com/apache/cordova-plugin-file" via git clone
Repository "https://github.com/apache/cordova-plugin-file" checked out to git re
f "r0.2.5".
Failed to install 'com.synconset.cordovaHTTP':Error: Expected plugin to have ID
"cordova-plugin-file" but got "org.apache.cordova.file".
    at checkID (C:\Users\Mirodil\AppData\Roaming\npm\node_modules\cordova\node_m
odules\cordova-lib\src\plugman\fetch.js:181:15)
    at C:\Users\Mirodil\AppData\Roaming\npm\node_modules\cordova\node_modules\co
rdova-lib\src\plugman\fetch.js:166:9
    at _fulfilled (C:\Users\Mirodil\AppData\Roaming\npm\node_modules\cordova\nod
e_modules\q\q.js:787:54)
    at self.promiseDispatch.done (C:\Users\Mirodil\AppData\Roaming\npm\node_modu
les\cordova\node_modules\q\q.js:816:30)
    at Promise.promise.promiseDispatch (C:\Users\Mirodil\AppData\Roaming\npm\nod
e_modules\cordova\node_modules\cordova-lib\node_modules\cordova-common\node_modu
les\q\q.js:796:13)
    at C:\Users\Mirodil\AppData\Roaming\npm\node_modules\cordova\node_modules\co
rdova-lib\node_modules\cordova-common\node_modules\q\q.js:604:44
    at runSingle (C:\Users\Mirodil\AppData\Roaming\npm\node_modules\cordova\node
_modules\cordova-lib\node_modules\cordova-common\node_modules\q\q.js:137:13)
    at flush (C:\Users\Mirodil\AppData\Roaming\npm\node_modules\cordova\node_mod
ules\cordova-lib\node_modules\cordova-common\node_modules\q\q.js:125:13)
    at doNTCallback0 (node.js:417:9)
    at process._tickCallback (node.js:346:13)
Error: Expected plugin to have ID "cordova-plugin-file" but got "org.apache.cord
ova.file".

Error on including module

Hello,

I've tried to use this plugin but it raise an error. Could you help me?
I've read the README.txt file several times.
So what I've done:
First, I install the plugin with cordova plugin add https://github.com/wymsee/cordova-HTTP.git
After that I check that the plugin is included in the cordova's plugin list and it was listed.
After that I've include the cordovaHTTP like it is made in the README.txt: var app = angular.module('myApp', ['ngRoute', 'ngAnimate', 'cordovaHTTP']);
This cause the following error: "Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to:
Error: [$injector:modulerr] Failed to instantiate module cordovaHTTP due to:
Error: [$injector:nomod] Module 'cordovaHTTP' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

If you need the backtrace of the error I could provide it.
Also I want to notice that the app was running before I try to add cordovaHTTP module.

Thank you for your help.

Support for SSL pinning with public keys

It would be really great, if you could add support for SSL pinning with public keys as is possible with AFNetworking. AFNetworking supports both pinning with certificates or public keys.

Certificate pinning is great if you already have a CA signed certificate. But if you want to generate a couple of Certificate Signing Requets (CSR) for later use, you could use those to extract their public keys. That way you do not need to buy costly certificates just for the case that you may need to switch them (they do expire sooner or later!).

Form-data POST

How I can set form-data request parameters in a post ?
I tested on the site intended for optional parameters with something like: {email: " [email protected] "}
but the result is an error " 415 : Invalid Conten -type specified".

Error: undefined variable require

Hi, I'm using this plugin with steroids, but I get the error "undefined variable :require". I've loaded cordova correctly, the Angular and then cordovaHTTP. I found some pages mentioning this is a conflict between the plugin and Angular. is this right?

Failed to instantiate module cordovaHTTP due to

I'm trying to use this module on my Cordova/Ionic project and I've loaded the module according to the documentation, but when I try to use cordovaHTTP.enableSSLPinning it gives me the following error:

Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:modulerr] Failed to instantiate module cordovaHTTP due to:
Error: [$injector:nomod] Module 'cordovaHTTP' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.3.6/$injector/nomod?p0=cordovaHTTP
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:7888:12
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:9576:17
at ensure (http://localhost:8100/lib/ionic/js/ionic.bundle.js:9500:38)
at module (http://localhost:8100/lib/ionic/js/ionic.bundle.js:9574:14)
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:11906:22
at forEach (http://localhost:8100/lib/ionic/js/ionic.bundle.js:8147:20)
at loadModules (http://localhost:8100/lib/ionic/js/ionic.bundle.js:11890:5)
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:11907:40
at forEach (http://localhost:8100/lib/ionic/js/ionic.bundle.js:8147:20)
at loadModules (http://localhost:8100/lib/ionic/js/ionic.bundle.js:11890:5)
http://errors.angularjs.org/1.3.6/$injector/modulerr?p0=cordovaHTTP&p1=Erro…%3A%2F%2Flocalhost%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A11890%3A5)
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:7888:12
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:11929:15
at forEach (http://localhost:8100/lib/ionic/js/ionic.bundle.js:8147:20)
at loadModules (http://localhost:8100/lib/ionic/js/ionic.bundle.js:11890:5)
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:11907:40
at forEach (http://localhost:8100/lib/ionic/js/ionic.bundle.js:8147:20)
at loadModules (http://localhost:8100/lib/ionic/js/ionic.bundle.js:11890:5)
at createInjector (http://localhost:8100/lib/ionic/js/ionic.bundle.js:11816:11)
at doBootstrap (http://localhost:8100/lib/ionic/js/ionic.bundle.js:9263:20)
at bootstrap (http://localhost:8100/lib/ionic/js/ionic.bundle.js:9284:12)

Undefined symbols for architecture i386

Build in osx for ios platform error:

Undefined symbols for architecture i386:
"_SCNetworkReachabilityCreateWithAddress", referenced from:
+[AFNetworkReachabilityManager managerForAddress:] in AFNetworkReachabilityManager.o
"_SCNetworkReachabilityCreateWithName", referenced from:
+[AFNetworkReachabilityManager managerForDomain:] in AFNetworkReachabilityManager.o
"_SCNetworkReachabilityGetFlags", referenced from:
___47-[AFNetworkReachabilityManager startMonitoring]_block_invoke54 in AFNetworkReachabilityManager.o
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
-[AFNetworkReachabilityManager startMonitoring] in AFNetworkReachabilityManager.o
"_SCNetworkReachabilitySetCallback", referenced from:
-[AFNetworkReachabilityManager startMonitoring] in AFNetworkReachabilityManager.o
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
-[AFNetworkReachabilityManager stopMonitoring] in AFNetworkReachabilityManager.o
ld: symbol(s) not found for architecture i386

missing command error

window.cordovaHTTP.get(
  "https://platform.telerik.com",
  {}, // optional params
  {}, // optional headers
  function(msg) {alert("OK: " + msg)},
  function(msg) {alert("ERROR: " + msg)}
);

msg: missing command error

Can someone tell me what's going on?

Clang Error when i run cordova build

Hi ,
I added this plugin to my cordova app . When i tried to build using "cordova build" it throws following error.

Undefined symbols for architecture i386:
"_SCNetworkReachabilityCreateWithAddress", referenced from:
+[AFNetworkReachabilityManager managerForAddress:] in AFNetworkReachabilityManager.o
"_SCNetworkReachabilityCreateWithName", referenced from:
+[AFNetworkReachabilityManager managerForDomain:] in AFNetworkReachabilityManager.o
"_SCNetworkReachabilityGetFlags", referenced from:
___47-[AFNetworkReachabilityManager startMonitoring]_block_invoke54 in AFNetworkReachabilityManager.o
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
-[AFNetworkReachabilityManager startMonitoring] in AFNetworkReachabilityManager.o
"_SCNetworkReachabilitySetCallback", referenced from:
-[AFNetworkReachabilityManager startMonitoring] in AFNetworkReachabilityManager.o
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
-[AFNetworkReachabilityManager stopMonitoring] in AFNetworkReachabilityManager.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Question: Adding POST body

Hi,

I understand how to pass it to the plugin, but I'm not sure how to add it to the actual request. I've currently added

NSString *body = [command.arguments objectAtIndex:3];
//create the body
NSMutableData *postBody = [NSMutableData data];
[postBody appendData:[body dataUsingEncoding:NSUTF8StringEncoding]];

to the post definition in CordovaHttpPlugin.m

Cheers,
PJ

Potential iOS Security Issue: AFNetworking Library

Hi,

It appears that the AFNetworking library used by cordova-HTTP has a major security flaw leading to the interception of HTTPS data on iOS. Here is the run-down:

http://www.macrumors.com/2015/04/21/security-flaws-1500-ios-apps-rootpipe/

The fix is in the latest AFNetworking release:

https://github.com/AFNetworking/AFNetworking/releases/tag/2.5.3

It is unlikely that 2.4.1 AFNetworking used in cordova-HTTP is at risk, but I'm not sure they've evaluated anything prior to 2.5. Therefore I'd recommend confirming 2.4.1 does not have the issue and notating the code to ensure future updates never use anything lower than 2.5.3, or go ahead and update the library to 2.5.3 to be safe.

Cookie Headers not set automatically?

I just switched from using file transfer plugin for uploading to cordovaHTTP inside an Angular app.

Everything gets uploaded to the server, but my response is always 401 (not authorized), implying that the session cookie is not sent with the request headers.

This was not an issue with the filetransfer plugin, so was wondering if we need to do something specifically to include the session data by default? This happens on both iOS and Android.

ReferenceError: Can't find variable: cordovaHTTP

I installed the plugin and used it in index.js. Whenever I try to make another request fro another file I keep getting ReferenceError: Can't find variable: cordovaHTTP.
I have included cordova.js in years.html file

years.js
var years = {

showYears:function(){
    var categoriesDiv = $("#cat");
    categoriesDiv.html(window.sessionStorage.getItem('key'));
    alert(window.sessionStorage.getItem('key'))
    years.getYears();
},

getYears: function(){
    cordovaHTTP.get("http://localhost/arableague/public/api/getYears/",
                    {
        id:2
    },
                    {},
                    function(response){
        alert(response);
        var yearsResult = JSON.parse(response.data);
        var yearsDiv = $("#yearsDiv");
        alert('x')
        for(i=0; i<yearsResult.length; i++){
            var cat = yearsResult[i]['year'];
            var button = '<button>'+ cat +'</button>';

            console.log(button);
            yearsDiv.append(button)
        }
    },
                   function(response){
        alert(response.error);
        })
}

};

TLSv1 or SSLv3 required: Potential security issue?

It seems that in cordova-HTTP's current configuration, TLSv1 or SSLv3 are required. A standard apache configuration to keep things secure since the POODLE bug has been:

SSLProtocol +TLSv1.2 +TLSv1.1 -TLSv1 -SSLv3 -SSLv2
SSLCipherSuite 'ECDH+AESGCM:DH+AESGCM:ECDH+AES:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS:!3DES'
SSLHonorCipherOrder On

However, without +TLSv1 or +SSLv3 cordova-HTTP fails to connect. This means that to use a cordova-HTTP app, the server has to be setup to allow potentially vulnerable clients.

As a note, I'm working on an application that integrates with ownCloud, so many of their user's servers are enterprise ready and require the above security settings (I.E. they cannot be changed).

Is this something that can be corrected in the way cordova-HTTP is configured within the app?

Thanks in advance.

iOS dependency on SystemConfiguration framework

When testing the plugin with a simple test application, the linker failed because of unresolved dependencies. I had to add the SystemConfiguration framework to resolve these issues. Shouldn't this framework be added too in the plugin.xml configuration file?

Cannot load module in Ionic app

Hi,
I followed instructions to use the plugin and it seems OK to install it.

  1. cordova plugin add https://github.com/wymsee/cordova-HTTP.git (No error and I can see plugins/com.synconset.cordovaHTTP directory)
  2. var app = angular.module('myApp', ['ionic', 'cordovaHTTP', 'app.controllers'])

But when I run the app, I've got the error.

12-16 11:58:57.254: D/CordovaLog(3246): Error: [$injector:nomod] Module 'cordovaHTTP' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

I cannot figure out what I am missing. Thank you.

Not working with Ionic framework

Hi,

I am trying to use this plugin with ionic framework. I have added the plugin using 'cordova plugin add https://github.com/wymsee/cordova-HTTP.git' and then include 'cordovaHTTP' into my app.js

But during deployment what I have observed is app.js is getting executed before cordova has loaded all the plugins and my app.js is not able to find 'cordovaHTTP' module.

I have made sure I am loading cordova.js ahead of app.js, still it is loading app.js even before all the plugins are loaded.

How do I handle this ?.

Angular style,but I cant't get the effect

This is what I use :
cordovaHTTP.get('**').then(function(data){
console.log('success.....');
console.log(data);
$scope.dd = data;
$ionicPopup.alert({
title: 'success...',
template: JSON.stringify(data)
});
},function(err){
console.log('error.....');
console.log(data);
$scope.dd = data;
$ionicPopup.alert({
title: 'error....',
template: JSON.stringify(data)
});
})
but It did nothing,even in the real device.
When I inspect in it,it nevet went into cordovaHTTP.js's code:'success'::list below:
var success = function(response) {
if (async) {
$timeout(function() {
deferred.resolve(response);
});
} else {
deferred.resolve(response);
}
};

So I don't know what happen,can you guys show me a way to understand this.
Thank you very much.

Spoofing request headers and cookies?

I want to do some webscraping and was wondering if it was possible to set the "referrer" header and other headers to whatever I want. Also can I add custom cookies and bypass the default cookies?

Need help: cordovaHTTP stops JS processing

Hi wymsee,

This may just be misuse, but I've followed the instructions and created a simple little app that represents a crash I'm having. Here's the code:

var app = {
        initialize: function() {
                this.bindEvents();
        },
        bindEvents: function() {
                document.addEventListener('deviceready', this.onDeviceReady, false);
        },
        onDeviceReady: function() {
                init();
        },
};

function init() {
    acceptAllCerts(true);
}

function acceptAllCerts(b) {
            console.log('acceptAllCerts');
            cordovaHTTP.acceptAllCerts(b, function() {
                    console.log('success');
            }, function() {
                    console.log('fail');
            });
}

The code prints out "acceptAllCerts" but never gets to the failure or success. All JS processing just stops with no errors reported. I've tried installing both with:

cordova plugin add https://github.com/wymsee/cordova-HTTP.git

and with

cordova plugin add com.synconset.cordovahttp 

... since they were both in the instructions on http://plugins.cordova.io/#/package/com.synconset.cordovahttp, but neither works for me. Any idea what I'm doing wrong?

This is codrova > 3 and running on Android for now, but will run on iOS in the future. Thanks.

Need documentation for not supported features

This plugin is great to provide (at last) some way to implement certificate pinning into Cordova-based applications. The SSLCertificateChecker plugin is another one but it only allows one-time checks.

However, I think that it would be good to document some of the features not available as developers may think that they could replace their Ajax (or equivalent) calls with this plugin.

Based on quick tests I found the following as not supported:

  • cookies support (a cookie set by a request isn't sent in subsequent requests)
  • read content of error responses (only the HTTP status code and message are returned)
  • read returned HTTP headers (e.g. in case security tokens are returned as headers)

I also had a good surprise when seeing that pinning issuing CA certificates was supported too, so that applications don't have to be updated in case server certificates are renewed by using the same CA. It may be good to add it to the documentation.

If my comments above are valid (they are only based on quick tests), I can propose changes to the README file to bring my own contribution to this great piece of work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.