rust-http
rust-http copied to clipboard
Case sensitivity of methods, and spec compliance
While from_str
in method.rs currently mentions that it is case insensitive, the code reads otherwise. This probably should be fixed.
Additionally, the rules for extension methods probably should match the token production given here, and fail or return None otherwise.
(I'll try my hand at this)
The rules for a valid token for extension methods can use the following method on a Vec<u8>
:
vec.iter().all(|&x| {
// http://tools.ietf.org/html/rfc2616#section-2.2
match x {
0..31 | 127 => false, // CTLs
40 | 41 | 60 | 62 | 64 |
44 | 59 | 58 | 92 | 34 |
47 | 91 | 93 | 63 | 61 |
123 | 125 | 32 => false, // separators
_ => true
}
})
}
Actually, case sensitive was correct; the comment is the thing at fault.
I quite agree about ensuring that the parsing is done correctly; that’s something that should be fixed at the type level, really; in this one place is not optimal.
Frankly, I wouldn’t bother about changing these things; rust-http is in maintenance mode, with new work taking place on Teepee. There, such compliance is being taken seriously.