Support Require header
authorRichard Whitehouse <github@richardwhiuk.com>
Sun, 29 Oct 2017 20:59:47 +0000 (20:59 +0000)
committerRichard Whitehouse <github@richardwhiuk.com>
Sun, 29 Oct 2017 20:59:47 +0000 (20:59 +0000)
src/codec.rs
src/parser.rs
src/types.rs

index f6c4ab942e4071aba28b951451e925789f73cf7e..28be0fa414490c4a209e6ba745ef7e98b1e4a19b 100644 (file)
@@ -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:<sip:server10.\
-                           biloxi.com;lr>\r\nReply-To:<sip:bob@biloxi.com>\r\nVia: localhost\r\n\r\n")
+                           biloxi.com;lr>\r\nReply-To:<sip:bob@biloxi.com>\r\nRequire:baz\r\nVia: \
+                           localhost\r\n\r\n")
         });
 
         let finished = request.and_then(|(socket, _request)| {
index f36c8cc85924d88ab6d73eb647c653d642a2f6ff..4d419d449c3a440963c4658bb3dc80754b8f07c9 100644 (file)
@@ -1067,6 +1067,12 @@ named!(reply_to_header<Vec<ReplyTo>>, preceded!(
                tag!(b","),
                reply_to)));
 
+named!(require_header<Vec<OptionTag>>, preceded!(
+       tag!(b"Require:"),
+       separated_nonempty_list!(
+               tag!(b","),
+               token)));
+
 named!(pub header<Header>, alt!(
 // RFC 3261 Headers
        accept_header => { |a| Header::Accept(a) } |
@@ -1099,5 +1105,6 @@ named!(pub header<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) }
 ));
index f2c3eb92b9c8a8d2479fec114d74335d05e159ec..a40963960edf41f01604967175375599fab3a8d2 100644 (file)
@@ -412,6 +412,7 @@ pub enum Header {
     ProxyRequire(Vec<OptionTag>),
     RecordRoute(Vec<Route>),
     ReplyTo(Vec<ReplyTo>),
+    Require(Vec<OptionTag>),
     To(Uri),
     Extension { name: String, value: String },
 }