@@ -150,10 +150,8 @@ impl Connection {
150150 /// Sends the [`Request`](struct.Request.html), consumes this
151151 /// connection, and returns a [`Response`](struct.Response.html).
152152 #[ cfg( feature = "rustls" ) ]
153- pub ( crate ) fn send_https ( mut self ) -> Result < ResponseLazy , Error > {
153+ pub ( crate ) fn send_https ( self ) -> Result < ResponseLazy , Error > {
154154 enforce_timeout ( self . timeout_at , move || {
155- self . request . url . host = ensure_ascii_host ( self . request . url . host ) ?;
156-
157155 let secured_stream = rustls_stream:: create_secured_stream ( & self ) ?;
158156
159157 #[ cfg( feature = "log" ) ]
@@ -170,9 +168,8 @@ impl Connection {
170168
171169 /// Sends the [`Request`](struct.Request.html), consumes this
172170 /// connection, and returns a [`Response`](struct.Response.html).
173- pub ( crate ) fn send ( mut self ) -> Result < ResponseLazy , Error > {
171+ pub ( crate ) fn send ( self ) -> Result < ResponseLazy , Error > {
174172 enforce_timeout ( self . timeout_at , move || {
175- self . request . url . host = ensure_ascii_host ( self . request . url . host ) ?;
176173 let bytes = self . request . as_bytes ( ) ;
177174
178175 #[ cfg( feature = "log" ) ]
@@ -313,35 +310,6 @@ fn get_redirect(mut connection: Connection, status_code: i32, url: Option<&Strin
313310 }
314311}
315312
316- fn ensure_ascii_host ( host : String ) -> Result < String , Error > {
317- if host. is_ascii ( ) {
318- Ok ( host)
319- } else {
320- #[ cfg( not( feature = "punycode" ) ) ]
321- {
322- Err ( Error :: PunycodeFeatureNotEnabled )
323- }
324-
325- #[ cfg( feature = "punycode" ) ]
326- {
327- let mut result = String :: with_capacity ( host. len ( ) * 2 ) ;
328- for s in host. split ( '.' ) {
329- if s. is_ascii ( ) {
330- result += s;
331- } else {
332- match punycode:: encode ( s) {
333- Ok ( s) => result = result + "xn--" + & s,
334- Err ( _) => return Err ( Error :: PunycodeConversionFailed ) ,
335- }
336- }
337- result += "." ;
338- }
339- result. truncate ( result. len ( ) - 1 ) ; // Remove the trailing dot
340- Ok ( result)
341- }
342- }
343- }
344-
345313/// Enforce the timeout by running the function in a new thread and
346314/// parking the current one with a timeout.
347315///
0 commit comments