I'm testing out a web page on the Android 2.0 and 2.2 emulators, and
some of the jQuery.ajax() requests that the app makes have slightly
different behaviors regarding HTTP Authentication Headers.

The server I'm making requests to requires basic authentication, and
the ajax requests in 2.2 send the proper auth header. In 2.0, I am
debugging with Fiddler, and it seems that the requests do not include
the auth header, and the server rejects the request with a 401.2
error. I don't think it matters, but the server is running IIS 7.

One interesting thing I noticed while debugging the web requests is
that Android 2.2 makes two requests for each resource, whether or not
it's an XHR. One does not contain the Auth header, and the second one
does. In 2.0, it seems to make 2 requests for everything but XHR's:


Here is the 2.2 header 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


The 2.2 header 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 the 2.0 header:

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


Notice that 2.0 (and 2.1) only makes the first request, recieves the
401 challenge, and then does not make the second request with the
proper auth header.

Has anyone experienced this behavior before? It is basically causing
my app to 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

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to