I am testing a webpage on Android 2.0 and 2.2 emulators, and the jQuery.ajax () requests that the application makes have slightly different behavior in the HTTP Authentication headers.
The server I'm making requests to requires basic authentication, and the ajax requests in 2.2 send the correct auth header. In 2.0, I am debugging Fiddler, and it seems that the requests do not include the auth header, and the server rejects the request with error 401.2. I do not think this is important, but IIS 7 is running on the server.
One interesting thing that I noticed when debugging web requests is that Android 2.2 makes two requests for each resource, regardless of whether it is XHR. One does not contain the Auth header, and the second does not. In 2.0, it seems to make 2 requests for everything except XHR:
Here is the 2.2 heading for the first XHR:
GET http://192.168.1.111/sonar/mobileweb/sonar/views/week/init.ejs HTTP/1.1
Host: 192.168.1.111
Accept-Encoding: gzip
Referer: http://192.168.1.111/sonar/mobileweb/sonar/sonar.html
Accept-Language: en-US
User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; en-us; sdk Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Accept: text/plain, */*
X-Requested-With: XMLHttpRequest
Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7
Header 2.2 for the second XHR:
GET http://192.168.1.111/sonar/mobileweb/sonar/views/week/init.ejs HTTP/1.1
Host: 192.168.1.111
Accept-Encoding: gzip
Referer: http://192.168.1.111/sonar/mobileweb/sonar/sonar.html
Accept-Language: en-US
User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; en-us; sdk Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Authorization: Basic cGFyaXZlZGFcZGF2aWQubW9ycmlzOjIzbkx2ZWxsbGw=
Accept: text/plain, */*
X-Requested-With: XMLHttpRequest
Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7
And header 2.0:
GET http://192.168.1.111/app/views/week/init.ejs HTTP/1.1
Host: 192.168.1.111
Accept-Encoding: gzip
Referer: http://192.168.1.111/app/app.html
Accept-Language: en-US
User-Agent: Mozilla/5.0 (Linux; U; Android 2.0; en-us; sdk Build/ECLAIR) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17
Accept: text/plain, */*
X-Requested-With: XMLHttpRequest
Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7
Has anyone experienced this behavior before? Basically, this leads to the fact that my application does not work at all in version 2.0. Version 2.1 seems to act the same as 2.0.
Let me know if you have any ideas, thanks for your help,
Dave