Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit e83f9a2

Browse files
committed
Replace cfg-based SSL with Cargo features.
rustc --cfg nossl => cargo build --no-default-features
1 parent 57d2b9a commit e83f9a2

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ version = "0.1.0-pre"
44
authors = [ "Chris Morgan <[email protected]>" ]
55
build = "codegen/main.rs"
66

7+
[features]
8+
default = ["ssl"]
9+
ssl = ["openssl"]
10+
711
[lib]
812
name = "http"
913
path = "src/http/lib.rs"
1014

1115
[dependencies.openssl]
1216
git = "https://github.com/sfackler/rust-openssl.git"
17+
optional = true
1318

1419
[dependencies.url]
1520
git = "https://github.com/servo/rust-url"

src/http/client/sslclients/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
//! that, you won't be able to use SSL (an attempt to make an HTTPS connection
66
//! will return an error).
77
8-
#[cfg(not(nossl))]
8+
#[cfg(feature = "ssl")]
99
pub use self::openssl::NetworkStream;
10-
#[cfg(nossl)]
10+
#[cfg(not(feature = "ssl"))]
1111
pub use self::none::NetworkStream;
1212

13-
#[cfg(not(nossl))]
13+
#[cfg(feature = "ssl")]
1414
mod openssl;
15-
#[cfg(nossl)]
15+
#[cfg(not(feature = "ssl"))]
1616
mod none;

src/http/client/sslclients/none.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::io::net::ip::SocketAddr;
44
use std::io::net::tcp::TcpStream;
55
use std::io::{IoResult, IoError, InvalidInput};
66
use connecter::Connecter;
7+
use self::NetworkStream::NormalStream;
78

89
/// A TCP stream, plain text and with no SSL support.
910
///

src/http/client/sslclients/openssl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! SSL support provided by OpenSSL.
22
3+
#[cfg(any(feature = "ssl", feature = "default"))]
34
extern crate openssl;
45

56
use std::io::net::ip::SocketAddr;

0 commit comments

Comments
 (0)