Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
510d6a3c
Commit
510d6a3c
authored
Jan 07, 2013
by
Xavier Ordoquy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduced HTTP_HEADER_ENCODING.
parent
22a7dc27
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletions
+7
-1
rest_framework/authentication.py
+4
-1
rest_framework/settings.py
+3
-0
No files found.
rest_framework/authentication.py
View file @
510d6a3c
...
...
@@ -8,6 +8,7 @@ from rest_framework import exceptions
from
rest_framework.compat
import
CsrfViewMiddleware
from
rest_framework.compat
import
smart_text
from
rest_framework.authtoken.models
import
Token
from
rest_framework.settings
import
api_settings
import
base64
...
...
@@ -37,7 +38,9 @@ class BasicAuthentication(BaseAuthentication):
auth
=
request
.
META
[
'HTTP_AUTHORIZATION'
]
.
split
()
if
len
(
auth
)
==
2
and
auth
[
0
]
.
lower
()
==
"basic"
:
try
:
auth_parts
=
base64
.
b64decode
(
auth
[
1
]
.
encode
(
'iso-8859-1'
))
.
decode
(
'iso-8859-1'
)
.
partition
(
':'
)
encoding
=
api_settings
.
HTTP_HEADER_ENCODING
b
=
base64
.
b64decode
(
auth
[
1
]
.
encode
(
encoding
))
auth_parts
=
b
.
decode
(
encoding
)
.
partition
(
':'
)
except
TypeError
:
return
None
...
...
rest_framework/settings.py
View file @
510d6a3c
...
...
@@ -75,6 +75,9 @@ DEFAULTS = {
'URL_FORMAT_OVERRIDE'
:
'format'
,
'FORMAT_SUFFIX_KWARG'
:
'format'
,
# Header encoding (see RFC5987)
'HTTP_HEADER_ENCODING'
:
'iso-8859-1'
,
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment