Skip to main content

extract_header

Function extract_header 

Source
pub fn extract_header(message: &str, name: &str) -> Vec<String>
Expand description

Extract all occurrences of a header from a raw SIP message.

Scans all lines up to the blank line separating headers from the message body. Header name matching is case-insensitive (RFC 3261 §7.3.5) and recognizes compact header forms (RFC 3261 §7.3.3): searching for "From" also matches f:, and searching for "f" also matches From:.

Header folding (continuation lines beginning with SP or HTAB) is unfolded into a single logical value per occurrence. Each header occurrence is returned as a separate entry — values are not comma-joined, per RFC 3261 §7.3.1 which forbids joining for Authorization, Proxy-Authorization, WWW-Authenticate, and Proxy-Authenticate.

Returns an empty Vec if no header with the given name is found.