diff --git a/README.md b/README.md index 58e71e5f..f4cdcea9 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Rust-Postgres is a pure-Rust frontend for the popular PostgreSQL database. ```rust extern crate postgres; -use postgres::{Connection, SslMode}; +use postgres::{Connection, TlsMode}; struct Person { id: i32, @@ -26,7 +26,7 @@ struct Person { } fn main() { - let conn = Connection::connect("postgres://postgres@localhost", SslMode::None).unwrap(); + let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap(); conn.execute("CREATE TABLE person ( id SERIAL PRIMARY KEY, name VARCHAR NOT NULL, @@ -65,7 +65,7 @@ fn main() { Connect to a Postgres server using the standard URI format: ```rust let conn = try!(Connection::connect("postgres://user:pass@host:port/database?arg1=val1&arg2=val2", - SslMode::None)); + TlsMode::None)); ``` `pass` may be omitted if not needed. `port` defaults to `5432` and `database` defaults to the value of `user` if not specified. The driver supports `trust`, @@ -77,7 +77,7 @@ path to the directory containing the socket file. Since `/` is a reserved character in URLs, the path should be URL encoded. If Postgres stored its socket files in `/run/postgres`, the connection would then look like: ```rust -let conn = try!(Connection::connect("postgres://postgres@%2Frun%2Fpostgres", SslMode::None)); +let conn = try!(Connection::connect("postgres://postgres@%2Frun%2Fpostgres", TlsMode::None)); ``` Paths which contain non-UTF8 characters can be handled in a different manner; see the documentation for details. diff --git a/src/lib.rs b/src/lib.rs index c2bf5920..3ffc5fa2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -270,13 +270,13 @@ pub struct CancelData { /// postgres::cancel_query(url, TlsMode::None, &cancel_data).unwrap(); /// ``` pub fn cancel_query(params: T, - ssl: TlsMode, + tls: TlsMode, data: &CancelData) -> result::Result<(), ConnectError> where T: IntoConnectParams { let params = try!(params.into_connect_params().map_err(ConnectError::ConnectParams)); - let mut socket = try!(priv_io::initialize_stream(¶ms, ssl)); + let mut socket = try!(priv_io::initialize_stream(¶ms, tls)); try!(socket.write_message(&Frontend::CancelRequest { code: message::CANCEL_CODE, @@ -302,11 +302,11 @@ fn desynchronized() -> std_io::Error { /// Specifies the TLS support requested for a new connection. #[derive(Debug)] pub enum TlsMode<'a> { - /// The connection will not use SSL. + /// The connection will not use TLS. None, - /// The connection will use SSL if the backend supports it. + /// The connection will use TLS if the backend supports it. Prefer(&'a TlsHandshake), - /// The connection must use SSL. + /// The connection must use TLS. Require(&'a TlsHandshake), } @@ -339,11 +339,11 @@ impl Drop for InnerConnection { } impl InnerConnection { - fn connect(params: T, ssl: TlsMode) -> result::Result + fn connect(params: T, tls: TlsMode) -> result::Result where T: IntoConnectParams { let params = try!(params.into_connect_params().map_err(ConnectError::ConnectParams)); - let stream = try!(priv_io::initialize_stream(¶ms, ssl)); + let stream = try!(priv_io::initialize_stream(¶ms, tls)); let ConnectParams { user, database, mut options, .. } = params; @@ -1027,10 +1027,10 @@ impl Connection { /// let conn = Connection::connect(params, TlsMode::None).unwrap(); /// # } /// ``` - pub fn connect(params: T, ssl: TlsMode) -> result::Result + pub fn connect(params: T, tls: TlsMode) -> result::Result where T: IntoConnectParams { - InnerConnection::connect(params, ssl).map(|conn| Connection { conn: RefCell::new(conn) }) + InnerConnection::connect(params, tls).map(|conn| Connection { conn: RefCell::new(conn) }) } /// Executes a statement, returning the number of rows modified.