MCPcopy Create free account
hub / github.com/619dev/minghe / extract_header_value

Function extract_header_value

src/sip/parser.rs:333–344  ·  view source on GitHub ↗

通用头部值提取 根据头部名称从 SIP 请求文本中提取对应的值

(msg: &str, name: &str)

Source from the content-addressed store, hash-verified

331///
332/// 根据头部名称从 SIP 请求文本中提取对应的值
333pub fn extract_header_value(msg: &str, name: &str) -> Option<String> {
334 let name_lower = name.to_lowercase();
335 let search_prefix = format!("{}:", name_lower);
336 for line in msg.lines() {
337 let trimmed = line.trim();
338 if trimmed.to_lowercase().starts_with(&search_prefix) {
339 let value = trimmed[name.len() + 1..].trim();
340 return Some(value.to_string());
341 }
342 }
343 None
344}
345
346/// 提取 SIP 方法名
347///

Callers 2

handle_registerMethod · 0.85
handle_byeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected