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
cf934a1c
Kaydet (Commit)
cf934a1c
authored
Mar 19, 2016
tarafından
Berker Peksag
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #26560: Avoid potential ValueError in BaseHandler.start_response
Initial patch by Peter Inglesby.
üst
bfab9329
1cd4ff62
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
test_wsgiref.py
Lib/test/test_wsgiref.py
+21
-0
handlers.py
Lib/wsgiref/handlers.py
+1
-1
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_wsgiref.py
Dosyayı görüntüle @
cf934a1c
...
...
@@ -166,6 +166,27 @@ class IntegrationTests(TestCase):
" be of type list: <class 'tuple'>"
)
def
test_status_validation_errors
(
self
):
def
create_bad_app
(
status
):
def
bad_app
(
environ
,
start_response
):
start_response
(
status
,
[(
"Content-Type"
,
"text/plain; charset=utf-8"
)])
return
[
b
"Hello, world!"
]
return
bad_app
tests
=
[
(
'200'
,
'AssertionError: Status must be at least 4 characters'
),
(
'20X OK'
,
'AssertionError: Status message must begin w/3-digit code'
),
(
'200OK'
,
'AssertionError: Status message must have a space after code'
),
]
for
status
,
exc_message
in
tests
:
with
self
.
subTest
(
status
=
status
):
out
,
err
=
run_amock
(
create_bad_app
(
status
))
self
.
assertTrue
(
out
.
endswith
(
b
"A server error occurred. Please contact the administrator."
))
self
.
assertEqual
(
err
.
splitlines
()[
-
2
],
exc_message
)
def
test_wsgi_input
(
self
):
def
bad_app
(
e
,
s
):
e
[
"wsgi.input"
]
.
read
()
...
...
Lib/wsgiref/handlers.py
Dosyayı görüntüle @
cf934a1c
...
...
@@ -226,7 +226,7 @@ class BaseHandler:
self
.
headers
=
self
.
headers_class
(
headers
)
status
=
self
.
_convert_string_type
(
status
,
"Status"
)
assert
len
(
status
)
>=
4
,
"Status must be at least 4 characters"
assert
int
(
status
[:
3
]),
"Status message must begin w/3-digit code"
assert
status
[:
3
]
.
isdigit
(),
"Status message must begin w/3-digit code"
assert
status
[
3
]
==
" "
,
"Status message must have a space after code"
if
__debug__
:
...
...
Misc/NEWS
Dosyayı görüntüle @
cf934a1c
...
...
@@ -226,6 +226,9 @@ Core and Builtins
Library
-------
-
Issue
#
26560
:
Avoid
potential
ValueError
in
BaseHandler
.
start_response
.
Initial
patch
by
Peter
Inglesby
.
-
Issue
#
26567
:
Add
a
new
function
:
c
:
func
:`
PyErr_ResourceWarning
`
function
to
pass
the
destroyed
object
.
Add
a
*
source
*
attribute
to
:
class
:`
warnings
.
WarningMessage
`.
Add
warnings
.
_showwarnmsg
()
which
uses
...
...
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