File tree 7 files changed +2
-24
lines changed
7 files changed +2
-24
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,12 @@ debugger_test_parser = "0.1"
29
29
30
30
[dependencies ]
31
31
form_urlencoded = { version = " 1.0.0" , path = " ../form_urlencoded" }
32
- idna = { version = " 0.2.0" , path = " ../idna" , optional = true }
32
+ idna = { version = " 0.2.0" , path = " ../idna" }
33
33
percent-encoding = { version = " 2.1.0" , path = " ../percent_encoding" }
34
34
serde = {version = " 1.0" , optional = true , features = [" derive" ]}
35
35
36
36
[features ]
37
- default = [" idna " ]
37
+ default = []
38
38
# UNSTABLE FEATURES (requires Rust nightly)
39
39
# Enable to use the #[debugger_visualizer] attribute.
40
40
debugger_visualizer = []
Original file line number Diff line number Diff line change @@ -162,22 +162,9 @@ impl Host<String> {
162
162
}
163
163
164
164
/// convert domain with idna
165
- #[ cfg( feature = "idna" ) ]
166
165
fn domain_to_ascii ( domain : & str ) -> Result < String , ParseError > {
167
166
idna:: domain_to_ascii ( domain) . map_err ( Into :: into)
168
167
}
169
-
170
- /// checks domain is ascii
171
- #[ cfg( not( feature = "idna" ) ) ]
172
- fn domain_to_ascii ( domain : & str ) -> Result < String , ParseError > {
173
- // without idna feature, we can't verify that xn-- domains correctness
174
- let domain = domain. to_lowercase ( ) ;
175
- if domain. is_ascii ( ) && domain. split ( '.' ) . all ( |s| !s. starts_with ( "xn--" ) ) {
176
- Ok ( domain)
177
- } else {
178
- Err ( ParseError :: InvalidDomainCharacter )
179
- }
180
- }
181
168
}
182
169
183
170
impl < S : AsRef < str > > fmt:: Display for Host < S > {
Original file line number Diff line number Diff line change @@ -86,7 +86,6 @@ impl Origin {
86
86
}
87
87
88
88
/// <https://html.spec.whatwg.org/multipage/#unicode-serialisation-of-an-origin>
89
- #[ cfg( feature = "idna" ) ]
90
89
pub fn unicode_serialization ( & self ) -> String {
91
90
match * self {
92
91
Origin :: Opaque ( _) => "null" . to_owned ( ) ,
Original file line number Diff line number Diff line change @@ -87,7 +87,6 @@ simple_enum_error! {
87
87
Overflow => "URLs more than 4 GB are not supported" ,
88
88
}
89
89
90
- #[ cfg( feature = "idna" ) ]
91
90
impl From < :: idna:: Errors > for ParseError {
92
91
fn from ( _: :: idna:: Errors ) -> ParseError {
93
92
ParseError :: IdnaError
Original file line number Diff line number Diff line change @@ -66,7 +66,6 @@ pub fn domain_to_ascii(domain: &str) -> String {
66
66
}
67
67
68
68
/// https://url.spec.whatwg.org/#dom-url-domaintounicode
69
- #[ cfg( feature = "idna" ) ]
70
69
pub fn domain_to_unicode ( domain : & str ) -> String {
71
70
match Host :: parse ( domain) {
72
71
Ok ( Host :: Domain ( ref domain) ) => {
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ use url::{quirks, Url};
15
15
16
16
#[ test]
17
17
fn urltestdata ( ) {
18
- #[ cfg( not( feature = "idna" ) ) ]
19
18
let idna_skip_inputs = [
20
19
"http://www.foo。bar.com" ,
21
20
"http://Go.com" ,
@@ -46,7 +45,6 @@ fn urltestdata() {
46
45
let input = entry. take_string ( "input" ) ;
47
46
let failure = entry. take_key ( "failure" ) . is_some ( ) ;
48
47
49
- #[ cfg( not( feature = "idna" ) ) ]
50
48
{
51
49
if idna_skip_inputs. contains ( & input. as_str ( ) ) {
52
50
continue ;
@@ -133,7 +131,6 @@ fn setters_tests() {
133
131
let mut tests = json. take_key ( attr) . unwrap ( ) ;
134
132
for mut test in tests. as_array_mut ( ) . unwrap ( ) . drain ( ..) {
135
133
let comment = test. take_key ( "comment" ) . map ( |s| s. string ( ) ) ;
136
- #[ cfg( not( feature = "idna" ) ) ]
137
134
{
138
135
if let Some ( comment) = comment. as_ref ( ) {
139
136
if comment. starts_with ( "IDNA Nontransitional_Processing" ) {
Original file line number Diff line number Diff line change @@ -304,7 +304,6 @@ fn host_serialization() {
304
304
) ;
305
305
}
306
306
307
- #[ cfg( feature = "idna" ) ]
308
307
#[ test]
309
308
fn test_idna ( ) {
310
309
assert ! ( "http://goșu.ro" . parse:: <Url >( ) . is_ok( ) ) ;
@@ -540,7 +539,6 @@ fn test_origin_opaque() {
540
539
assert ! ( !& Url :: parse( "blob:malformed//" ) . unwrap( ) . origin( ) . is_tuple( ) )
541
540
}
542
541
543
- #[ cfg( feature = "idna" ) ]
544
542
#[ test]
545
543
fn test_origin_unicode_serialization ( ) {
546
544
let data = [
@@ -713,7 +711,6 @@ fn test_set_href() {
713
711
) ;
714
712
}
715
713
716
- #[ cfg( feature = "idna" ) ]
717
714
#[ test]
718
715
fn test_domain_encoding_quirks ( ) {
719
716
use url:: quirks:: { domain_to_ascii, domain_to_unicode} ;
You can’t perform that action at this time.
0 commit comments