http.get Parse Error,代码:'HPE_UNEXPECTED_CONTENT_LENGTH' [英] http.get Parse Error, code: 'HPE_UNEXPECTED_CONTENT_LENGTH'
问题描述
我有一个简单的节点脚本来处理家庭自动化API中的一些数据。一切正常,直到最后一次Node更新。现在,使用Node版本4.3.0或5.6.0,http模块给出了这个错误:
I have a simple node script to process some data from my home automation API. Everything worked fine till last Node update. Now, with Node version 4.3.0 or 5.6.0, the http module gives me this error:
{ [Error: Parse Error] bytesParsed: 193, code: 'HPE_UNEXPECTED_CONTENT_LENGTH' }
导致错误的API调用示例,它只返回一个数字(一个温度):
An example of the API call causing the error, it just returns one number (a temperature):
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 5
Content-Type: application/json
Transfer-Encoding: chunked
21.81
以及重现错误的代码:
And a code to reproduce an error:
const http = require("http");
const url = "http://127.0.0.1:8083/ZWaveAPI/Run/devices[11].instances[2].commandClasses[49].data[1].val.value";
http.get(url, (res) => {
// consume response body
res.resume();
}).on("error", (e) => {
console.log(e);
});
我认为与 CVE-2016-2216响应拆分漏洞,但我尝试运行脚本,并提到 - security-revert = CVE-2016-2216 标志,但它没有帮助。有什么想法吗?
I think that error related to the CVE-2016-2216 Response Splitting Vulnerability, but I tried to run the script with mentioned there --security-revert=CVE-2016-2216 flag and it didn't help. Any ideas?
推荐答案
我发现这个提交日志。问题似乎是 Content-Length
和传输编码:chunked
标题一起存在,
I find this commit log. The problem seems is Content-Length
and Transfer-encoding: chunked
headers exist together,
这篇关于http.get Parse Error,代码:'HPE_UNEXPECTED_CONTENT_LENGTH'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!