HTTP状态代码0 - 这对fetch或XMLHttpRequest意味着什么? [英] HTTP status code 0 - what does this mean for fetch, or XMLHttpRequest?

查看:1329
本文介绍了HTTP状态代码0 - 这对fetch或XMLHttpRequest意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于JavaScript网络调用fetch,XMLHttpRequest和MS XMLHTTP的返回码0,我有一个使用标准MS XMLHTTP COM对象的HTA(Microsoft HTML应用程序 - 离线HTML + JavaScript应用程序)( Microsoft.XMLHTTP Msxml2.XMLHTTP 取决于检测到的版本),通过JavaScript代码将一些数据发送回服务器。

Regarding return code 0 for JavaScript network calls fetch, XMLHttpRequest, and MS XMLHTTP, I have an HTA (Microsoft HTML application - offline HTML + JavaScript application) that is using the standard MS XMLHTTP COM object (Microsoft.XMLHTTP or Msxml2.XMLHTTP depending on version detected) via JavaScript code to send some data back to the server.

它返回状态码0.这显然不是有效的HTTP状态代码(根据官方规范它们应该是三位数)。 (顺便说一句,我尝试拔掉网络连接并获得状态代码17003或其他东西,我认为从很多谷歌搜索意味着DNS服务器查找失败。)

It is returning status code 0. This is apparently not a valid HTTP status code (they should be three digits according to the official specification). (BTW, I tried unplugging the network connection and got status code 17003 or something, which I think from a lot of googling means "DNS server lookup failed".)

它对我和其他一些从不同地点进行过测试的人来说效果很好。但是,我已将此发送到客户端,并且他们已收到HTTP状态代码为零,并且HTTP responseText为空。客户端已在两个位置尝试过,但都在公司网络内。

It works fine for me and some other people who have tested it from different locations. However, I have sent this over to the client and they have recieved an HTTP status code of zero, and the HTTP responseText is blank. The client has tried it from two locations but both within their corporate network.

这是Internet上HTTP URL的HTTP POST(不是file://请求)我理解也将在Mozilla下返回状态代码0以获得成功)。我很确定这是一个失败代码,因为它应该返回一些确认为 responseText ,而且我们没有将数据记录在数据库中。

This is an HTTP POST to an HTTP URL on the Internet (not a file:// request which I understand also would return status code 0 for success under Mozilla). I'm pretty sure this is a failure code as it should return some confirmation as the responseText, and we are not getting the data recorded in the database.

推荐答案

我认为错误代码表明响应是空的(因为甚至没有返回标题)。这意味着连接已被接受,然后正常关闭(TCP FIN)。
有很多事情可能导致这种情况,但根据你的描述,某种形式的防火墙似乎是最可能的罪魁祸首。

I believe the error code indicates that the response was empty, (as not even headers were returned). This means the connection was accepted and then closed gracefully (TCP FIN). There are a number of things which could cause this, but based off of your description, some form of firewall seems the most likely culprit.

这篇关于HTTP状态代码0 - 这对fetch或XMLHttpRequest意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆