Project: titanium
Issue TIMOB-2801: iOS: HTTPClient intermittently errors on HTTPS requests
{html}

Problem

The HTTPClient errors intermittently (around half the time) when making an HTTPS request. The following error message is sent:

Error Domain=ASIHTTPRequestErrorDomain Code=1 "A connection failure occurred" UserInfo=0xb236b70 {NSUnderlyingError=0xb234cf0 "The operation couldn’t be completed. Connection reset by peer", NSLocalizedDescription=A connection failure occurred}

Tested On

All platforms tested with clean builds from both Titanium Mobile 1.5.1 and 1.6.0 (pulled January 8th, 2011).
BROKEN on iPhone Simulator 4.2
BROKEN on iPod Touch 4.2
WORKS on Android Simulator 2.2
WORKS in browser (hitting the URL)

Sample Code

var win = Titanium.UI.createWindow({ backgroudColor: '#333' }); var statusLabel = Titanium.UI.createTextArea({ top: 10, right: 10, left: 10, bottom: 45 }); win.add(statusLabel); function runRequest() { var xhr = Titanium.Network.createHTTPClient(); xhr.onload = function () { statusLabel.value = this.responseText; //Ti.API.info(this.responseText); }; xhr.onerror = function (e) { statusLabel.value = e.error; Ti.API.error(e.error); }; statusLabel.value = 'Waiting for response...'; xhr.open('GET', 'https://acomsx1.cos.agilent.com/QueryOpenNotificationsCount'); xhr.send(); } var refresh = Ti.UI.createButton({ title: 'Refresh', bottom: 10, left: 10, right: 10, height: 25 }); refresh.addEventListener('click', runRequest); win.add(refresh); win.open(); runRequest();

Associated Helpdesk Ticket

http://developer.appcelerator.com/helpdesk/view/64561

{html}
Story points: 2