我在MSIE8中遇到了一些奇怪的HTTP狀態碼問題。爲什麼MSIE 8報告12150的HTTP狀態碼?
我發送一個HTTP GET到以下網址:
/cgi-bin/objectBrowser/snap.pl?file_key=28
從小提琴手,我可以看到,我得到以下原始響應:使用以下
HTTP/1.1 302 Found
Date: Fri, 27 May 2011 20:24:38 GMT
Server: Apache/2.2.3 (Red Hat)
Connection: close
Content-Type: text/html; charset=ISO-8859-1
Content-Length: 61
Location: /cgi-bin/objectBrowser/workWithSnap.pl?snapKey=32
這是產生Perl:
print $cgi->header(-status => '302 Found');
print "Location: /cgi-bin/objectBrowser/workWithSnap.pl?snapKey=$snap_key\n\n";
我使用jQuery來訪問它,方法如下:
jQuery.ajax({
type : "GET",
url : "/cgi-bin/objectBrowser/file.pl?pmr=" + request.pmr
+ "&filename=" + request.filename,
statusCode : {
200 : function(file_info) {
if (file_info.status == "parsing") {
jQuery('div#updates').append('<div class="information">No snap yet, but file <i>has</i> been registered already.</div>');
jQuery('div#updates').append('<div class="waiting">Awaiting job completion...</div>');
jQuery.getJSON("/cgi-bin/objectBrowser/job.pl?file_key=" + file_info.file_key, function(job_info) {
poll_for_job_completion(job_info);
});
} else {
jQuery.ajax({
type : "GET",
url : "/cgi-bin/objectBrowser/snap.pl?file_key=" + file_info.file_key,
statusCode : {
302 : function(xhr) {
jQuery('div#updates').append('<div class="information">Redirecting to snap</div>');
alert("302: "+ xhr.responseText);
process_302(xhr.responseText);
}
}
});
}
},
302 : function(xhr) {
alert("302: "+ xhr.responseText);
process_302(xhr.responseText);
},
404 : register_file
}
});
最後,我有以下幾點,以幫助調試:
jQuery('body').ajaxComplete(function(e,a,o) {
console.log('Event: %o\nXHR: %o\nOptions: %o',e,a,o);
console.log(o.url);
console.log(a.status);
console.log(a.responseText);
});
這一切都在Firefox和Chrome的罰款,但在MSIE,在那裏我通常得到的302
狀態響應我snap.pl
的要求,我得到了12150
的答覆。我發現的最好成績是MSDN,這表明這是ERROR_HTTP_HEADER_NOT_FOUND
...但標題看起來不錯。
我無法弄清楚這裏有什麼問題......有人看到我可能忽略的任何東西嗎?
真是奇怪的問題。嘗試僅打印標題「Location ...」,但使用完整URL - http://example.com/cgi-bin ... – silex 2011-05-27 20:57:09