refactor(header): replace url crate with percent-encoding
This commit is contained in:
		| @@ -27,13 +27,13 @@ httparse = "1.0" | |||||||
| language-tags = "0.2" | language-tags = "0.2" | ||||||
| log = "0.3" | log = "0.3" | ||||||
| mime = "0.3.2" | mime = "0.3.2" | ||||||
|  | percent-encoding = "1.0" | ||||||
| time = "0.1" | time = "0.1" | ||||||
| tokio-core = "0.1.6" | tokio-core = "0.1.6" | ||||||
| tokio-proto = "0.1" | tokio-proto = "0.1" | ||||||
| tokio-service = "0.1" | tokio-service = "0.1" | ||||||
| tokio-io = "0.1" | tokio-io = "0.1" | ||||||
| unicase = "2.0" | unicase = "2.0" | ||||||
| url = "1.0" |  | ||||||
|  |  | ||||||
| [dev-dependencies] | [dev-dependencies] | ||||||
| num_cpus = "1.0" | num_cpus = "1.0" | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ use language_tags::LanguageTag; | |||||||
| use std::str; | use std::str; | ||||||
| use std::str::FromStr; | use std::str::FromStr; | ||||||
| use std::fmt::{self, Display}; | use std::fmt::{self, Display}; | ||||||
| use url::percent_encoding; | use percent_encoding; | ||||||
|  |  | ||||||
| use header::Raw; | use header::Raw; | ||||||
| use header::shared::Charset; | use header::shared::Charset; | ||||||
| @@ -156,23 +156,18 @@ pub fn http_percent_encode(f: &mut fmt::Formatter, bytes: &[u8]) -> fmt::Result | |||||||
| } | } | ||||||
|  |  | ||||||
| mod percent_encoding_http { | mod percent_encoding_http { | ||||||
|     use std::fmt; |     use percent_encoding; | ||||||
|     use url::percent_encoding; |  | ||||||
|  |  | ||||||
|  |     // internal module because macro is hard-coded to make a public item | ||||||
|  |     // but we don't want to public export this item | ||||||
|     define_encode_set! { |     define_encode_set! { | ||||||
|         /// This encode set is used for HTTP header values and is defined at |         // This encode set is used for HTTP header values and is defined at | ||||||
|         /// https://tools.ietf.org/html/rfc5987#section-3.2 |         // https://tools.ietf.org/html/rfc5987#section-3.2 | ||||||
|         pub HTTP_VALUE = [percent_encoding::SIMPLE_ENCODE_SET] | { |         pub HTTP_VALUE = [percent_encoding::SIMPLE_ENCODE_SET] | { | ||||||
|             ' ', '"', '%', '\'', '(', ')', '*', ',', '/', ':', ';', '<', '-', '>', '?', |             ' ', '"', '%', '\'', '(', ')', '*', ',', '/', ':', ';', '<', '-', '>', '?', | ||||||
|             '[', '\\', ']', '{', '}' |             '[', '\\', ']', '{', '}' | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     impl fmt::Debug for HTTP_VALUE { |  | ||||||
|         fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |  | ||||||
|             f.pad("HTTP_VALUE") |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|  |  | ||||||
| #[cfg(test)] | #[cfg(test)] | ||||||
|   | |||||||
| @@ -17,6 +17,7 @@ | |||||||
| //! If just starting out, **check out the [Guides](https://hyper.rs/guides) | //! If just starting out, **check out the [Guides](https://hyper.rs/guides) | ||||||
| //! first.** | //! first.** | ||||||
|  |  | ||||||
|  | extern crate base64; | ||||||
| extern crate bytes; | extern crate bytes; | ||||||
| #[macro_use] extern crate futures; | #[macro_use] extern crate futures; | ||||||
| extern crate futures_cpupool; | extern crate futures_cpupool; | ||||||
| @@ -24,14 +25,13 @@ extern crate httparse; | |||||||
| extern crate language_tags; | extern crate language_tags; | ||||||
| #[macro_use] extern crate log; | #[macro_use] extern crate log; | ||||||
| pub extern crate mime; | pub extern crate mime; | ||||||
| extern crate base64; | #[macro_use] extern crate percent_encoding; | ||||||
| extern crate time; | extern crate time; | ||||||
| extern crate tokio_core as tokio; | extern crate tokio_core as tokio; | ||||||
| #[macro_use] extern crate tokio_io; | #[macro_use] extern crate tokio_io; | ||||||
| extern crate tokio_proto; | extern crate tokio_proto; | ||||||
| extern crate tokio_service; | extern crate tokio_service; | ||||||
| extern crate unicase; | extern crate unicase; | ||||||
| #[macro_use] extern crate url; |  | ||||||
|  |  | ||||||
| #[cfg(all(test, feature = "nightly"))] | #[cfg(all(test, feature = "nightly"))] | ||||||
| extern crate test; | extern crate test; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user