Opened 5 years ago
Closed 5 years ago
#31432 closed Cleanup/optimization (wontfix)
Conform to HTTP Status Code RFC's redirect classes.
Reported by: | Jacob Stöhr | Owned by: | nobody |
---|---|---|---|
Component: | HTTP handling | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hello,
while filing (and trying to fix) #31430 I noticed that the class HttpResponsePermanentRedirect
in django.http.response has its status_code
set to 301
.
According to the http
python module and more specifically RFC 7238 (https://tools.ietf.org/html/rfc7238) the name PermanentRedirect
is used to describe the HTTP Status code 308
. 301
is called MovedPermanently
according to RFC 7231 (https://tools.ietf.org/html/rfc7231#section-6.4.2).
Therefore I propose to rename the class HttpResponsePermanentRedirect
to HttpResponseMovedPermanently
with a status code of 301
and to modify the existing class to have a status code of 308
. I am aware that this is backwards incompatible and will break 33 currently existing tests (I tested it real quick locally) and probably countless uses in tests. However I think it is important to comply with the official spec.
I would appreciate any feedback, I don't know who would be responsible for this kind of ticket so I cannot assign it directly.
If desired, I could probably come up with a patch or at least help with creating one.
Regards,
Jacob
Change History (1)
comment:1 by , 5 years ago
Component: | Uncategorized → HTTP handling |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Summary: | Conform to HTTP Status Code RFC's more closely (django.http.response redirect classes) → Conform to HTTP Status Code RFC's redirect classes. |
RFC 7238 is still experimental and as you already mentioned this change is strongly backward incompatible. Moreover 307/308 do not allow changing the request method from POST to GET. Deprecation process would be quite complicated. Please start a discussion on the DevelopersMailingList, we can re-open this ticket if we reach a consensus on a mailing list.
Related to #30582.