SSL certificate requirments for URLLoader() on Android
recently ssl certificate on site https://www.jollysnpas.com updated , https requests made urlloader() on android being rejected. problem when running on actual android device.
i trying hosting provider investigate, not being helpfull here can identify why new ssl certificate being rejected can them fix ssl certificate.
to reproduce error following code demonstrates problem.
package
{
import flash.display.sprite;
import flash.events.event;
import flash.events.httpstatusevent;
import flash.events.ioerrorevent;
import flash.events.progressevent;
import flash.events.securityerrorevent;
import flash.net.urlloader;
import flash.net.urlloaderdataformat;
import flash.net.urlrequest;
import flash.net.urlrequestmethod;
import flash.net.urlvariables;
public class urlloaderexample extends sprite
{
private var loader:urlloader;
public function urlloaderexample()
{
super();
var url:string = "https://www.jollysnaps.com/";
var request:urlrequest = new urlrequest(url);
var requestvars:urlvariables = new urlvariables();
request.data = requestvars;
request.method = urlrequestmethod.post;
loader = new urlloader();
loader.dataformat = urlloaderdataformat.text;
loader.addeventlistener(progressevent.progress, loading, false, 0, true);
loader.addeventlistener(event.complete, completed, false, 0, true);
loader.addeventlistener(httpstatusevent.http_status, httpstatushandler, false, 0, true);
loader.addeventlistener(securityerrorevent.security_error, securityerrorhandler, false, 0, true);
loader.addeventlistener(ioerrorevent.io_error, error, false, 0, true);
loader.load(request);
}
private function completed(e:event):void {
trace(e.target.data);
try {
var responsevars:object = json.parse(e.target.data);
} catch (err:error) {
trace(err.name + " " + err.message);
}
}
private function loading(e:progressevent):void {
if (e.bytestotal) {
trace((math.round((100 / e.bytestotal) * e.bytesloaded)).tostring() + "%" );
} else {
trace("file has no size" );
}
return;
}
private function httpstatushandler( e:httpstatusevent ):void {
trace("httpstatushandler:" + e.type);
return;
}
private function securityerrorhandler( e:securityerrorevent ):void {
trace("securityerrorhandler:" + e.text);
return;
}
private function error(e:ioerrorevent):void {
trace("error: " + e.text + " type: " + e.type);
return;
}
}
}
the code operates correctly running anywhere android, tracing content of file returned url request. code operated correctly old ssl certificate not new ssl certificate. fails error.
error: error #2032: stream error. url: https://www.jollysnaps.com/ type: ioerror
this missleading error code actualy happening android refusing make url request doesn't trust ssl certificate , not send data on untrusted link.
if url changed webserver real ssl certificate such as.
then code operates correctly.
so clear looking establish incompatible between ssl certificate site https://www.jollysnaps.com/ , urlloader running on android device can report web host because don't seem taking problem seriously.
thanks in advance
well turns out after looking @ post
i descovered solution.
the certificate had been changed
www.jollysnaps.com
to
jollysnaps.com
so whilst requests https://www.jollysnaps.com/ work fine in ios, blackberry , osx on android fail, requests https://jollysnaps.com/ work.
More discussions in Flex (Read Only)
adobe
Comments
Post a Comment