Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2589] Major Regression in Android SDK 1.5 HttpClient

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:59:32.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.1 M01
ComponentsAndroid
Labelsandroid, defect, httpclient, regression, reported-1.5.0
ReporterRyan Asleson
AssigneeDon Thorp
Created2011-04-15T03:23:43.000+0000
Updated2011-04-17T01:59:32.000+0000

Description

Hello,

I have built an Android application that uses extensive use of HttpClient to contact a remote server. The application is stable and I haven't changed any of the networking code in quite a while.

I'm eager to use the new Android features in the 1.5 SDK. After upgrading to the 1.5 SDK my application can no longer talk to the client using HttpClient.

The remote server is Tomcat. Because of ticket #968, I can't rely on the jsessionid cookie to be properly utilized by HttpClient, so to get around it, I append the jsessionid to the end of the URL as necessary. Something this:

/someurl.action;jsessionid=123456

This all worked correctly and without fail until I upgraded to the 1.5 SDK. Now, when the jsessionid is appended to the URL, Tomcat throws a 404 error with this in the error message:

The requested resource (/mwf/mobile/home/Home.action%3Bjsessionid%3D9498648CA1E54C6743AA5723276EBF51) is not available.

You can see in the error message that the semicolon before jsessionid was URL encoded, as was the equals sign after jsessionid. I don't know for sure, but I assume that pre 1.5 these characters were NOT encoded.

This is a show stopper bug for me. Due to ticket #968 I can't rely on the jsessionid cookie, and the work around of appending jsessionid to the URL is now failing too. My app effectively cannot contact the server since the session ID cannot be passed along. Maybe Tomcat is pickier than other servers, but I can't just up and change servers especially when it worked before.

Could you please investigate?

Thank you and keep up the great work on Appcelerator Titanium!!!

-Ryan

Comments

  1. Bill Dawson 2011-04-15

    For QA, a simple app.js:

       var xhr = Ti.Network.createHTTPClient();
       xhr.autoEncodeUrl = false;
       xhr.open('GET','http://www.appcelerator.com/x/y/z;jsessionid=ABCD');
       if (xhr.location.indexOf(';jsession')<0) {
           alert('FAIL.  Cannot find ";jsessionid" in location url: ' + xhr.location);
       } else {
           alert('SUCCESS.  Found ";jsessionid" in location url: ' + xhr.location);
       }
       
  2. Bill Dawson 2011-04-15

    (from [bcdf46569b53be86fc029577ec5147abda6a6c17]) [#2589 state:fixed-in-qa][#1491] Add autoEncodeUrl property to HTTPClient (default=true, thus preserving current behavior). Setting to false means your url will remain untouched. Add drillbit unit tests. https://github.com/appcelerator/titanium_mobile/commit/bcdf46569b53be86fc029577ec5147abda6a6c17"> https://github.com/appcelerator/titanium_mobile/commit/bcdf46569b53...

  3. Bill Dawson 2011-04-15

    Currently the change (.autoEncodeUrl property,which can be set to false to avoid auto-encoding) is only on master branch. If QA sets to resolve and Ralf agrees, we can cherry-pick to 1_5_X.

  4. Bill Dawson 2011-04-15

    For Ryan, an example of using it:

       var xhr = Titanium.Network.createHTTPClient;
       xhr.autoEncodeUrl = false; // do this before calling .open()
       xhr.open('GET', 'http://myhost.com/someurl.action;jsessionid=123456');
       xhr.send();
       
  5. Ryan Asleson 2011-04-15

    Awesome, thank you so much!! I'm eager for the next release.

  6. Bill Dawson 2011-04-15

    (from [fbc043377a7e44753497c3ec0c9979c0cb53b359]) [#2589 state:fixed-in-qa][#1491] Add autoEncodeUrl property to HTTPClient (default=true, thus preserving current behavior). Setting to false means your url will remain untouched. Add drillbit unit tests. https://github.com/appcelerator/titanium_mobile/commit/fbc043377a7e44753497c3ec0c9979c0cb53b359"> https://github.com/appcelerator/titanium_mobile/commit/fbc043377a7e...

  7. Bill Dawson 2011-04-15

    This is now in the 1_5_X branch, ready for interim release.

  8. Thomas Huelbert 2011-04-15

    Bill, using your code snippet I get the fail condition on a g1 (1.6) and using the sim (2.2)
    [INFO] Titanium SDK version: 1.5.1 (12/15/10 08:16 1a59cc3)

    user error on my part?

  9. Bill Dawson 2011-04-15

    1a59cc3 is before my commit. I'm the commit after that.

  10. Thomas Huelbert 2011-04-15

    damnit. sorry Bill, checked in G1 (1.6) and sim (2.2) looks good. [INFO] Titanium SDK version: 1.5.1 (12/15/10 16:41 fbc0433)

JSON Source