HTTPS request returning 2032 Stream Error only for

2019-02-23 20:05发布

问题:

I have a mobile app that I targeted for iOS and Android. It makes a login request via HTTPS (using a POST with HTTPService)..Everything works fine while debugging on my development box via ADL and when compiled and tested on iOS 4.2 and iOS 5.

The Android devices also work correctly when making HTTPS requests to other domains, like Twitter, etc. from within my test app or in the device's browser.

I only have a couple of test Android devices and they're running 2.3.3 but none will make a successful connection. While debugging via USB, I can see that the HTTPService call is returning a FaultEvent with IOErrorEvent #2032.

After researching, I found that Android OS has some issues with certain SSL certificates, and the issuer thats being used on the server is 'VeriSign Class 3 International Server CA - G3' but I haven't really found any viable workarounds/solutions. Has anyone else encountered this? I know its pretty specific.

Just wanted to add that an HTTP Status code of 0 is being returned immediately before the ioErrorEvent 2032 is being dispatched. I've checked Adobe's API docs for the HTTPStatusEvent and 0 seems to be a default. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/HTTPStatusEvent.html

HTTPStatusEvent objects are always sent before error or completion events. An HTTPStatusEvent object does not necessarily indicate an error condition; it simply reflects the HTTP status code (if any) that is provided by the networking stack. Some Flash Player environments may be unable to detect HTTP status codes; a status code of 0 is always reported in these cases. Just wanted to add additional findings...through testing we were able to use that same certificate on another server - and despite security warnings, I was able to get data on my test Android device. This makes me think that the issue may be related to the server....It's hosted by Rackspace so we're going to reach out to them to attempt more troubleshooting.

回答1:

I was having the same problem, Stream error 2032 on https: requests, and was able to resolve it by upgrading to a newer AIR runtime. I had noticed the error occurring on one test device and not the other, the main difference being that the one with errors had AIR 3.1 installed, the one without errors had AIR 3.2.

We are now packaging the app with captive AIR runtime (version 3.3). Since FlashBuilder came with AIR 3.1 pre-installed, it was necessary to download a new AIR SDK and overlay it on FlashBuilder.



回答2:

Different virtual flash viewers resolve errors like this differently based on the platform. Best thing to do would be to apply a bunch of error handlers and see what results.

I'm going to quote an entire "solution" from this long-running google search result: http://www.judahfrangipane.com/blog/2007/02/15/error-2032-stream-error/

Try listening for the HTTP_STATUS Event, then adding event handlers for all the error-types to get a more granular level of response.

Example:

public function doRequest(url:String = "http://www.example.com/page.php?something=whatYouWant"):void {
   var fileRequest:URLRequest = new URLRequest(url);
   var myLoader:URLLoader = new URLLoader();

   myLoader.addEventListener(Event.COMPLETE, onLoaderReady);

   myLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, function(evt:Object):void{handleError(evt,"HTTPStatusEvent.HTTP_STATUS");});
   myLoader.addEventListener(IOErrorEvent.IO_ERROR, function(evt:Object):void{handleError(evt,"IOErrorEvent.IO_ERROR");});
   myLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function(evt:Object):void{handleError(evt,"SecurityErrorEvent.SECURITY_ERROR");});
   myLoader.load(fileRequest);
}
private function handleError(evt:Object , listenerType = "Anonymus"):void{
   trace('handleError listenerType '+listenerType+'\nError: '+evt);
}

Since it's Android specifically, make sure that you add the proper "permissions" for it to use the Internet, detect connections, etc. in the Manifest file:

<android>
    <manifestAdditions><![CDATA[
    <manifest>
        <!-- See the Adobe AIR documentation for more information about setting Google Android permissions -->
        <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
        <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    </manifest>
]]></manifestAdditions>
  </android>


回答3:

Very odd. Ended up having to setup a proxy to get this working.



回答4:

I've just experienced this issue on Android using AIR 25.0.0.134. IOS and Desktop had no issues using the same code.

I discovered the issue was that the URL I was using had extra (invisible) characters. i.e. %A0

The solution was to escape the url and remove all instances of %A0, then unescape and continue to download the file.

var url:String = String(escape(ev.target.data)).replace(/%0A/gi, ""); 
downloadThisFile(unescape(url));