Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17167] iOS: HTTPClient does not support timeouts

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-06-19T19:46:36.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.3.0, Release 3.4.0
ComponentsiOS
Labelshttp, httpclient, module_network, parity, qe-testadded, timeout
ReporterPier Paolo Ramon
AssigneeVishal Duggal
Created2014-06-13T20:14:15.000+0000
Updated2014-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();

})();

Comments

  1. Pier Paolo Ramon 2014-06-13

    Oh, this is a parity issue too. On android it works flawlessly.
  2. Tony Lukasavage 2014-06-17

    i'm also seeing timeouts not firing on HTTPClient calls on ios using 3.3.0.v20140617102513 with a more complex example.
  3. Ingo Muschenetz 2014-06-17

    [~penrique] Update?
  4. Vishal Duggal 2014-06-18

    Probably an error in type conversion.
  5. Vishal Duggal 2014-06-18

    Pull pending master - https://github.com/appcelerator/titanium_mobile/pull/5815 3_3_X - https://github.com/appcelerator/titanium_mobile/pull/5816
  6. Samuel Dowse 2014-06-19

    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.

JSON Source