Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
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
cpython
Commits
d90f8d10
Kaydet (Commit)
d90f8d10
authored
Mar 29, 2015
tarafından
Donald Stufft
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Closes #23801 - Ignore entire preamble to multipart in cgi.FieldStorage
üst
1058cda3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
+29
-2
cgi.py
Lib/cgi.py
+7
-2
test_cgi.py
Lib/test/test_cgi.py
+19
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/cgi.py
Dosyayı görüntüle @
d90f8d10
...
...
@@ -693,8 +693,13 @@ class FieldStorage:
raise
ValueError
(
"
%
s should return bytes, got
%
s"
\
%
(
self
.
fp
,
type
(
first_line
)
.
__name__
))
self
.
bytes_read
+=
len
(
first_line
)
# first line holds boundary ; ignore it, or check that
# b"--" + ib == first_line.strip() ?
# Ensure that we consume the file until we've hit our inner boundary
while
(
first_line
.
strip
()
!=
(
b
"--"
+
self
.
innerboundary
)
and
first_line
):
first_line
=
self
.
fp
.
readline
()
self
.
bytes_read
+=
len
(
first_line
)
while
True
:
parser
=
FeedParser
()
hdr_text
=
b
""
...
...
Lib/test/test_cgi.py
Dosyayı görüntüle @
d90f8d10
...
...
@@ -248,6 +248,25 @@ class CgiTests(unittest.TestCase):
got
=
getattr
(
fs
.
list
[
x
],
k
)
self
.
assertEqual
(
got
,
exp
)
def
test_fieldstorage_multipart_leading_whitespace
(
self
):
env
=
{
'REQUEST_METHOD'
:
'POST'
,
'CONTENT_TYPE'
:
'multipart/form-data; boundary={}'
.
format
(
BOUNDARY
),
'CONTENT_LENGTH'
:
'560'
}
# Add some leading whitespace to our post data that will cause the
# first line to not be the innerboundary.
fp
=
BytesIO
(
b
"
\r\n
"
+
POSTDATA
.
encode
(
'latin-1'
))
fs
=
cgi
.
FieldStorage
(
fp
,
environ
=
env
,
encoding
=
"latin-1"
)
self
.
assertEqual
(
len
(
fs
.
list
),
4
)
expect
=
[{
'name'
:
'id'
,
'filename'
:
None
,
'value'
:
'1234'
},
{
'name'
:
'title'
,
'filename'
:
None
,
'value'
:
''
},
{
'name'
:
'file'
,
'filename'
:
'test.txt'
,
'value'
:
b
'Testing 123.
\n
'
},
{
'name'
:
'submit'
,
'filename'
:
None
,
'value'
:
' Add '
}]
for
x
in
range
(
len
(
fs
.
list
)):
for
k
,
exp
in
expect
[
x
]
.
items
():
got
=
getattr
(
fs
.
list
[
x
],
k
)
self
.
assertEqual
(
got
,
exp
)
def
test_fieldstorage_multipart_non_ascii
(
self
):
#Test basic FieldStorage multipart parsing
env
=
{
'REQUEST_METHOD'
:
'POST'
,
...
...
Misc/NEWS
Dosyayı görüntüle @
d90f8d10
...
...
@@ -124,6 +124,9 @@ Library
- Issue #23361: Fix possible overflow in Windows subprocess creation code.
- Issue #23801: Fix issue where cgi.FieldStorage did not always ignore the
entire preamble to a multipart body.
Tests
-----
...
...
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