Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9ce4f36a
Commit
9ce4f36a
authored
Jun 17, 2013
by
Christian Heimes
Browse files
Options
Browse Files
Download
Plain Diff
merge heads
parents
9a5395ae
a5f004fe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
0 deletions
+35
-0
Lib/cgi.py
Lib/cgi.py
+9
-0
Lib/test/test_cgi.py
Lib/test/test_cgi.py
+23
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/cgi.py
View file @
9ce4f36a
...
...
@@ -786,6 +786,9 @@ class FieldStorage:
if
not
line
:
self
.
done
=
-
1
break
if
delim
==
b"
\
r
"
:
line
=
delim
+
line
delim
=
b""
if
line
.
startswith
(
b"--"
)
and
last_line_lfend
:
strippedline
=
line
.
rstrip
()
if
strippedline
==
next_boundary
:
...
...
@@ -802,6 +805,12 @@ class FieldStorage:
delim
=
b"
\
n
"
line
=
line
[:
-
1
]
last_line_lfend
=
True
elif
line
.
endswith
(
b"
\
r
"
):
# We may interrupt \r\n sequences if they span the 2**16
# byte boundary
delim
=
b"
\
r
"
line
=
line
[:
-
1
]
last_line_lfend
=
False
else
:
delim
=
b""
last_line_lfend
=
False
...
...
Lib/test/test_cgi.py
View file @
9ce4f36a
...
...
@@ -256,6 +256,29 @@ class CgiTests(unittest.TestCase):
got
=
getattr
(
fs
.
list
[
x
],
k
)
self
.
assertEqual
(
got
,
exp
)
def
test_fieldstorage_multipart_maxline
(
self
):
# Issue #18167
maxline
=
1
<<
16
self
.
maxDiff
=
None
def
check
(
content
):
data
=
"""---123
Content-Disposition: form-data; name="upload"; filename="fake.txt"
Content-Type: text/plain
%s
---123--
"""
.
replace
(
'
\
n
'
,
'
\
r
\
n
'
)
%
content
environ
=
{
'CONTENT_LENGTH'
:
str
(
len
(
data
)),
'CONTENT_TYPE'
:
'multipart/form-data; boundary=-123'
,
'REQUEST_METHOD'
:
'POST'
,
}
self
.
assertEqual
(
gen_result
(
data
,
environ
),
{
'upload'
:
content
.
encode
(
'latin1'
)})
check
(
'x'
*
(
maxline
-
1
))
check
(
'x'
*
(
maxline
-
1
)
+
'
\
r
'
)
check
(
'x'
*
(
maxline
-
1
)
+
'
\
r
'
+
'y'
*
(
maxline
-
1
))
_qs_result
=
{
'key1'
:
'value1'
,
'key2'
:
[
'value2x'
,
'value2y'
],
...
...
Misc/NEWS
View file @
9ce4f36a
...
...
@@ -127,6 +127,9 @@ Library
lists
all
loaded
CA
certificates
and
cert_store_stats
()
returns
amount
of
loaded
X
.509
certs
,
X
.509
CA
certs
and
CRLs
.
-
Issue
#
18167
:
cgi
.
FieldStorage
no
more
fails
to
handle
multipart
/
form
-
data
when
\
r
\
n
appears
at
end
of
65535
bytes
without
other
newlines
.
-
Issue
#
18076
:
Introduce
importlib
.
util
.
decode_source
().
-
importlib
.
abc
.
SourceLoader
.
get_source
()
no
longer
changes
SyntaxError
or
...
...
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