#34989: Set Content-Length where possible for HttpResponses.
-------------------------------------+-------------------------------------
     Reporter:  Jeppe Fihl-Pearson   |                    Owner:  Anders
         Type:                       |  Kaseorg
  Cleanup/optimization               |                   Status:  new
    Component:  HTTP handling        |                  Version:  4.2
     Severity:  Normal               |               Resolution:
     Keywords:  CommonMiddleware     |             Triage Stage:  Accepted
  uWSGI                              |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Florian Apolloner):

 I have been digging a bit more in the RFC and I think setting the
 `Content-Length` to `0` is actually preferred since it indicates that
 there is really no content (which a redirect is allowed to have).

 See https://www.rfc-editor.org/rfc/rfc9110#field.content-length:
 > Aside from the cases defined above, in the absence of Transfer-Encoding,
 an origin server SHOULD send a Content-Length header field when the
 content size is known prior to sending the complete header section. This
 will allow downstream recipients to measure transfer progress, know when a
 received message is complete, and potentially reuse the connection for
 additional requests.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34989#comment:13>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018c88797ea2-d41ca168-6ead-49ad-9068-95e99d8164fd-000000%40eu-central-1.amazonses.com.

Reply via email to