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
2ed2acf8
Kaydet (Commit)
2ed2acf8
authored
Mar 01, 2019
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #30227 -- Fixed crash on request without boundary in Content-Type.
üst
8a2ec55b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
multipartparser.py
django/http/multipartparser.py
+1
-1
tests.py
tests/requests/tests.py
+11
-0
No files found.
django/http/multipartparser.py
Dosyayı görüntüle @
2ed2acf8
...
...
@@ -70,7 +70,7 @@ class MultiPartParser:
ctypes
,
opts
=
parse_header
(
content_type
.
encode
(
'ascii'
))
boundary
=
opts
.
get
(
'boundary'
)
if
not
boundary
or
not
cgi
.
valid_boundary
(
boundary
):
raise
MultiPartParserError
(
'Invalid boundary in multipart:
%
s'
%
boundary
.
decode
(
))
raise
MultiPartParserError
(
'Invalid boundary in multipart:
%
s'
%
force_str
(
boundary
))
# Content-Length should contain the length of the body we are about
# to receive.
...
...
tests/requests/tests.py
Dosyayı görüntüle @
2ed2acf8
...
...
@@ -5,6 +5,7 @@ from urllib.parse import urlencode
from
django.core.exceptions
import
DisallowedHost
from
django.core.handlers.wsgi
import
LimitedStream
,
WSGIRequest
from
django.http
import
HttpRequest
,
RawPostDataException
,
UnreadablePostError
from
django.http.multipartparser
import
MultiPartParserError
from
django.http.request
import
HttpHeaders
,
split_domain_port
from
django.test
import
RequestFactory
,
SimpleTestCase
,
override_settings
from
django.test.client
import
FakePayload
...
...
@@ -476,6 +477,16 @@ class RequestsTests(SimpleTestCase):
})
self
.
assertFalse
(
request
.
POST
.
_mutable
)
def
test_multipart_without_boundary
(
self
):
request
=
WSGIRequest
({
'REQUEST_METHOD'
:
'POST'
,
'CONTENT_TYPE'
:
'multipart/form-data;'
,
'CONTENT_LENGTH'
:
0
,
'wsgi.input'
:
FakePayload
(),
})
with
self
.
assertRaisesMessage
(
MultiPartParserError
,
'Invalid boundary in multipart: None'
):
request
.
POST
def
test_POST_connection_error
(
self
):
"""
If wsgi.input.read() raises an exception while trying to read() the
...
...
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