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
ad16471b
Kaydet (Commit)
ad16471b
authored
May 13, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Untested changes by Skip Montanaro to have an optional limit on the
size of uploads to POST (new version of these patches).
üst
de8d6d73
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
cgi.py
Lib/cgi.py
+23
-0
No files found.
Lib/cgi.py
Dosyayı görüntüle @
ad16471b
...
@@ -478,6 +478,10 @@ log = initlog # The current logging function
...
@@ -478,6 +478,10 @@ log = initlog # The current logging function
# Parsing functions
# Parsing functions
# =================
# =================
# Maximum input we will accept when REQUEST_METHOD is POST
# 0 ==> unlimited input
maxlen
=
0
def
parse
(
fp
=
None
,
environ
=
os
.
environ
,
keep_blank_values
=
0
,
strict_parsing
=
0
):
def
parse
(
fp
=
None
,
environ
=
os
.
environ
,
keep_blank_values
=
0
,
strict_parsing
=
0
):
"""Parse a query in the environment or from a file (default stdin)
"""Parse a query in the environment or from a file (default stdin)
...
@@ -508,6 +512,8 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
...
@@ -508,6 +512,8 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
return
parse_multipart
(
fp
,
pdict
)
return
parse_multipart
(
fp
,
pdict
)
elif
ctype
==
'application/x-www-form-urlencoded'
:
elif
ctype
==
'application/x-www-form-urlencoded'
:
clength
=
string
.
atoi
(
environ
[
'CONTENT_LENGTH'
])
clength
=
string
.
atoi
(
environ
[
'CONTENT_LENGTH'
])
if
maxlen
and
clength
>
maxlen
:
raise
ValueError
,
'Maximum content length exceeded'
qs
=
fp
.
read
(
clength
)
qs
=
fp
.
read
(
clength
)
else
:
else
:
qs
=
''
# Unknown content-type
qs
=
''
# Unknown content-type
...
@@ -610,6 +616,8 @@ def parse_multipart(fp, pdict):
...
@@ -610,6 +616,8 @@ def parse_multipart(fp, pdict):
except
string
.
atoi_error
:
except
string
.
atoi_error
:
pass
pass
if
bytes
>
0
:
if
bytes
>
0
:
if
maxlen
and
bytes
>
maxlen
:
raise
ValueError
,
'Maximum content length exceeded'
data
=
fp
.
read
(
bytes
)
data
=
fp
.
read
(
bytes
)
else
:
else
:
data
=
""
data
=
""
...
@@ -829,6 +837,8 @@ class FieldStorage:
...
@@ -829,6 +837,8 @@ class FieldStorage:
clen
=
string
.
atoi
(
self
.
headers
[
'content-length'
])
clen
=
string
.
atoi
(
self
.
headers
[
'content-length'
])
except
:
except
:
pass
pass
if
maxlen
and
clen
>
maxlen
:
raise
ValueError
,
'Maximum content length exceeded'
self
.
length
=
clen
self
.
length
=
clen
self
.
list
=
self
.
file
=
None
self
.
list
=
self
.
file
=
None
...
@@ -1186,6 +1196,19 @@ def test(environ=os.environ):
...
@@ -1186,6 +1196,19 @@ def test(environ=os.environ):
except
:
except
:
print_exception
()
print_exception
()
# Second try with a small maxlen...
global
maxlen
maxlen
=
50
try
:
form
=
FieldStorage
()
# Replace with other classes to test those
print_form
(
form
)
print_environ
(
environ
)
print_directory
()
print_arguments
()
print_environ_usage
()
except
:
print_exception
()
def
print_exception
(
type
=
None
,
value
=
None
,
tb
=
None
,
limit
=
None
):
def
print_exception
(
type
=
None
,
value
=
None
,
tb
=
None
,
limit
=
None
):
if
type
is
None
:
if
type
is
None
:
type
,
value
,
tb
=
sys
.
exc_type
,
sys
.
exc_value
,
sys
.
exc_traceback
type
,
value
,
tb
=
sys
.
exc_type
,
sys
.
exc_value
,
sys
.
exc_traceback
...
...
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