[TIMOB-17167] iOS: HTTPClient does not support timeouts
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2014-06-19T19:46:36.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 3.3.0, Release 3.4.0 |
| Components | iOS |
| Labels | http, httpclient, module_network, parity, qe-testadded, timeout |
| Reporter | Pier Paolo Ramon |
| Assignee | Vishal Duggal |
| Created | 2014-06-13T20:14:15.000+0000 |
| Updated | 2014-06-19T21:40:45.000+0000 |
Description
Save as
app.js, run the following code with node app.js to start the server.
*Expected behaviout*: the onerror callback is called.
*What happens*: the onload callback is called.
(function () {
if (typeof process !== 'undefined') {
require('http').createServer(function (req, res) {
setTimeout(function () {
res.end('Done');
}, 3e3);
}).listen(3000);
console.log('Server listening to port 3000');
return;
}
var client = Ti.Network.createHTTPClient({
onload: function (e) {
alert('Argh!');
},
onerror: function (e) {
alert('Timeout worked (probably)');
},
timeout: 100 // in milliseconds
});
client.open('GET', 'http://localhost:3000');
client.send();
})();
Oh, this is a parity issue too. On android it works flawlessly.
i'm also seeing timeouts not firing on HTTPClient calls on ios using 3.3.0.v20140617102513 with a more complex example.
[~penrique] Update?
Probably an error in type conversion.
Pull pending master - https://github.com/appcelerator/titanium_mobile/pull/5815 3_3_X - https://github.com/appcelerator/titanium_mobile/pull/5816
Verified fixed on: Mac OSX 10.9.3 Appcelerator Studio, build: 3.3.0.201406171619 Titanium SDK, build: 3.3.0.v20140619130123 Titanium CLI, build: 3.3.0-rc Alloy: 1.4.0-rc iOS Device: iPhone 5S (7.1.1) iOS Simulator: iPhone (7.1) Timeout is called and error alert is displayed. Closing.