From: Richard Whitehouse Date: Sun, 29 Oct 2017 23:14:14 +0000 (+0000) Subject: Support Unsupported header X-Git-Url: https://git.richardwhiuk.com/?a=commitdiff_plain;h=0d3362d11c1e5321bf4cf067fcdce447af160d9e;p=rust-sip.git Support Unsupported header --- diff --git a/src/codec.rs b/src/codec.rs index 520986e..a4b2cf3 100644 --- a/src/codec.rs +++ b/src/codec.rs @@ -447,8 +447,8 @@ mod tests { baz\r\nRetry-After:18000;duration=3600\r\nRoute:\r\nServer:rust-sip \ tokio\r\nSubject:Foobaz\r\nSupported:rec\r\nTimestamp:1 \ - 2\r\nTo:;tag=287447\r\nVia: \ - localhost\r\n\r\n") + 2\r\nTo:;tag=287447\r\nUnsupported:\ + 100rel\r\nVia: localhost\r\n\r\n") }); let finished = request.and_then(|(socket, _request)| { diff --git a/src/parser.rs b/src/parser.rs index fb62ef9..c5e6ac9 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1146,6 +1146,12 @@ named!(to_header, preceded!( tag!(b";"), to_param))))); +named!(unsupported_header>, preceded!( + tag!(b"Unsupported:"), + separated_nonempty_list!( + tag!(b","), + token))); + named!(pub header
, alt!( // RFC 3261 Headers accept_header => { |a| Header::Accept(a) } | @@ -1186,5 +1192,6 @@ named!(pub header
, alt!( subject_header => { |s| Header::Subject(s) } | supported_header => { |s| Header::Supported(s) } | timestamp_header => { |t| Header::Timestamp(t) } | - to_header => { |t| Header::To(t) } + to_header => { |t| Header::To(t) } | + unsupported_header => { |u| Header::Unsupported(u) } )); diff --git a/src/types.rs b/src/types.rs index a126d35..766242f 100644 --- a/src/types.rs +++ b/src/types.rs @@ -438,5 +438,6 @@ pub enum Header { Supported(Vec), Timestamp(Vec), To(To), + Unsupported(Vec), Extension { name: String, value: String }, }