refactor(header): replace url crate with percent-encoding
This commit is contained in:
@@ -27,13 +27,13 @@ httparse = "1.0"
|
||||
language-tags = "0.2"
|
||||
log = "0.3"
|
||||
mime = "0.3.2"
|
||||
percent-encoding = "1.0"
|
||||
time = "0.1"
|
||||
tokio-core = "0.1.6"
|
||||
tokio-proto = "0.1"
|
||||
tokio-service = "0.1"
|
||||
tokio-io = "0.1"
|
||||
unicase = "2.0"
|
||||
url = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
num_cpus = "1.0"
|
||||
|
||||
@@ -4,7 +4,7 @@ use language_tags::LanguageTag;
|
||||
use std::str;
|
||||
use std::str::FromStr;
|
||||
use std::fmt::{self, Display};
|
||||
use url::percent_encoding;
|
||||
use percent_encoding;
|
||||
|
||||
use header::Raw;
|
||||
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 {
|
||||
use std::fmt;
|
||||
use url::percent_encoding;
|
||||
use 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! {
|
||||
/// This encode set is used for HTTP header values and is defined at
|
||||
/// https://tools.ietf.org/html/rfc5987#section-3.2
|
||||
// This encode set is used for HTTP header values and is defined at
|
||||
// https://tools.ietf.org/html/rfc5987#section-3.2
|
||||
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)]
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
//! If just starting out, **check out the [Guides](https://hyper.rs/guides)
|
||||
//! first.**
|
||||
|
||||
extern crate base64;
|
||||
extern crate bytes;
|
||||
#[macro_use] extern crate futures;
|
||||
extern crate futures_cpupool;
|
||||
@@ -24,14 +25,13 @@ extern crate httparse;
|
||||
extern crate language_tags;
|
||||
#[macro_use] extern crate log;
|
||||
pub extern crate mime;
|
||||
extern crate base64;
|
||||
#[macro_use] extern crate percent_encoding;
|
||||
extern crate time;
|
||||
extern crate tokio_core as tokio;
|
||||
#[macro_use] extern crate tokio_io;
|
||||
extern crate tokio_proto;
|
||||
extern crate tokio_service;
|
||||
extern crate unicase;
|
||||
#[macro_use] extern crate url;
|
||||
|
||||
#[cfg(all(test, feature = "nightly"))]
|
||||
extern crate test;
|
||||
|
||||
Reference in New Issue
Block a user