Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-519] problem with this in callbacks for XHR

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:53:22.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0 M04
ComponentsiOS
Labelsios, iphone, xhr
ReporterJeff Haynie
AssigneeJeff Haynie
Created2011-04-15T02:30:51.000+0000
Updated2011-04-17T01:53:22.000+0000

Description

http://support.appcelerator.net/discussions/support/1990-getresponseheader-for-set-cookie"> http://support.appcelerator.net/discussions/support/1990-getrespons...

looks like this.responseHeader isn't getting correctly dispatched through this pointer proxy.

Comments

  1. Brion Vibber 2011-04-15

    Sample code to reproduce:

       var client = Titanium.Network.createHTTPClient();
       client.onload = function() {
           Titanium.API.info("Loaded! Status: " + this.status);
       
           var contentType = this.getResponseHeader('Content-Type');
           Titanium.API.info("Content-Type: " + contentType);
       };
       client.open("GET", "http://example.com/");
       client.send();
       

    got on iphone:
    [INFO] Loaded! Status: 200 [INFO] Content-Type: null <- BROKEN

    got on android:
    I/TiAPI (11249): (kroll$1) [23,606] Loaded! Status: 200
    I/TiAPI (11249): (kroll$1) [13,619] Content-Type: text/html; charset=UTF-8 <- fine

  2. Brion Vibber 2011-04-15

    Several related issues also mentioned on https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobile/tickets/1502-httpclient-problems-with-header-parsing-and-responsedata-in-onerror-handler"> https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobi...

  3. Jake Howerton 2011-04-15

    Isn't this somewhat critical? Does anyone have a patch for it?

  4. Jeff Haynie 2011-04-15

    (from [074c3e8c9cd6bc80af9ca53256a23ba24d1e09dc]) [#519 state:fixed-in-qa] Set response headers correctly in HTTP response. https://github.com/appcelerator/titanium_mobile/commit/074c3e8c9cd6bc80af9ca53256a23ba24d1e09dc"> https://github.com/appcelerator/titanium_mobile/commit/074c3e8c9cd6...

  5. Pedro Enrique 2011-04-15

    Just checked the sample code provided by Brion Vibber against 1.5 on simulator with the following address:
    http://developer.appcelerator.com/apidoc/mobile/1.4/api.json">http://developer.appcelerator.com/apidoc/mobile/1.4/api.json

    The console returs:
    [INFO] Loaded! Status: 200 [INFO] Content-Type: text/json

    Ticket resolved

  6. Conrad 2011-04-15

    Using mobile sdk 1.6.1 and iOS (any version), this problem persists depending on which version of Apache is running on the server. Is there any way to collect the raw headers and parse them myself? I believe getAllHeaders is not supported in iOS still.

JSON Source