首页 > 解决方案 > Content-Length 标头出现多次,最多允许出现一次

问题描述

当我尝试通过以下链接进行连接时:

http://192.168.4.1/wifisave?s=asdasd&p=10001010101010&ip=192.168.1.202&gw=192.168.1.1&sn=255.255.255.0&email=new@test.com&pass=123456789&alarm=1

我收到以下错误

Content-Length 标头出现多次,最多允许出现一次。

即使正常的链接喜欢

http://192.168.1.200/anything

做事,

甚至认为它以前可以工作,我不知道最新版本的库的升级是否会影响到这一点,尝试降级但由于 null-safety 限制和其他 depandancy.. 代码行:

try {
String overAllLink='http://192.168.4.1/wifisave?s=asdasd&p=10001010101010&ip=192.168.1.202&gw=192.168.1.1&sn=255.255.255.0&email=new@test.com&pass=123456789&alarm=1';
    response = await http.get(Uri.parse(overAllLink));
  } catch (e) {
    print(e);
  }

编辑:当我尝试从 API 测试器中得到的服务器响应是

> Host: 192.168.4.1
> User-Agent: insomnia/2021.2.2
> Content-Type: multipart/form-data; boundary=X-INSOMNIA-BOUNDARY
> Accept: */*
> Content-Length: 25

| --X-INSOMNIA-BOUNDARY--

* We are completely uploaded and fine
* Mark bundle as not supporting multiuse

< HTTP/1.1 200 OK
< Content-Type: text/html
< Content-Length: 1210
< Content-Length: 1210 //second one.
< Connection: close

所以服务器似乎发送了两次 Content-Length,所以我该如何忽略或解决它,我的服务器是安装了 WiFiManger .16 库的 ESP8266。

标签: flutterdartesp8266arduino-esp8266

解决方案


好的,问题出在我的 ESP8266 服务器上,如问题中所述,它错误地发送了两次 Content-Length,在此处打开一个问题提到确实解决了问题,这要感谢库所有者。


推荐阅读