Only set content-length header in specific situations

Created on 25 October 2023, about 1 year ago
Updated 16 January 2024, 11 months ago

Problem/Motivation

πŸ› Post-response task running (destructable services) are actually blocking; add test coverage and warn for common misconfiguration Fixed adds a content-length header to most responses coming from Drupal. It needs to be adjust due the expectations laid in https://www.rfc-editor.org/rfc/rfc9110.html#name-content-length. Among these are:

  • For HEAD requests content-length should be equal to the equivalent GET request - tested this and it works so that's good.
  • 1xx and 204 cannot have a content length header
  • 304s has a complex rule about being the same as a 200

Also there are some other things we should account for based on the issues we had when Symfony set a content-length header on everything. See https://github.com/symfony/symfony/issues/46449.

  • No content-length header when the transfer-encoding header is set.
  • No content-length header when $response->getContent() returns FALSE.

Lastly we should not add the header to 500s as this causes issues with if there is an error during batch processing.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

πŸ› Bug report
Status

Fixed

Version

10.2 ✨

Component
Request processingΒ  β†’

Last updated about 8 hours ago

No maintainer
Created by

πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024