XHR,Windows Phone 8.1&丢失授权标头

时间:2015-06-05 10:20:20

标签: javascript cordova windows-phone-8 xmlhttprequest tin-can-api

对于Windows手机上的XHR(8.1,Lumia 925),我有一种奇怪的行为。

我正在使用javascript库来执行一些XHR请求(Tin Can JS库),并且它对外部URL执行PUT设置一些标头。 如果我在IE11上运行与网页完全相同的代码,请求会发送以下标题:

Accept: */*, referer: http://169.254.80.80:8080/dest/
Authorization: Basic YTQwMTlhY2VlZTAyNTNmYjE4N2Q1ZTEwN2FiMWZhYWU5MmE5ZTk4YjozMWQ3OWZkMWI0NzU1OGMyNDdiMTlmNTVlN2VhZTgzNzNiNTk5NDBl, referer: http://169.254.80.80:8080/dest/
X-Experience-API-Version: 1.0.1, referer: http://169.254.80.80:8080/dest/
Content-Type: application/json, referer: http://169.254.80.80:8080/dest/
Referer: http://169.254.80.80:8080/dest/, referer: http://169.254.80.80:8080/dest/
Accept-Language: en-GB, referer: http://169.254.80.80:8080/dest/
Origin: http://169.254.80.80:8080, referer: http://169.254.80.80:8080/dest/
Accept-Encoding: gzip, deflate, referer: http://169.254.80.80:8080/dest/
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko, referer: http://169.254.80.80:8080/dest/
Host: testsrv.greenteam.it, referer: http://169.254.80.80:8080/dest/
Content-Length: 568, referer: http://169.254.80.80:8080/dest/
DNT: 1, referer: http://169.254.80.80:8080/dest/
Connection: Keep-Alive, referer: http://169.254.80.80:8080/dest/
Cache-Control: no-cache, referer: http://169.254.80.80:8080/dest/

如果我在Windows Phone上运行它,由Cordova包装,这些是标题:

Connection: Keep-Alive
Content-Length: 568
Reverse-Via: SRVGATEWAY
Content-Type: application/json
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 925)
Host: testsrv.greenteam.it
Accept: */*
X-Experience-API-Version: 1.0.1
Accept-Language: en-US,en;q=0.8,it-IT;q=0.5,it;q=0.3
UA-CPU: ARM
Cache-Control: no-cache

特别缺少的是Authorization标头。我通过console.log进行了检查,并且即使在Windows手机上也执行了相应的xhr.setRequestHeader,但似乎标题被丢弃或被忽略。

我无法找到导致此问题的原因或解决方法。

0 个答案:

没有答案