Titanium Community Questions & Answer Archive

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

TiMob 1.1: http-request => header "Connection: close" always!!!

Hi,

I would need that I can request to a webserver with the "Connection: keep-alive" http header… but Titanium is always sending "Connection: close"
even if I put the header for my self….

Could that be solved somehow?

— asked March 22nd 2010 by Marc Bender
  • 1.1
  • header
  • http
  • iphone
  • mobile
  • problem
0 Comments

3 Answers

  • I need to look into if this is something that can be configured on the HTTP stack. I think it might be. Do you have a webservice test case URL and client code we could use to test?

    — answered March 22nd 2010 by Jeff Haynie
    permalink
    0 Comments
  • I will check for webservice test-case…

    But at all, I checked normal browser traffic with charles-proxy… and a GET or a POST (HTTP 1.1) will always do a "Connection: keep-alive" … the response will do a "Connection: close"

    Titanium 0.8.2 does this correct… but I checked from 0.9 to 1.1 … does always send (request) with "Connection: close" ?!

    EDIT:

    I do a simple GET in Titanium… nothing special…
    Just listen to the http-traffic with a proxy (I use charles proxy) to visualize the requests and responses…. If you do so, you will see that when you call the same URL with a browser or with titanium the GET request headers are different in the "Connection: " header…. all browsers do "keep-alive" (also Titanium 0.8x) but Titanium 0.9x - 1.1 will do "Connection: close" in the request…

    Take a look at this:
    http://allseeing-i.lighthouseapp.com/projects/27881/tickets/45-persistent-connection-requires-keep-alive-header

    — answered March 22nd 2010 by Marc Bender
    permalink
    0 Comments
  • As I found out connections are by default persistent unless specified with the "Connection: close" header to the HTTP 1.1 RFC ….

    In the
    http://github.com/pokeb/asi-http-request/raw/master/Classes/ASIHTTPRequest.m
    you can see that in this newer version this will be handeled…. but I think you should not just switch to that version cause you will remember you implemented already some "bad webserver redirect" fixes in your version… :-)

    — answered March 23rd 2010 by Marc Bender
    permalink
    0 Comments
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.