From 1085e5e17b7403b15c4eff397f3c98c15660f46d Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Fri, 1 May 2026 12:20:28 -0400 Subject: Fixed #36300 -- Restored the semantic where RemoteUserMiddleware.header corresponds to request.META under ASGI. Because these tests always passed both WSGI environ values and HTTP headers via `**extra`, this masked a behavior difference between WSGI and ASGI. What should happen: everything should be passed via `headers` but for the default REMOTE_USER case on WSGI, which should be passed via `**extra`. Since that was not done, a regression made it into Django 5.2 (50f89ae850f6b4e35819fe725a08c7e579bfd099) where `.header` no longer corresponded to the request.META key under ASGI. To cope, an ASGI user would have started(*) sending HTTP headers that match the `.header` attribute, which may or may not have been edited to remove the HTTP_ prefix. (Note: the default `REMOTE_USER` case did not work under ASGI, so the change in Django 5.2 had the effect of fixing the default case but changing the semantic of the custom case.) (*): Unless they were getting the sync execution path, which didn't have this bug. See the fix in 0f4fff79d33b7cc84822e66bd1fc16caf8222e3a. Thanks Mykhailo Havelia and Sarah Boyce for reviews. --- docs/releases/6.1.txt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'docs') diff --git a/docs/releases/6.1.txt b/docs/releases/6.1.txt index 7af3c6af72..50e4f63f5e 100644 --- a/docs/releases/6.1.txt +++ b/docs/releases/6.1.txt @@ -467,6 +467,15 @@ backends. * The undocumented ``InclusionAdminNode.__init__()`` now takes the template tag ``name`` as the first positional argument. +:mod:`django.contrib.auth` +-------------------------- + +* Under ASGI, :class:`~django.contrib.auth.middleware.RemoteUserMiddleware` no + longer prefixes ``HTTP_`` when looking up custom values in ``request.META``. + For example, to send ``-H "AuthUser": ...``, the ``header`` attribute should + be ``HTTP_AUTHUSER``. This restores the behavior prior to Django 5.2. (The + default value of ``REMOTE_USER`` is not affected.) + :mod:`django.contrib.gis` ------------------------- -- cgit v1.3