فهرست منبع

rename VALUE_CHARS to HTTP_VALUE; flesh out code

Mike Dilger 11 سال پیش
والد
کامیت
00fd5e3af3
3فایلهای تغییر یافته به همراه5 افزوده شده و 2 حذف شده
  1. 1 1
      make_encode_sets.py
  2. 1 1
      src/encode_sets.rs
  3. 3 0
      src/percent_encoding.rs

+ 1 - 1
make_encode_sets.py

@@ -29,7 +29,7 @@ for name, encoded in [
     ('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"

+ 1 - 1
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",

+ 3 - 0
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`.
 ///