From: Richard Whitehouse Date: Sun, 29 Oct 2017 12:02:39 +0000 (+0000) Subject: Support Allow header X-Git-Url: https://git.richardwhiuk.com/?a=commitdiff_plain;h=6372b6448c0dc3c4d421afa599586934915216a6;p=rust-sip.git Support Allow header --- diff --git a/src/codec.rs b/src/codec.rs index 044f2cf..7fa20c0 100644 --- a/src/codec.rs +++ b/src/codec.rs @@ -428,7 +428,7 @@ mod tests { io::write_all(socket, "MESSAGE sip:test.com \ SIP/2.0\r\nAccept:text/plain\r\nAccept-Encoding:*\r\nAccept-Language:\ - en-gb\r\nAlert-Info:\r\nVia: \ + en-gb\r\nAlert-Info:\r\nAllow:MESSAGE\r\nVia: \ localhost\r\n\r\n") }); diff --git a/src/parser.rs b/src/parser.rs index 3f8b08e..fa4051d 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -577,10 +577,17 @@ named!(alert_info_header>, preceded!( tag!(b","), alert_param))); +named!(allow_header>, preceded!( + tag!(b"Allow:"), + separated_nonempty_list!( + tag!(b","), + method))); + named!(pub header
, alt!( // RFC 3261 Headers accept_header => { |a| Header::Accept(a) } | accept_encoding_header => { |a| Header::AcceptEncoding(a) } | accept_language_header => { |a| Header::AcceptLanguage(a) } | - alert_info_header => { |a| Header::AlertInfo(a) } + alert_info_header => { |a| Header::AlertInfo(a) } | + allow_header => { |a| Header::Allow(a) } )); diff --git a/src/types.rs b/src/types.rs index 467ca98..cc3c842 100644 --- a/src/types.rs +++ b/src/types.rs @@ -191,6 +191,7 @@ pub enum Header { AcceptEncoding(Vec), AcceptLanguage(Vec), AlertInfo(Vec), + Allow(Vec), From(Uri), To(Uri), Extension { name: String, value: String },