Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

ESP8266HTTPClient sets Content-Length even on empty GET-requests

Open dakhnod opened this issue 1 year ago • 1 comments

Basic Infos

  • [x] This issue complies with the issue POLICY doc.
  • [x] I have read the documentation at readthedocs and the issue is not addressed there.
  • [x] I have tested that the issue is present in current master branch (aka latest git).
  • [x] I have searched the issue tracker for a similar issue.
  • [x] If there is a stack dump, I have decoded it.
  • [x] I have filled out all fields below.

Platform

  • Hardware: ESP8266
  • Core Version:
  • Development Env: Any
  • Operating System: Any

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.

dakhnod avatar Oct 16 '24 22:10 dakhnod

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?

mcspr avatar Oct 18 '24 07:10 mcspr