|
|
|
|
@ -15,7 +15,7 @@
|
|
|
|
|
* 02110-1301, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// written by Giuseppe Longo <giuseppe@glono.it>
|
|
|
|
|
// written by Giuseppe Longo <giuseppe@glongo.it>
|
|
|
|
|
|
|
|
|
|
use nom7::bytes::streaming::{take, take_while, take_while1};
|
|
|
|
|
use nom7::character::streaming::{char, crlf};
|
|
|
|
|
@ -57,9 +57,13 @@ pub struct Response {
|
|
|
|
|
pub body_len: u16,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Valid tokens and chars are defined in RFC3261:
|
|
|
|
|
* https://www.rfc-editor.org/rfc/rfc3261#section-25.1
|
|
|
|
|
*/
|
|
|
|
|
#[inline]
|
|
|
|
|
fn is_token_char(b: u8) -> bool {
|
|
|
|
|
is_alphanumeric(b) || b"!%'*+-._`".contains(&b)
|
|
|
|
|
is_alphanumeric(b) || b"!%'*+-._`~".contains(&b)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
|
@ -69,7 +73,7 @@ fn is_method_char(b: u8) -> bool {
|
|
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
|
fn is_request_uri_char(b: u8) -> bool {
|
|
|
|
|
is_alphanumeric(b) || is_token_char(b) || b"~#@:".contains(&b)
|
|
|
|
|
is_alphanumeric(b) || is_token_char(b) || b"~#@:;=?+&$,/".contains(&b)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
|
|