diff --git a/make_encode_sets.py b/make_encode_sets.py index a0bcbfbd1..eb859050f 100644 --- a/make_encode_sets.py +++ b/make_encode_sets.py @@ -29,7 +29,7 @@ ('PASSWORD', r''' "#<>`?{}@\/'''), ('USERNAME', r''' "#<>`?{}@\/:'''), ('FORM_URLENCODED', r''' !"#$%&\'()+,/:;<=>?@[\]^`{|}~'''), - ('VALUE_CHARS', r''' "%'()*,/:;<->?[\]{}'''), + ('HTTP_VALUE', r''' "%'()*,/:;<->?[\]{}'''), ]: print( "pub static %s: [&'static str; 256] = [\n%s\n];\n\n" diff --git a/src/encode_sets.rs b/src/encode_sets.rs index 6d51f2680..d7b5fb9d9 100644 --- a/src/encode_sets.rs +++ b/src/encode_sets.rs @@ -260,7 +260,7 @@ pub static FORM_URLENCODED: [&'static str; 256] = [ ]; -pub static VALUE_CHARS: [&'static str; 256] = [ +pub static HTTP_VALUE: [&'static str; 256] = [ "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07", "%08", "%09", "%0A", "%0B", "%0C", "%0D", "%0E", "%0F", "%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17", diff --git a/src/percent_encoding.rs b/src/percent_encoding.rs index 90b8f90f6..146bede2f 100644 --- a/src/percent_encoding.rs +++ b/src/percent_encoding.rs @@ -55,6 +55,9 @@ pub static FORM_URLENCODED_ENCODE_SET: EncodeSet = EncodeSet { map: &encode_sets::FORM_URLENCODED, }; +/// This encode set is used for HTTP header values and is defined at +/// https://tools.ietf.org/html/rfc5987#section-3.2 +pub static HTTP_VALUE_ENCODE_SET: EncodeSet = EncodeSet { map: &encode_sets::HTTP_VALUE }; /// Percent-encode the given bytes, and push the result to `output`. ///