1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
use *;
/// Reports whether a cookie name may appear in a `Set-Cookie` header.
///
/// RFC 6265 Section 4.1.1 takes the name from the token production of
/// RFC 2616 Section 2.2, which admits the letters, the digits and a fixed
/// set of punctuation, and refuses the controls, the whitespace and the
/// separators. A name that carries a separator would end the name early
/// and turn the rest of it into an attribute.
///
/// # Arguments
///
/// - `&str` - The cookie name.
///
/// # Returns
///
/// - `bool` - `true` when the name is a token.
/// Reports whether a cookie value may appear in a `Set-Cookie` header.
///
/// The value sits between the name and the end of the cookie pair, so it may
/// not carry a byte that would end the pair or the header line: a control
/// byte would end the header line and turn the rest of the cookie into a
/// second header, a semicolon would start another attribute, a comma would
/// make the header ambiguous when several cookies are folded into one field
/// as RFC 6265 Section 3 warns, and the double quote and the backslash
/// would make the value ambiguous against the quoted form of the grammar in
/// RFC 6265 Section 4.1.1.
///
/// # Arguments
///
/// - `&str` - The cookie value.
///
/// # Returns
///
/// - `bool` - `true` when the value may appear in a header.
/// Reports whether a cookie attribute value may appear in a `Set-Cookie`
/// header.
///
/// An attribute carries a date, a domain, a path or a policy, and a date
/// legitimately carries a comma and spaces, so the only bytes refused are
/// the ones that would end the header line or start another attribute.
///
/// # Arguments
///
/// - `&str` - The attribute value.
///
/// # Returns
///
/// - `bool` - `true` when the attribute value may appear in a header.
/// Reports whether a byte is a control byte.
///
/// # Arguments
///
/// - `u8` - The byte to check.
///
/// # Returns
///
/// - `bool` - `true` when the byte is a control byte.
/// Reports whether a byte may appear in a token.
///
/// # Arguments
///
/// - `u8` - The byte to check.
///
/// # Returns
///
/// - `bool` - `true` when the byte may appear in a token.
/// Reports whether a byte would end the cookie pair or make it ambiguous.
///
/// # Arguments
///
/// - `u8` - The byte to check.
///
/// # Returns
///
/// - `bool` - `true` when the byte may not appear in a cookie value.