diff options
author | Giampaolo Rodola' <g.rodola@gmail.com> | 2011-06-27 09:17:51 (GMT) |
---|---|---|
committer | Giampaolo Rodola' <g.rodola@gmail.com> | 2011-06-27 09:17:51 (GMT) |
commit | 096dcb1eff251071815b22f2c99512df25fa5ed6 (patch) | |
tree | 5b5d87ea028a492f5a781475c1274eff515a6605 /Lib/ftplib.py | |
parent | 504783975bcf12e6c70d2f4193ff821e475d44a7 (diff) | |
download | cpython-096dcb1eff251071815b22f2c99512df25fa5ed6.zip cpython-096dcb1eff251071815b22f2c99512df25fa5ed6.tar.gz cpython-096dcb1eff251071815b22f2c99512df25fa5ed6.tar.bz2 |
Issue 12139: add CCC command support to FTP_TLS class to revert the SSL connection back to clear-text.
Diffstat (limited to 'Lib/ftplib.py')
-rw-r--r-- | Lib/ftplib.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py index d15a135..eaaa6fd 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -708,6 +708,14 @@ else: self.file = self.sock.makefile(mode='r', encoding=self.encoding) return resp + def ccc(self): + '''Switch back to a clear-text control connection.''' + if not isinstance(self.sock, ssl.SSLSocket): + raise ValueError("not using TLS") + resp = self.voidcmd('CCC') + self.sock = self.sock.unwrap() + return resp + def prot_p(self): '''Set up secure data connection.''' # PROT defines whether or not the data channel is to be protected. |