﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36332	Usage notes and examples for HttpRequest.path and HttpRequest.path_info in docs are mixed up	Kashemir001	Kashemir001	"Documentation for [https://docs.djangoproject.com/en/5.2/ref/request-response/#django.http.HttpRequest.get_full_path_info HttpRequest.get_full_path_info()] gives the returning value example:

{{{
Example: ""/minfo/music/bands/the_beatles/?print=true""
}}}

which implies that the script prefix part, here {{{/minfo}}}, is contained in the returning value of {{{HttpRequest.path_info}}}.

Now, docs for [https://docs.djangoproject.com/en/5.2/ref/request-response/#django.http.HttpRequest.path_info path_info itself] say:

{{{
For example, if the WSGIScriptAlias for your application is set to ""/minfo"", then ``path`` might be ""/minfo/music/bands/the_beatles/"" and ``path_info`` would be ""/music/bands/the_beatles/"".
}}}

which implies that prefix part is not contained in {{{HttpRequest.path_info}}}, but in {{{HttpRequest.path}}}. This contradicts previous example.

Looking at the [https://github.com/django/django/blob/main/tests/requests_tests/tests.py#L54 unit test] for the subject, prefix is actually expected to be included in {{{path_info}}}. Therefore, the correct example for [https://docs.djangoproject.com/en/5.2/ref/request-response/#django.http.HttpRequest.path_info path_info] should say:

{{{
For example, if the WSGIScriptAlias for your application is set to ""/minfo"", then ``path`` might be ""/music/bands/the_beatles/"" and ``path_info`` would be ""/minfo/music/bands/the_beatles/"".
}}}

The usage notes for both attributes should be updated as well, so both sections updated might look like:

{{{
``HttpRequest.path``
A string representing the path to the requested page, not including the scheme, domain, script prefix, or query string.

Example: ""/music/bands/the_beatles/""

Under some web server configurations, the portion of the URL after the host name is split up into a script prefix portion and a path info portion. The ``path`` attribute always contains the path info portion of the path, no matter what web server is being used. Using this instead of ``path_info`` can make your code easier to move between test and deployment servers.

For example, If the WSGIScriptAlias for your application is set to ""/minfo"", then ``path`` might be ""/music/bands/the_beatles/"" and ``path_info`` would be ""/minfo/music/bands/the_beatles/"".

``HttpRequest.path_info``
The ``path_info`` attribute contains the full path, including both the script prefix portion and the path info portion of the path, unlike the ``path`` attribute.

Example: ""/minfo/music/bands/the_beatles/""
}}}"	Cleanup/optimization	closed	Documentation	5.2	Normal	fixed	wsgi httprequest path_info		Ready for checkin	1	0	0	0	1	0
