feat(ssl): redesign SSL usage

BREAKING CHANGE: Server::https was changed to allow any implementation
  of Ssl. Server in general was also changed. HttpConnector no longer
  uses SSL; using HttpsConnector instead.
This commit is contained in:
Sean McArthur
2015-06-19 10:35:03 -07:00
parent e689f20376
commit 53bba6eb7f
17 changed files with 355 additions and 391 deletions

View File

@@ -16,15 +16,12 @@ use url::Url;
use method;
use version;
use traitobject;
use net::ContextVerifier;
/// The trait provides an API for creating new `HttpMessage`s depending on the underlying HTTP
/// protocol.
pub trait Protocol {
/// Creates a fresh `HttpMessage` bound to the given host, based on the given protocol scheme.
fn new_message(&self, host: &str, port: u16, scheme: &str) -> ::Result<Box<HttpMessage>>;
/// Sets the SSL verifier that should be used when establishing TLS-protected connections.
fn set_ssl_verifier(&mut self, verifier: ContextVerifier);
}
/// Describes a request.
@@ -63,7 +60,9 @@ pub trait HttpMessage: Write + Read + Send + Any + Typeable + Debug {
/// After this, the `HttpMessage` instance can be used as an `io::Read` in order to read out
/// the response body.
fn get_incoming(&mut self) -> ::Result<ResponseHead>;
/// Set the read timeout duration for this message.
#[cfg(feature = "timeouts")]
fn set_read_timeout(&self, dur: Option<Duration>) -> ::Result<()>;
/// Closes the underlying HTTP connection.
fn close_connection(&mut self) -> ::Result<()>;
}