[Django] #31432: Conform to HTTP Status Code RFC's more closely (django.http.response redirect classes)

3 peržiūros
Praleisti ir pereiti prie pirmo neskaityto pranešimo

Django

neskaityta,
2020-04-06 11:40:302020-04-06
kam: django-...@googlegroups.com
#31432: Conform to HTTP Status Code RFC's more closely (django.http.response
redirect classes)
------------------------------------------------+------------------------
Reporter: Jacob Stöhr | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
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

--
Ticket URL: <https://code.djangoproject.com/ticket/31432>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

neskaityta,
2020-04-06 12:35:552020-04-06
kam: django-...@googlegroups.com
#31432: Conform to HTTP Status Code RFC's redirect classes.
-------------------------------------+-------------------------------------

Reporter: Jacob Stöhr | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: HTTP handling | Version: master
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => wontfix
* component: Uncategorized => HTTP handling


Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/31432#comment:1>

Atsakyti visiems
Atsakyti autoriui
Persiųsti
0 naujų pranešimų