From: Richard Whitehouse Date: Sun, 29 Oct 2017 20:20:27 +0000 (+0000) Subject: Support Proxy-Require header X-Git-Url: https://git.richardwhiuk.com/?a=commitdiff_plain;h=00eaae9406a30993bd0222f42ec00c3d6871c751;p=rust-sip.git Support Proxy-Require header --- diff --git a/src/codec.rs b/src/codec.rs index 223f5ed..7deb71f 100644 --- a/src/codec.rs +++ b/src/codec.rs @@ -442,7 +442,7 @@ mod tests { bell-tel.com\r\nMax-Forwards:32\r\nMIME-Version:2.0\r\nMin-Expires:\ 30\r\nOrganization:Foobar\r\nPriority:normal\r\nProxy-Authenticate:\ Digest realm=\"atlanta.com\"\r\nProxy-Authorization:Digest \ - username=\"Bob\"\r\nVia: localhost\r\n\r\n") + username=\"Bob\"\r\nProxy-Require:foo\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 e7738d7..7123883 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -17,7 +17,7 @@ use types::{PathSegment, HostPort, Host, Hostname, UriParameter, UriHeader, UriH Credentials, CallId, Purpose, InfoParam, Info, NameAddr, ContactParam, Target, Contact, DispositionType, Handling, DispositionParam, ContentCoding, Day, Month, Date, Time, DateTime, ErrorUri, FromParam, From, Priority, Domain, DigestChallenge, - Challenge}; + Challenge, OptionTag}; fn is_mark(c: u8) -> bool { c == b'-' || c == b'_' || c == b'.' || c == b'!' || c == b'~' || c == b'*' || c == b'\'' || @@ -1037,6 +1037,12 @@ named!(proxy_authorization_header, preceded!( tag!(b"Proxy-Authorization:"), credentials)); +named!(proxy_require_header>, preceded!( + tag!(b"Proxy-Require:"), + separated_nonempty_list!( + tag!(b","), + token))); + named!(pub header
, alt!( // RFC 3261 Headers accept_header => { |a| Header::Accept(a) } | @@ -1066,5 +1072,6 @@ named!(pub header
, alt!( organization_header => { |o| Header::Organization(o) } | priority_header => { |p| Header::Priority(p) } | proxy_authenticate_header => { |p| Header::ProxyAuthenticate(p) } | - proxy_authorization_header => { |p| Header::ProxyAuthorization(p) } + proxy_authorization_header => { |p| Header::ProxyAuthorization(p) } | + proxy_require_header => { |p| Header::ProxyRequire(p) } )); diff --git a/src/types.rs b/src/types.rs index 201379d..17fa3a3 100644 --- a/src/types.rs +++ b/src/types.rs @@ -373,6 +373,8 @@ pub enum Challenge { Other(Vec, Vec), } +pub type OptionTag = Vec; + #[derive(Debug)] pub enum Header { Accept(Vec), @@ -403,6 +405,7 @@ pub enum Header { Priority(Priority), ProxyAuthenticate(Challenge), ProxyAuthorization(Credentials), + ProxyRequire(Vec), To(Uri), Extension { name: String, value: String }, }