lib/client/utils.rb in stomp-1.4.3 vs lib/client/utils.rb in stomp-1.4.4

- old
+ new

@@ -23,16 +23,19 @@ original_verbose, $VERBOSE = $VERBOSE, nil # shut off warnings regexp = /^stomp:\/\/#{URL_REPAT}/ url = regexp.match(login) $VERBOSE = original_verbose return false unless url - + @login = url[3] || "" + @passcode = url[4] || "" + @host = url[5] + @port = url[6].to_i @parameters = { :reliable => false, - :hosts => [ { :login => url[3] || "", - :passcode => url[4] || "", - :host => url[5], - :port => url[6].to_i} ] } + :hosts => [ { :login => @login, + :passcode => @passcode, + :host => @host, + :port => @port} ] } true end # e.g. failover://(stomp://login1:passcode1@localhost:61616,stomp://login2:passcode2@remotehost:61617)?option1=param def parse_failover_url(login) @@ -76,10 +79,11 @@ end def build_subscription_id(destination, headers) return headers[:id] until headers[:id].nil? return headers['id'] until headers['id'].nil? + # p [ "DBBSID1", destination, headers ] Digest::SHA1.hexdigest(destination) end # Parse a stomp URL. def parse_hosts(url) @@ -104,11 +108,11 @@ raise ArgumentError.new("missing :hosts parameter") unless @parameters[:hosts] raise ArgumentError.new("invalid :hosts type") unless @parameters[:hosts].is_a?(Array) @parameters[:hosts].each do |hv| # Validate port requested raise ArgumentError.new("empty :port value in #{hv.inspect}") if hv[:port] == '' - unless hv[:port].nil? + unless hv[:port].nil? tpv = hv[:port].to_i raise ArgumentError.new("invalid :port value=#{tpv} from #{hv.inspect}") if tpv < 1 || tpv > 65535 end # Validate host requested (no validation here. if nil or '', localhost will # be used in #Connection.) @@ -202,6 +206,5 @@ end # method start_listeners end # class Client end # module Stomp -