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
f668d17e
Kaydet (Commit)
f668d17e
authored
Haz 06, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Clear the ftp cache when it contains more than 10 entries.
üst
2966b322
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
urllib.py
Lib/urllib.py
+21
-2
No files found.
Lib/urllib.py
Dosyayı görüntüle @
f668d17e
...
...
@@ -28,7 +28,9 @@ import os
import
sys
__version__
=
'1.6'
__version__
=
'1.7'
MAXFTPCACHE
=
10
# Trim the ftp cache beyond this size
# Helper for non-unix systems
if
os
.
name
==
'mac'
:
...
...
@@ -317,6 +319,13 @@ class URLopener:
dirs
,
file
=
dirs
[:
-
1
],
dirs
[
-
1
]
if
dirs
and
not
dirs
[
0
]:
dirs
=
dirs
[
1
:]
key
=
(
user
,
host
,
port
,
string
.
joinfields
(
dirs
,
'/'
))
if
len
(
self
.
ftpcache
)
>
MAXFTPCACHE
:
# Prune the cache, rather arbitrarily
for
k
in
self
.
ftpcache
.
keys
():
if
k
!=
key
:
v
=
self
.
ftpcache
[
k
]
del
self
.
ftpcache
[
k
]
v
.
close
()
try
:
if
not
self
.
ftpcache
.
has_key
(
key
):
self
.
ftpcache
[
key
]
=
\
...
...
@@ -506,7 +515,17 @@ class ftpwrapper:
if
file
:
cmd
=
'LIST '
+
file
else
:
cmd
=
'LIST'
conn
=
self
.
ftp
.
transfercmd
(
cmd
)
return
addclosehook
(
conn
.
makefile
(
'rb'
),
self
.
ftp
.
voidresp
)
return
addclosehook
(
conn
.
makefile
(
'rb'
),
self
.
endtransfer
)
def
endtransfer
(
self
):
try
:
self
.
ftp
.
voidresp
()
except
ftperrors
():
pass
def
close
(
self
):
try
:
self
.
ftp
.
close
()
except
ftperrors
():
pass
# Base class for addinfo and addclosehook
class
addbase
:
...
...
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