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
383c32dd
Kaydet (Commit)
383c32dd
authored
Eki 14, 2010
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue10063 - file:// scheme will stop accessing remote hosts via ftp protocol
üst
6d7be5f8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
7 deletions
+17
-7
urllib.request.rst
Doc/library/urllib.request.rst
+6
-2
test_urllib2.py
Lib/test/test_urllib2.py
+2
-2
request.py
Lib/urllib/request.py
+3
-3
NEWS
Misc/NEWS
+6
-0
No files found.
Doc/library/urllib.request.rst
Dosyayı görüntüle @
383c32dd
...
...
@@ -1004,8 +1004,12 @@ FileHandler Objects
.. method:: FileHandler.file_open(req)
Open the file locally, if there is no host name, or the host name is
``'localhost'``. Change the protocol to ``ftp`` otherwise, and retry opening it
using :attr:`parent`.
``'localhost'``.
This method is applicable only for local hostnames. When a remote hostname
is given, an :exc:`URLError` is raised.
.. versionchanged:: 3.2
.. _ftp-handler-objects:
...
...
Lib/test/test_urllib2.py
Dosyayı görüntüle @
383c32dd
...
...
@@ -731,11 +731,11 @@ class HandlerTests(unittest.TestCase):
# file:///blah.txt (a file)
# file://ftp.example.com/blah.txt (an ftp URL)
for
url
,
ftp
in
[
(
"file://ftp.example.com//foo.txt"
,
Tru
e
),
(
"file://ftp.example.com//foo.txt"
,
Fals
e
),
(
"file://ftp.example.com///foo.txt"
,
False
),
# XXXX bug: fails with OSError, should be URLError
(
"file://ftp.example.com/foo.txt"
,
False
),
(
"file://somehost//foo/something.txt"
,
Tru
e
),
(
"file://somehost//foo/something.txt"
,
Fals
e
),
(
"file://localhost//foo/something.txt"
,
False
),
]:
req
=
Request
(
url
)
...
...
Lib/urllib/request.py
Dosyayı görüntüle @
383c32dd
...
...
@@ -1228,8 +1228,8 @@ class FileHandler(BaseHandler):
url
=
req
.
selector
if
url
[:
2
]
==
'//'
and
url
[
2
:
3
]
!=
'/'
and
(
req
.
host
and
req
.
host
!=
'localhost'
):
req
.
type
=
'ftp'
return
self
.
parent
.
open
(
req
)
if
not
req
.
host
is
self
.
get_names
():
raise
URLError
(
"file:// scheme is supported only on localhost"
)
else
:
return
self
.
open_local_file
(
req
)
...
...
@@ -1712,7 +1712,7 @@ class URLopener:
if
not
isinstance
(
url
,
str
):
raise
URLError
(
'file error'
,
'proxy support for file protocol currently not implemented'
)
if
url
[:
2
]
==
'//'
and
url
[
2
:
3
]
!=
'/'
and
url
[
2
:
12
]
.
lower
()
!=
'localhost/'
:
r
eturn
self
.
open_ftp
(
url
)
r
aise
ValueError
(
"file:// scheme is supported only on localhost"
)
else
:
return
self
.
open_local_file
(
url
)
...
...
Misc/NEWS
Dosyayı görüntüle @
383c32dd
...
...
@@ -18,6 +18,12 @@ Core and Builtins
Library
-------
- Issue #Issue10063: file:// scheme will stop accessing remote hosts via ftp
protocol. file:// urls had fallback to access remote hosts via ftp. This was
not correct, change is made to raise a URLError when a remote host is tried
to access via file:// scheme.
- Issue #1710703: Write structures for an empty ZIP archive when a ZipFile is
created in modes 'a' or 'w' and then closed without adding any files. Raise
BadZipfile (rather than IOError) when opening small non-ZIP files.
...
...
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