mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
parent
857958f516
commit
f66cae3f96
3 changed files with 8 additions and 15 deletions
|
@ -27,19 +27,15 @@ const DEFAULT_CIPHERS: &'static str = concat!(
|
|||
"AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA"
|
||||
);
|
||||
|
||||
pub fn create_ssl_context(certificate_file: &str) -> Arc<SslContext> {
|
||||
pub fn create_http_connector(certificate_file: &str) -> Arc<Pool<Connector>> {
|
||||
let mut context = SslContext::new(SslMethod::Sslv23).unwrap();
|
||||
context.set_CA_file(&resources_dir_path()
|
||||
.expect("Need certificate file to make network requests")
|
||||
.join(certificate_file)).unwrap();
|
||||
context.set_cipher_list(DEFAULT_CIPHERS).unwrap();
|
||||
context.set_options(SSL_OP_NO_SSLV2 | SSL_OP_NO_SSLV3 | SSL_OP_NO_COMPRESSION);
|
||||
Arc::new(context)
|
||||
}
|
||||
|
||||
pub fn create_http_connector(ssl_context: Arc<SslContext>) -> Arc<Pool<Connector>> {
|
||||
let connector = HttpsConnector::new(ServoSslClient {
|
||||
context: ssl_context,
|
||||
context: Arc::new(context)
|
||||
});
|
||||
|
||||
Arc::new(Pool::with_connector(Default::default(), connector))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue