Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Authenticate < Header
- attr_accessor :scheme, :realm, :domain, :nonce, :opaque, :stale, :algorithm,
- :qop
- def initialize
- @name = "Authenticate"
- super
- end
- def assign(val_str, parse=true)
- unless parse
- cache_and_clear(val_str, [:realm, :domain, :nonce, :opaque, :stale, :algorithm, :qop])
- else
- @frozen_str = nil
- @scheme, challenge = val_str.split(" ", 2)
- challenge.split(",").each do |x|
- k, v = x.split("=", 2)
- self.send((k.strip+"=").to_sym, v.strip)
- end
- @header_params = {}
- end # parse or assign
- self
- end # assign method
- end
- class WwwAuthenticate < Authenticate
- def initialize
- @name = "WWW-Authenticate"
- super
- end
- end
- auth = SipHeaders::WwwAuthenticate.new
- puts "1"
- auth.assign challenge #challenge is a previously set string
- # I've also tried this: auth = SipHeaders::Authenticate.assign challenge
- puts "2"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement