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
bc07ac51
Kaydet (Commit)
bc07ac51
authored
Tem 22, 2014
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix localhost checking in FileHandler. Raised in #21970.
üst
dfab935c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
test_urllib2.py
Lib/test/test_urllib2.py
+2
-1
request.py
Lib/urllib/request.py
+1
-1
No files found.
Lib/test/test_urllib2.py
Dosyayı görüntüle @
bc07ac51
...
...
@@ -678,7 +678,7 @@ class HandlerTests(unittest.TestCase):
self
.
assertEqual
(
int
(
headers
[
"Content-length"
]),
len
(
data
))
def
test_file
(
self
):
import
email.utils
,
socket
import
email.utils
h
=
urllib
.
request
.
FileHandler
()
o
=
h
.
parent
=
MockOpener
()
...
...
@@ -725,6 +725,7 @@ class HandlerTests(unittest.TestCase):
for
url
in
[
"file://localhost:80
%
s"
%
urlpath
,
"file:///file_does_not_exist.txt"
,
"file://not-a-local-host.com//dir/file.txt"
,
"file://
%
s:80
%
s/
%
s"
%
(
socket
.
gethostbyname
(
'localhost'
),
os
.
getcwd
(),
TESTFN
),
"file://somerandomhost.ontheinternet.com
%
s/
%
s"
%
...
...
Lib/urllib/request.py
Dosyayı görüntüle @
bc07ac51
...
...
@@ -1315,7 +1315,7 @@ class FileHandler(BaseHandler):
url
=
req
.
selector
if
url
[:
2
]
==
'//'
and
url
[
2
:
3
]
!=
'/'
and
(
req
.
host
and
req
.
host
!=
'localhost'
):
if
not
req
.
host
i
s
self
.
get_names
():
if
not
req
.
host
i
n
self
.
get_names
():
raise
URLError
(
"file:// scheme is supported only on localhost"
)
else
:
return
self
.
open_local_file
(
req
)
...
...
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