class Rex::Proto::SIP::Message
Represents a generic SIP
message
Attributes
headers[RW]
Public Class Methods
extract_headers(message)
click to toggle source
Returns a hash of header name to values mapping from the provided message, or nil if no headers are found
# File lib/rex/proto/sip/response.rb, line 28 def self.extract_headers(message) pairs = message.scan(/^([^\s:]+):\s*(.*)$/) return nil if pairs.empty? headers = {} pairs.each do |pair| headers[pair.first] ||= [] headers[pair.first] << pair.last.strip end headers end
new()
click to toggle source
# File lib/rex/proto/sip/response.rb, line 13 def initialize @headers = {} end
Public Instance Methods
header(name)
click to toggle source
Returns a list of all values from all name
headers, regardless of case, or nil if no matching header is found
# File lib/rex/proto/sip/response.rb, line 19 def header(name) matches = @headers.select { |k, _| k.downcase == name.downcase } return nil if matches.empty? matches.values.flatten end