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
58c60620
Kaydet (Commit)
58c60620
authored
Ock 21, 2012
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix Issue6631 - Disallow relative files paths in urllib*.open()
üst
631c2580
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
0 deletions
+7
-0
test_urllib.py
Lib/test/test_urllib.py
+3
-0
test_urllib2net.py
Lib/test/test_urllib2net.py
+2
-0
urllib.py
Lib/urllib.py
+2
-0
No files found.
Lib/test/test_urllib.py
Dosyayı görüntüle @
58c60620
...
...
@@ -134,6 +134,9 @@ class urlopen_FileTests(unittest.TestCase):
for
line
in
self
.
returned_obj
.
__iter__
():
self
.
assertEqual
(
line
,
self
.
text
)
def
test_relativelocalfile
(
self
):
self
.
assertRaises
(
ValueError
,
urllib
.
urlopen
,
'./'
+
self
.
pathname
)
class
ProxyTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
Lib/test/test_urllib2net.py
Dosyayı görüntüle @
58c60620
...
...
@@ -126,6 +126,8 @@ class OtherNetworkTests(unittest.TestCase):
finally
:
os
.
remove
(
TESTFN
)
self
.
assertRaises
(
ValueError
,
urllib2
.
urlopen
,
'./relative_path/to/file'
)
# XXX Following test depends on machine configurations that are internal
# to CNRI. Need to set up a public server with the right authentication
# configuration for test purposes.
...
...
Lib/urllib.py
Dosyayı görüntüle @
58c60620
...
...
@@ -484,6 +484,8 @@ class URLopener:
urlfile
=
file
if
file
[:
1
]
==
'/'
:
urlfile
=
'file://'
+
file
elif
file
[:
2
]
==
'./'
:
raise
ValueError
(
"local file url may start with / or file:. Unknown url of type:
%
s"
%
url
)
return
addinfourl
(
open
(
localname
,
'rb'
),
headers
,
urlfile
)
host
,
port
=
splitport
(
host
)
...
...
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