Opened 4 years ago

Closed 4 years ago

#25368 closed Cleanup/optimization (invalid)

Rename X_CSRFTOKEN to X-CSRFTOKEN

Reported by: Belegnar Owned by: nobody
Component: CSRF Version: 1.8
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

Is it possible to rename X_CSRFTOKEN to X-CSRFTOKEN at middleware/csrf.py ?
Using underscore in http header name is not common at all.
http://www.iana.org/assignments/message-headers/message-headers.xml#perm-headers

Change History (1)

comment:1 Changed 4 years ago by Tim Graham

Resolution: invalid
Status: newclosed

Hi, I think you've missed the documentation on how Django treats HTTP headers:

any HTTP headers in the request are converted to META keys by converting all characters to uppercase, replacing any hyphens with underscores and adding an HTTP_ prefix to the name. So, for example, a header called X-Bender would be mapped to the META key HTTP_X_BENDER.

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