[AC-2902] HTTPClient and random ASIHTTPRequestErrorDomain
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Needs more info |
Resolution Date | 2011-06-10T04:15:12.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | HTTPClient, ios |
Reporter | Romain |
Assignee | Tony Guntharp |
Created | 2011-05-21T05:05:24.000+0000 |
Updated | 2016-03-08T07:47:52.000+0000 |
Description
Since a few time, I use to have this issue with my requests:
Error: {
"source":{},
"type":"error",
"error":"Error Domain=ASIHTTPRequestErrorDomain Code=2 \"The request
timed out\" UserInfo=0x403e40 {NSLocalizedDescription=The request timed out}"
}
And sometimes, this one (but I don't think it's related to the issue):
Error: {
"source":{},
"type":"error",
"error":"Error Domain=ASIHTTPRequestErrorDomain Code=1 \"A connection
failure occurred\" UserInfo=0x51ba60 {NSUnderlyingError=0x559cfc0
\"The operation couldn't be completed. Operation timed out\",
NSLocalizedDescription=A connection failure occurred}"
}
But something strange happens: if I immediately send after a request the same one (that's to say: I don't even wait for the answer of the first one, I IMMEDIATELY send the other one): the first one fails as expected (after the timeout) meanwhile the second works (before the timeout of the first one)!
This issue used to happen sometimes.
But at the beginning of the week, I have created a request which send an image to my server (the image comes from the camera: e.media):
var params = { image: e.media };
var xhr = Ti.Network.createHTTPClient();
xhr.setTimeout(someTimeout); // usually: 30000
xhr.onload = someOnloadFunction;
xhr.onerror = someOnerrorFunction;
xhr.open('POST', url);
xhr.setRequestHeader('Accept', 'application/json');
xhr.send(params);
And if I do the same thing than before: this request fails each time for the first try but not for the second!
I also tried to create as the first request the same than the second but without any parameter (so, no image: I just specify the URL and the method). And I have the same result (fail for the first, success for the second).
Any idea why? I really need a solution because I can't do anything if my requests don't work as expected :/
If it can help, I use ruby on rails on Heroku as a server.
Thanks in advance
In order for us to progress this issue, please edit your ticket to include a proper [Use-case](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-CreatingGoodUsecases). Also kindly read the [Submitting Bug Reports](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-SubmittingBugReports) guide before raising tickets. Thank you
No response from user after request for information. Marking resolved / incomplete.
Closed after 30 days of inactivity.