Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
095eca8d
Kaydet (Commit)
095eca8d
authored
Kas 03, 2012
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #19101 -- Decoding of non-ASCII POST data on Python 3.
Thanks Claude Paroz.
üst
ac2052eb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
multipartparser.py
django/http/multipartparser.py
+1
-1
request.py
django/http/request.py
+3
-0
tests.py
tests/regressiontests/requests/tests.py
+11
-1
No files found.
django/http/multipartparser.py
Dosyayı görüntüle @
095eca8d
...
...
@@ -110,7 +110,7 @@ class MultiPartParser(object):
# HTTP spec says that Content-Length >= 0 is valid
# handling content-length == 0 before continuing
if
self
.
_content_length
==
0
:
return
QueryDict
(
MultiValueDict
()
,
encoding
=
self
.
_encoding
),
MultiValueDict
()
return
QueryDict
(
''
,
encoding
=
self
.
_encoding
),
MultiValueDict
()
# See if the handler will want to take care of the parsing.
# This allows overriding everything if somebody wants it.
...
...
django/http/request.py
Dosyayı görüntüle @
095eca8d
...
...
@@ -276,6 +276,9 @@ class QueryDict(MultiValueDict):
encoding
=
settings
.
DEFAULT_CHARSET
self
.
encoding
=
encoding
if
six
.
PY3
:
if
isinstance
(
query_string
,
bytes
):
# query_string contains URL-encoded data, a subset of ASCII.
query_string
=
query_string
.
decode
()
for
key
,
value
in
parse_qsl
(
query_string
or
''
,
keep_blank_values
=
True
,
encoding
=
encoding
):
...
...
tests/regressiontests/requests/tests.py
Dosyayı görüntüle @
095eca8d
...
...
@@ -12,7 +12,7 @@ from django.http import HttpRequest, HttpResponse, parse_cookie, build_request_r
from
django.test.client
import
FakePayload
from
django.test.utils
import
override_settings
,
str_prefix
from
django.utils
import
unittest
from
django.utils.http
import
cookie_date
from
django.utils.http
import
cookie_date
,
urlencode
from
django.utils.timezone
import
utc
...
...
@@ -353,6 +353,16 @@ class RequestsTests(unittest.TestCase):
self
.
assertRaises
(
Exception
,
lambda
:
request
.
body
)
self
.
assertEqual
(
request
.
POST
,
{})
def
test_non_ascii_POST
(
self
):
payload
=
FakePayload
(
urlencode
({
'key'
:
'España'
}))
request
=
WSGIRequest
({
'REQUEST_METHOD'
:
'POST'
,
'CONTENT_LENGTH'
:
len
(
payload
),
'CONTENT_TYPE'
:
'application/x-www-form-urlencoded'
,
'wsgi.input'
:
payload
,
})
self
.
assertEqual
(
request
.
POST
,
{
'key'
:
[
'España'
]})
def
test_alternate_charset_POST
(
self
):
"""
Test a POST with non-utf-8 payload encoding.
...
...
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