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
cff22eb2
Kaydet (Commit)
cff22eb2
authored
Eki 03, 2015
tarafından
Martin Panter
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #25232: Fix CGIRequestHandler's splitting of URL query
Patch from Xiang Zhang.
üst
195fc2f2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
5 deletions
+27
-5
CGIHTTPServer.py
Lib/CGIHTTPServer.py
+1
-5
test_httpservers.py
Lib/test/test_httpservers.py
+22
-0
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/CGIHTTPServer.py
Dosyayı görüntüle @
cff22eb2
...
@@ -120,11 +120,7 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
...
@@ -120,11 +120,7 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
break
break
# find an explicit query string, if present.
# find an explicit query string, if present.
i
=
rest
.
rfind
(
'?'
)
rest
,
_
,
query
=
rest
.
partition
(
'?'
)
if
i
>=
0
:
rest
,
query
=
rest
[:
i
],
rest
[
i
+
1
:]
else
:
query
=
''
# dissect the part after the directory name into a script name &
# dissect the part after the directory name into a script name &
# a possible additional path, to be stored in PATH_INFO.
# a possible additional path, to be stored in PATH_INFO.
...
...
Lib/test/test_httpservers.py
Dosyayı görüntüle @
cff22eb2
...
@@ -381,6 +381,16 @@ print "%%s, %%s, %%s" %% (form.getfirst("spam"), form.getfirst("eggs"),
...
@@ -381,6 +381,16 @@ print "%%s, %%s, %%s" %% (form.getfirst("spam"), form.getfirst("eggs"),
form.getfirst("bacon"))
form.getfirst("bacon"))
"""
"""
cgi_file4
=
"""
\
#!
%
s
import os
print("Content-type: text/html")
print()
print(os.environ["
%
s"])
"""
@unittest.skipIf
(
hasattr
(
os
,
'geteuid'
)
and
os
.
geteuid
()
==
0
,
@unittest.skipIf
(
hasattr
(
os
,
'geteuid'
)
and
os
.
geteuid
()
==
0
,
"This test can't be run reliably as root (issue #13308)."
)
"This test can't be run reliably as root (issue #13308)."
)
...
@@ -424,6 +434,11 @@ class CGIHTTPServerTestCase(BaseTestCase):
...
@@ -424,6 +434,11 @@ class CGIHTTPServerTestCase(BaseTestCase):
file3
.
write
(
cgi_file1
%
self
.
pythonexe
)
file3
.
write
(
cgi_file1
%
self
.
pythonexe
)
os
.
chmod
(
self
.
file3_path
,
0777
)
os
.
chmod
(
self
.
file3_path
,
0777
)
self
.
file4_path
=
os
.
path
.
join
(
self
.
cgi_dir
,
'file4.py'
)
with
open
(
self
.
file4_path
,
'w'
)
as
file4
:
file4
.
write
(
cgi_file4
%
(
self
.
pythonexe
,
'QUERY_STRING'
))
os
.
chmod
(
self
.
file4_path
,
0
o777
)
self
.
cwd
=
os
.
getcwd
()
self
.
cwd
=
os
.
getcwd
()
os
.
chdir
(
self
.
parent_dir
)
os
.
chdir
(
self
.
parent_dir
)
...
@@ -436,6 +451,7 @@ class CGIHTTPServerTestCase(BaseTestCase):
...
@@ -436,6 +451,7 @@ class CGIHTTPServerTestCase(BaseTestCase):
os
.
remove
(
self
.
file1_path
)
os
.
remove
(
self
.
file1_path
)
os
.
remove
(
self
.
file2_path
)
os
.
remove
(
self
.
file2_path
)
os
.
remove
(
self
.
file3_path
)
os
.
remove
(
self
.
file3_path
)
os
.
remove
(
self
.
file4_path
)
os
.
rmdir
(
self
.
cgi_child_dir
)
os
.
rmdir
(
self
.
cgi_child_dir
)
os
.
rmdir
(
self
.
cgi_dir
)
os
.
rmdir
(
self
.
cgi_dir
)
os
.
rmdir
(
self
.
parent_dir
)
os
.
rmdir
(
self
.
parent_dir
)
...
@@ -536,6 +552,12 @@ class CGIHTTPServerTestCase(BaseTestCase):
...
@@ -536,6 +552,12 @@ class CGIHTTPServerTestCase(BaseTestCase):
self
.
assertEqual
((
b
'Hello World
\n
'
,
'text/html'
,
200
),
self
.
assertEqual
((
b
'Hello World
\n
'
,
'text/html'
,
200
),
(
res
.
read
(),
res
.
getheader
(
'Content-type'
),
res
.
status
))
(
res
.
read
(),
res
.
getheader
(
'Content-type'
),
res
.
status
))
def
test_query_with_multiple_question_mark
(
self
):
res
=
self
.
request
(
'/cgi-bin/file4.py?a=b?c=d'
)
self
.
assertEqual
(
(
b
'a=b?c=d
\n
'
,
'text/html'
,
200
),
(
res
.
read
(),
res
.
getheader
(
'Content-type'
),
res
.
status
))
class
SimpleHTTPRequestHandlerTestCase
(
unittest
.
TestCase
):
class
SimpleHTTPRequestHandlerTestCase
(
unittest
.
TestCase
):
""" Test url parsing """
""" Test url parsing """
...
...
Misc/ACKS
Dosyayı görüntüle @
cff22eb2
...
@@ -1505,6 +1505,7 @@ Thomas Wouters
...
@@ -1505,6 +1505,7 @@ Thomas Wouters
Daniel Wozniak
Daniel Wozniak
Heiko Wundram
Heiko Wundram
Doug Wyatt
Doug Wyatt
Xiang Zhang
Robert Xiao
Robert Xiao
Florent Xicluna
Florent Xicluna
Hirokazu Yamamoto
Hirokazu Yamamoto
...
...
Misc/NEWS
Dosyayı görüntüle @
cff22eb2
...
@@ -43,6 +43,9 @@ Core and Builtins
...
@@ -43,6 +43,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #25232: Fix CGIRequestHandler to split the query from the URL at the
first question mark (?) rather than the last. Patch from Xiang Zhang.
- Issue #22958: Constructor and update method of weakref.WeakValueDictionary
- Issue #22958: Constructor and update method of weakref.WeakValueDictionary
now accept the self keyword argument.
now accept the self keyword argument.
...
...
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