esp8266 / Arduino

ESP8266 core for Arduino
GNU Lesser General Public License v2.1
16.04k stars 13.33k forks source link

ESP8266HTTPClient sets Content-Length even on empty GET-requests #9200

Open dakhnod opened 1 week ago

dakhnod commented 1 week ago

Basic Infos

Platform

Settings in IDE

Problem Description

Due to this line, the HTTP client always sets the Content-Length header. I think this header should be omitted for GET-requests with a length of 0.

mcspr commented 1 week ago

Yup, RFC seems to imply we should not include it https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2 https://datatracker.ietf.org/doc/html/rfc7230#section-3.3

I would guess our client has a similar problem that Dart's one had at some point https://github.com/dart-lang/sdk/commit/6c254fab89adbeebfb616cdec497260db4cb7cf7

Do you have an example of a server that breaks with current behavior?