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
a71cfc5c
Kaydet (Commit)
a71cfc5c
authored
Ara 26, 2014
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fix behavior of trailing slash redirection when a query string is involved (closes #23112)
üst
cb36d247
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
SimpleHTTPServer.py
Lib/SimpleHTTPServer.py
+7
-2
test_httpservers.py
Lib/test/test_httpservers.py
+6
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/SimpleHTTPServer.py
Dosyayı görüntüle @
a71cfc5c
...
...
@@ -14,6 +14,7 @@ import os
import
posixpath
import
BaseHTTPServer
import
urllib
import
urlparse
import
cgi
import
sys
import
shutil
...
...
@@ -68,10 +69,14 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
path
=
self
.
translate_path
(
self
.
path
)
f
=
None
if
os
.
path
.
isdir
(
path
):
if
not
self
.
path
.
endswith
(
'/'
):
parts
=
urlparse
.
urlsplit
(
self
.
path
)
if
not
parts
.
path
.
endswith
(
'/'
):
# redirect browser - doing basically what apache does
self
.
send_response
(
301
)
self
.
send_header
(
"Location"
,
self
.
path
+
"/"
)
new_parts
=
(
parts
[
0
],
parts
[
1
],
parts
[
2
]
+
'/'
,
parts
[
3
],
parts
[
4
])
new_url
=
urlparse
.
urlunsplit
(
new_parts
)
self
.
send_header
(
"Location"
,
new_url
)
self
.
end_headers
()
return
None
for
index
in
"index.html"
,
"index.htm"
:
...
...
Lib/test/test_httpservers.py
Dosyayı görüntüle @
a71cfc5c
...
...
@@ -321,6 +321,12 @@ class SimpleHTTPServerTestCase(BaseTestCase):
self
.
check_status_and_reason
(
response
,
200
)
response
=
self
.
request
(
self
.
tempdir_name
)
self
.
check_status_and_reason
(
response
,
301
)
response
=
self
.
request
(
self
.
tempdir_name
+
'/?hi=2'
)
self
.
check_status_and_reason
(
response
,
200
)
response
=
self
.
request
(
self
.
tempdir_name
+
'?hi=1'
)
self
.
check_status_and_reason
(
response
,
301
)
self
.
assertEqual
(
response
.
getheader
(
"Location"
),
self
.
tempdir_name
+
"/?hi=1"
)
response
=
self
.
request
(
'/ThisDoesNotExist'
)
self
.
check_status_and_reason
(
response
,
404
)
response
=
self
.
request
(
'/'
+
'ThisDoesNotExist'
+
'/'
)
...
...
Misc/NEWS
Dosyayı görüntüle @
a71cfc5c
...
...
@@ -15,6 +15,9 @@ Core and Builtins
Library
-------
- Issue #23112: Fix SimpleHTTPServer to correctly carry the query string and
fragment when it redirects to add a trailing slash.
- Issue #23093: In the io, module allow more operations to work on detached
streams.
...
...
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