lib/client/utils.rb in stomp-1.3.5 vs lib/client/utils.rb in stomp-1.4.0

- old
+ new

@@ -18,12 +18,15 @@ true end def parse_stomp_url(login) + original_verbose, $VERBOSE = $VERBOSE, nil # shut off warnings regexp = /^stomp:\/\/#{URL_REPAT}/ - return false unless url = regexp.match(login) + url = regexp.match(login) + $VERBOSE = original_verbose + return false unless url @parameters = { :reliable => false, :hosts => [ { :login => url[3] || "", :passcode => url[4] || "", :host => url[5], @@ -32,11 +35,14 @@ end # e.g. failover://(stomp://login1:passcode1@localhost:61616,stomp://login2:passcode2@remotehost:61617)?option1=param def parse_failover_url(login) rval = nil - if md = FAILOVER_REGEX.match(login) + original_verbose, $VERBOSE = $VERBOSE, nil # shut off warnings + md = FAILOVER_REGEX.match(login) + $VERBOSE = original_verbose + if md finhosts = parse_hosts(login) options = {} if md_last = md[-1] parts = md_last.split(/&|=/) @@ -73,19 +79,21 @@ end # Parse a stomp URL. def parse_hosts(url) hosts = [] + original_verbose, $VERBOSE = $VERBOSE, nil # shut off warnings host_match = /stomp(\+ssl)?:\/\/#{URL_REPAT}/ url.scan(host_match).each do |match| host = {} host[:ssl] = match[0] == "+ssl" ? true : false host[:login] = match[3] || "" host[:passcode] = match[4] || "" host[:host] = match[5] host[:port] = match[6].to_i hosts << host end + $VERBOSE = original_verbose hosts end # A sanity check of required arguments. def check_arguments!()