mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Remove unsupported SslProvider, fixes #7627
This commit is contained in:
parent
815e981c69
commit
7632e89a04
1 changed files with 4 additions and 28 deletions
|
@ -9,14 +9,13 @@ use flate2::read::{DeflateDecoder, GzDecoder};
|
|||
use hsts::secure_url;
|
||||
use hyper::Error as HttpError;
|
||||
use hyper::client::{Request, Response, Pool};
|
||||
use hyper::error::Result as HttpResult;
|
||||
use hyper::header::{AcceptEncoding, Accept, ContentLength, ContentType, Host};
|
||||
use hyper::header::{Location, qitem, StrictTransportSecurity};
|
||||
use hyper::header::{Quality, QualityItem, Headers, ContentEncoding, Encoding};
|
||||
use hyper::http::RawStatus;
|
||||
use hyper::method::Method;
|
||||
use hyper::mime::{Mime, TopLevel, SubLevel};
|
||||
use hyper::net::{Fresh, HttpsConnector, HttpStream, Ssl, Openssl};
|
||||
use hyper::net::{Fresh, HttpsConnector, Openssl};
|
||||
use hyper::status::{StatusCode, StatusClass};
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use log;
|
||||
|
@ -24,7 +23,6 @@ use mime_classifier::MIMEClassifier;
|
|||
use net_traits::ProgressMsg::{Payload, Done};
|
||||
use net_traits::hosts::replace_hosts;
|
||||
use net_traits::{ControlMsg, CookieSource, LoadData, Metadata, LoadConsumer, IncludeSubdomains};
|
||||
use openssl::ssl::SslStream as OpensslStream;
|
||||
use openssl::ssl::{SslContext, SslMethod, SSL_VERIFY_PEER};
|
||||
use resource_task::{start_sending_opt, start_sending_sniffed_opt};
|
||||
use std::borrow::ToOwned;
|
||||
|
@ -39,37 +37,15 @@ use util::resource_files::resources_dir_path;
|
|||
use util::task::spawn_named;
|
||||
use uuid;
|
||||
|
||||
pub type Connector = HttpsConnector<SslProvider>;
|
||||
|
||||
pub enum SslProvider {
|
||||
None,
|
||||
Openssl(Openssl)
|
||||
}
|
||||
|
||||
|
||||
impl Ssl for SslProvider {
|
||||
type Stream = OpensslStream<HttpStream>;
|
||||
|
||||
fn wrap_client(&self, stream: HttpStream, host: &str) -> HttpResult<Self::Stream> {
|
||||
match *self {
|
||||
SslProvider::None => Err(HttpError::Ssl("ssl disabled".into())),
|
||||
SslProvider::Openssl(ref s) => s.wrap_client(stream, host)
|
||||
}
|
||||
}
|
||||
|
||||
fn wrap_server(&self, _: HttpStream) -> HttpResult<Self::Stream> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
pub type Connector = HttpsConnector<Openssl>;
|
||||
|
||||
pub fn create_http_connector() -> Arc<Pool<Connector>> {
|
||||
let mut context = SslContext::new(SslMethod::Sslv23).unwrap();
|
||||
context.set_verify(SSL_VERIFY_PEER, None);
|
||||
context.set_CA_file(&resources_dir_path().join("certs")).unwrap();
|
||||
let connector = HttpsConnector::new(SslProvider::Openssl(Openssl {
|
||||
let connector = HttpsConnector::new(Openssl {
|
||||
context: Arc::new(context)
|
||||
}));
|
||||
});
|
||||
|
||||
Arc::new(Pool::with_connector(Default::default(), connector))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue