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
ebaf1046
Kaydet (Commit)
ebaf1046
authored
May 05, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
don't show print passwords in debug output
üst
b1c1315b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
ftplib.py
Lib/ftplib.py
+16
-6
No files found.
Lib/ftplib.py
Dosyayı görüntüle @
ebaf1046
...
@@ -95,7 +95,8 @@ class FTP:
...
@@ -95,7 +95,8 @@ class FTP:
# Get the welcome message from the server
# Get the welcome message from the server
# (this is read and squirreled away by connect())
# (this is read and squirreled away by connect())
def
getwelcome
(
self
):
def
getwelcome
(
self
):
if
self
.
debugging
:
print
'*welcome*'
,
`self.welcome`
if
self
.
debugging
:
print
'*welcome*'
,
self
.
sanitize
(
self
.
welcome
)
return
self
.
welcome
return
self
.
welcome
# Set the debugging level. Argument level means:
# Set the debugging level. Argument level means:
...
@@ -106,15 +107,24 @@ class FTP:
...
@@ -106,15 +107,24 @@ class FTP:
self
.
debugging
=
level
self
.
debugging
=
level
debug
=
set_debuglevel
debug
=
set_debuglevel
# Internal: "sanitize" a string for printing
def
sanitize
(
self
,
s
):
if
s
[:
5
]
==
'pass '
or
s
[:
5
]
==
'PASS '
:
i
=
len
(
s
)
while
i
>
5
and
s
[
i
-
1
]
in
'
\r\n
'
:
i
=
i
-
1
s
=
s
[:
5
]
+
'*'
*
(
i
-
5
)
+
s
[
i
:]
return
`s`
# Internal: send one line to the server, appending CRLF
# Internal: send one line to the server, appending CRLF
def
putline
(
self
,
line
):
def
putline
(
self
,
line
):
line
=
line
+
CRLF
line
=
line
+
CRLF
if
self
.
debugging
>
1
:
print
'*put*'
,
`line`
if
self
.
debugging
>
1
:
print
'*put*'
,
self
.
sanitize
(
line
)
self
.
sock
.
send
(
line
)
self
.
sock
.
send
(
line
)
# Internal: send one command to the server (through putline())
# Internal: send one command to the server (through putline())
def
putcmd
(
self
,
line
):
def
putcmd
(
self
,
line
):
if
self
.
debugging
:
print
'*cmd*'
,
`line`
if
self
.
debugging
:
print
'*cmd*'
,
self
.
sanitize
(
line
)
self
.
putline
(
line
)
self
.
putline
(
line
)
# Internal: return one line from the server, stripping CRLF.
# Internal: return one line from the server, stripping CRLF.
...
@@ -122,7 +132,7 @@ class FTP:
...
@@ -122,7 +132,7 @@ class FTP:
def
getline
(
self
):
def
getline
(
self
):
line
=
self
.
file
.
readline
()
line
=
self
.
file
.
readline
()
if
self
.
debugging
>
1
:
if
self
.
debugging
>
1
:
print
'*get*'
,
`line`
print
'*get*'
,
self
.
sanitize
(
line
)
if
not
line
:
raise
EOFError
if
not
line
:
raise
EOFError
if
line
[
-
2
:]
==
CRLF
:
line
=
line
[:
-
2
]
if
line
[
-
2
:]
==
CRLF
:
line
=
line
[:
-
2
]
elif
line
[
-
1
:]
in
CRLF
:
line
=
line
[:
-
1
]
elif
line
[
-
1
:]
in
CRLF
:
line
=
line
[:
-
1
]
...
@@ -148,7 +158,7 @@ class FTP:
...
@@ -148,7 +158,7 @@ class FTP:
# Raise various errors if the response indicates an error
# Raise various errors if the response indicates an error
def
getresp
(
self
):
def
getresp
(
self
):
resp
=
self
.
getmultiline
()
resp
=
self
.
getmultiline
()
if
self
.
debugging
:
print
'*resp*'
,
`resp`
if
self
.
debugging
:
print
'*resp*'
,
self
.
sanitize
(
resp
)
self
.
lastresp
=
resp
[:
3
]
self
.
lastresp
=
resp
[:
3
]
c
=
resp
[:
1
]
c
=
resp
[:
1
]
if
c
==
'4'
:
if
c
==
'4'
:
...
@@ -171,7 +181,7 @@ class FTP:
...
@@ -171,7 +181,7 @@ class FTP:
# tried. Instead, just send the ABOR command as OOB data.
# tried. Instead, just send the ABOR command as OOB data.
def
abort
(
self
):
def
abort
(
self
):
line
=
'ABOR'
+
CRLF
line
=
'ABOR'
+
CRLF
if
self
.
debugging
>
1
:
print
'*put urgent*'
,
`line`
if
self
.
debugging
>
1
:
print
'*put urgent*'
,
self
.
sanitize
(
line
)
self
.
sock
.
send
(
line
,
MSG_OOB
)
self
.
sock
.
send
(
line
,
MSG_OOB
)
resp
=
self
.
getmultiline
()
resp
=
self
.
getmultiline
()
if
resp
[:
3
]
not
in
(
'426'
,
'226'
):
if
resp
[:
3
]
not
in
(
'426'
,
'226'
):
...
...
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