#37025: RemoteUserTest masks behavior difference between WSGI & ASGI for 
.headers
attribute
-------------------------------------+-------------------------------------
     Reporter:  Jacob Walls          |                    Owner:  Jacob
                                     |  Walls
         Type:  Bug                  |                   Status:  assigned
    Component:  contrib.auth         |                  Version:  5.2
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
  RemoteUserMiddleware               |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

 * summary:
     RemoteUserMiddleware.header does not correspond to request.META in the
     async path
     =>
     RemoteUserTest masks behavior difference between WSGI & ASGI for
     .headers attribute

Comment:

 Thanks Mykhailo and Sarah for the illuminating reviews. After checking the
 history, this is a regression in Django 5.2
 (50f89ae850f6b4e35819fe725a08c7e579bfd099) that was not caught in time for
 a backport. RemoteUserMiddleware's default `REMOTE_USER` value didn't work
 before that commit, but in fixing the default case, we broke (or "changed
 the semantic") of the custom header case.

 It was reported in time (#36300), but only as a "hunch", so it was closed
 as `needsinfo`. I'll reopen and aim to fix in Django 6.1 without a
 deprecation or a backport, but with a release note.

 I'll open a separate ticket for Mykhailo's finding about the sync path
 looking up the wrong header under ASGI. The prior PR of mine already had a
 fix for that incidental finding, but I'll start over. (To fix that, we'll
 end up needing a helper along the lines of #35971, which was opened for a
 totally unrelated reason.)

 [https://github.com/django/django/pull/21207 PR for test updates]

 I'd like to reframe this ticket to just fix the existing tests to show the
 problem more clearly. Then we can fix it when closing #36300.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/37025#comment:19>
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 visit 
https://groups.google.com/d/msgid/django-updates/0107019de46e2291-ba695819-0764-4cbf-a401-d6da92e93955-000000%40eu-central-1.amazonses.com.

Reply via email to