symfony: Automatic content length in Reponse::send() can break some responses

Symfony version(s) affected

6.1

Description

Drupal’s Big Pipe module does some custom chunking of responses.

After https://github.com/symfony/http-foundation/commit/38a3244eb0c33fbb9ce87da1677cbbde488c3750 a content length is automatically added to the response, which breaks the page.

We can workaround this by doing an explicit $this->headers->set('Transfer-Encoding', ''); and might be able to come up with something better in the future, however thought it was worth opening an issue just to document the behaviour change, since it’s not impossible other projects are doing something weird like us.

How to reproduce

More discussion on the Drupal.org issue https://www.drupal.org/project/drupal/issues/3276186

To reproduce, install Drupal core, update Symfony to 6.1, enable big pipe module.

Possible Solution

No response

Additional Context

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 30 (21 by maintainers)

Commits related to this issue

Most upvoted comments

@qdequippe Apache as well, with GZIP compression enabled, just as you. @nicolas-grekas I am currently setting up the Symfony demo app on my server, I will keep you posted. ^^

Let’s make it easier: I’m proposing to revert #45092 in #46523

@stof according info we have on https://phpfpm81.webhosting-infos.hosting.ovh.net output compression is off. I will open a ticket on OVH side for more details.

Can you share a small Symfony app that exhibits this behavior behind apache?

I have maybe related (or same) problem after upgrading my Symfony project to 6.1. I got net::ERR_HTTP2_PROTOCOL_ERROR 200 error in my browser console (Chrome). It appears on the homepage on my website, only a part of the page is rendered.

Using workaround $response->headers->set('Transfer-Encoding', ''); fixed the error.