Skip to content

Commit b3c10e9

Browse files
#53 Updating the ftps docs to a working example (#57)
1 parent 17ad10c commit b3c10e9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@
3030
//!
3131
//! ```ignore
3232
//! use ftp::FtpStream;
33+
//! use openssl::ssl::*;
34+
//!
3335
//! let mut ftp_stream = FtpStream::connect("127.0.0.1:21").unwrap();
36+
//! let mut ctx = SslContext::new(SslMethod::Sslv23).unwrap();
37+
//! let mut ssl = Ssl::new(&ctx).unwrap();
3438
//! // Switch to the secure mode
35-
//! let (mut ftp_stream, _) = ftp_stream.secure();
39+
//! let mut ftp_stream = ftp_stream.into_secure(ssl).unwrap();
3640
//! ftp_stream.login("anonymous", "anonymous").unwrap();
3741
//! // Do other secret stuff
3842
//! // Switch back to the insecure mode (if required)
39-
//! let (mut ftp_stream, _) = ftp_stream.insecure();
43+
//! let mut ftp_stream = ftp_stream.into_insecure().unwrap();
4044
//! // Do all public stuff
4145
//! let _ = ftp_stream.quit();
4246
//! ```

0 commit comments

Comments
 (0)