Opened 2 months ago

Closed 8 weeks ago

Last modified 8 weeks ago

#35354 closed Cleanup/optimization (fixed)

Simplify ASGIRequest path handling.

Reported by: Carlton Gibson Owned by: Carlton Gibson
Component: HTTP handling Version: 5.0
Severity: Normal Keywords: asgi
Cc: Andrew Godwin Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Carlton Gibson)

Following the ASGI HTTP Connection Scope docs[0], the provided path is already the correct value that Django requires.

In combination with root_path, from which script_name is derived, the path_info variable is set.
It's then redundant to re-calculate path from script_name and path_info.

See also, a clarifying discussion on the ASGIref repo[1].

[0]: https://asgi.readthedocs.io/en/latest/specs/www.html#http-connection-scope
[1]: https://github.com/django/asgiref/issues/424

Change History (8)

comment:1 by Carlton Gibson, 2 months ago

Owner: changed from nobody to Carlton Gibson

comment:2 by Carlton Gibson, 2 months ago

Cc: Andrew Godwin added

comment:3 by Carlton Gibson, 8 weeks ago

Description: modified (diff)

comment:4 by David Smith, 8 weeks ago

Triage Stage: UnreviewedAccepted

comment:5 by Natalia Bidart, 8 weeks ago

Triage Stage: AcceptedReady for checkin

comment:6 by Carlton Gibson <carlton.gibson@…>, 8 weeks ago

Resolution: fixed
Status: assignedclosed

In bcd255cd:

Fixed #35354 -- Simplified ASGIRequest path handling.

Following the ASGI HTTP Connection Scope docs[0], the provided path
is already the correct value that Django requires.

In combination with root_path, from which script_name is derived,
the path_info variable is set. It's then redundant to
re-calculate path from script_name and path_info.

See also, a clarifying discussion on the ASGIref repo[1].

[0]: https://asgi.readthedocs.io/en/latest/specs/www.html#http-connection-scope
[1]: https://github.com/django/asgiref/issues/424

comment:7 by Carlton Gibson <carlton.gibson@…>, 8 weeks ago

In ca5cd3e3:

Refs #35354 -- Clarified FORCE_SCRIPT_NAME docs.

comment:8 by Natalia <124304+nessita@…>, 8 weeks ago

In 58061fd2:

[5.0.x] Refs #35354 -- Clarified FORCE_SCRIPT_NAME docs.

Backport of ca5cd3e3e8e53f15e68ccd727ec8fe719cc48099 from main

Note: See TracTickets for help on using tickets.
Back to Top