Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Cookies problem

I have a problem when I try to get the cookies from the response header in the Titanium.Network.HTTPClient.

I use the following code:

var xhr = Titanium.Network.createHTTPClient();

var cookies = xhr.getResponseHeader("Set-Cookie");

and what I get is:

ASP.NET_SessionId=ir66445hj76y9fu9bx; path=/; HttpOnly

The ASP.Net_Session is only a part of the "Cookie" header, and the rest is missing.

I haven't set the HttpOnly flag to the cookies.

What is wrong?

Thanks in advance,

m.

— asked August 3rd 2010 by m.
  • cookie
  • cookies
  • getresponseheader
  • titanium.network.httpclient
1 Comment
  • After almost one year, problem still exists. Only first cookie is accessible.

    — commented June 16th 2011 by Anton Kolenkov

1 Answer

  • Looking at the app source code I have found (in TiHTTPClient.java) that the "getResponseHeader" function seems to return only the first header:

    Header h = response.getFirstHeader(header);

    I don't understand why it is done this way.

    Could someone from the appcelerator support check whether it is a bug or not?

    Thanks,

    m.

    — answered August 5th 2010 by m.
    permalink
    4 Comments
    • this is a known issue link to bug report is here: http://jira.appcelerator.org/browse/TIMOB-2849

      — commented June 24th 2011 by Joel Herron
    • Anyone have a hint on how to patch this? I really need this working now, and find it curious that this thread is a year old, and recent notes on TIMOB-2849 don't indicate any movement. Thanks

      — commented July 12th 2011 by karlo kilayko
    • +1 we need this, we are not able to handle multiple Set-Cookies because of this.

      — commented October 30th 2011 by Amit Soni
    • +1 Has this been solved now?

      — commented December 15th 2011 by Sharry Stowell
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.