From: Richard Whitehouse Date: Sun, 29 Oct 2017 20:59:47 +0000 (+0000) Subject: Support Require header X-Git-Url: https://git.richardwhiuk.com/?a=commitdiff_plain;h=e1fe0e34779c780922ca25b94aa1068829f60b32;p=rust-sip.git Support Require header --- diff --git a/src/codec.rs b/src/codec.rs index f6c4ab9..28be0fa 100644 --- a/src/codec.rs +++ b/src/codec.rs @@ -443,7 +443,8 @@ mod tests { 30\r\nOrganization:Foobar\r\nPriority:normal\r\nProxy-Authenticate:\ Digest realm=\"atlanta.com\"\r\nProxy-Authorization:Digest \ username=\"Bob\"\r\nProxy-Require:foo\r\nRecord-Route:\r\nReply-To:\r\nVia: localhost\r\n\r\n") + biloxi.com;lr>\r\nReply-To:\r\nRequire:baz\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 f36c8cc..4d419d4 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1067,6 +1067,12 @@ named!(reply_to_header>, preceded!( tag!(b","), reply_to))); +named!(require_header>, preceded!( + tag!(b"Require:"), + separated_nonempty_list!( + tag!(b","), + token))); + named!(pub header
, alt!( // RFC 3261 Headers accept_header => { |a| Header::Accept(a) } | @@ -1099,5 +1105,6 @@ named!(pub header
, alt!( proxy_authorization_header => { |p| Header::ProxyAuthorization(p) } | proxy_require_header => { |p| Header::ProxyRequire(p) } | record_route_header => { |r| Header::RecordRoute(r) } | - reply_to_header => { |r| Header::ReplyTo(r) } + reply_to_header => { |r| Header::ReplyTo(r) } | + require_header => { |r| Header::Require(r) } )); diff --git a/src/types.rs b/src/types.rs index f2c3eb9..a409639 100644 --- a/src/types.rs +++ b/src/types.rs @@ -412,6 +412,7 @@ pub enum Header { ProxyRequire(Vec), RecordRoute(Vec), ReplyTo(Vec), + Require(Vec), To(Uri), Extension { name: String, value: String }, }