File tree Expand file tree Collapse file tree 7 files changed +2
-24
lines changed Expand file tree Collapse file tree 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"
2929
3030[dependencies ]
3131form_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" }
3333percent-encoding = { version = " 2.1.0" , path = " ../percent_encoding" }
3434serde = {version = " 1.0" , optional = true , features = [" derive" ]}
3535
3636[features ]
37- default = [" idna " ]
37+ default = []
3838# UNSTABLE FEATURES (requires Rust nightly)
3939# Enable to use the #[debugger_visualizer] attribute.
4040debugger_visualizer = []
Original file line number Diff line number Diff line change @@ -162,22 +162,9 @@ impl Host<String> {
162162 }
163163
164164 /// convert domain with idna
165- #[ cfg( feature = "idna" ) ]
166165 fn domain_to_ascii ( domain : & str ) -> Result < String , ParseError > {
167166 idna:: domain_to_ascii ( domain) . map_err ( Into :: into)
168167 }
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- }
181168}
182169
183170impl < S : AsRef < str > > fmt:: Display for Host < S > {
Original file line number Diff line number Diff line change @@ -86,7 +86,6 @@ impl Origin {
8686 }
8787
8888 /// <https://html.spec.whatwg.org/multipage/#unicode-serialisation-of-an-origin>
89- #[ cfg( feature = "idna" ) ]
9089 pub fn unicode_serialization ( & self ) -> String {
9190 match * self {
9291 Origin :: Opaque ( _) => "null" . to_owned ( ) ,
Original file line number Diff line number Diff line change @@ -87,7 +87,6 @@ simple_enum_error! {
8787 Overflow => "URLs more than 4 GB are not supported" ,
8888}
8989
90- #[ cfg( feature = "idna" ) ]
9190impl From < :: idna:: Errors > for ParseError {
9291 fn from ( _: :: idna:: Errors ) -> ParseError {
9392 ParseError :: IdnaError
Original file line number Diff line number Diff line change @@ -66,7 +66,6 @@ pub fn domain_to_ascii(domain: &str) -> String {
6666}
6767
6868/// https://url.spec.whatwg.org/#dom-url-domaintounicode
69- #[ cfg( feature = "idna" ) ]
7069pub fn domain_to_unicode ( domain : & str ) -> String {
7170 match Host :: parse ( domain) {
7271 Ok ( Host :: Domain ( ref domain) ) => {
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ use url::{quirks, Url};
1515
1616#[ test]
1717fn urltestdata ( ) {
18- #[ cfg( not( feature = "idna" ) ) ]
1918 let idna_skip_inputs = [
2019 "http://www.foo。bar.com" ,
2120 "http://Go.com" ,
@@ -46,7 +45,6 @@ fn urltestdata() {
4645 let input = entry. take_string ( "input" ) ;
4746 let failure = entry. take_key ( "failure" ) . is_some ( ) ;
4847
49- #[ cfg( not( feature = "idna" ) ) ]
5048 {
5149 if idna_skip_inputs. contains ( & input. as_str ( ) ) {
5250 continue ;
@@ -133,7 +131,6 @@ fn setters_tests() {
133131 let mut tests = json. take_key ( attr) . unwrap ( ) ;
134132 for mut test in tests. as_array_mut ( ) . unwrap ( ) . drain ( ..) {
135133 let comment = test. take_key ( "comment" ) . map ( |s| s. string ( ) ) ;
136- #[ cfg( not( feature = "idna" ) ) ]
137134 {
138135 if let Some ( comment) = comment. as_ref ( ) {
139136 if comment. starts_with ( "IDNA Nontransitional_Processing" ) {
Original file line number Diff line number Diff line change @@ -304,7 +304,6 @@ fn host_serialization() {
304304 ) ;
305305}
306306
307- #[ cfg( feature = "idna" ) ]
308307#[ test]
309308fn test_idna ( ) {
310309 assert ! ( "http://goșu.ro" . parse:: <Url >( ) . is_ok( ) ) ;
@@ -540,7 +539,6 @@ fn test_origin_opaque() {
540539 assert ! ( !& Url :: parse( "blob:malformed//" ) . unwrap( ) . origin( ) . is_tuple( ) )
541540}
542541
543- #[ cfg( feature = "idna" ) ]
544542#[ test]
545543fn test_origin_unicode_serialization ( ) {
546544 let data = [
@@ -713,7 +711,6 @@ fn test_set_href() {
713711 ) ;
714712}
715713
716- #[ cfg( feature = "idna" ) ]
717714#[ test]
718715fn test_domain_encoding_quirks ( ) {
719716 use url:: quirks:: { domain_to_ascii, domain_to_unicode} ;
You can’t perform that action at this time.
0 commit comments