class Security::Password

def flags_for_options(options = {})

def flags_for_options(options = {})
  keychain=options.delete(:keychain)
  url=options.delete(:url)
  if !url.nil?
    uri=URI.parse(url)
    raise 'only https' unless uri.scheme.eql?('https')
    options[:r]='htps'
    raise 'host required in URL' if uri.host.nil?
    options[:s]=uri.host
    options[:p]=uri.path unless ['','/'].include?(uri.path)
    options[:P]=uri.port unless uri.port.eql?(443) and !url.include?(':443/')
  end
  flags=[orig_flags_for_options(options)]
  flags.push(keychain.filename) unless keychain.nil?
  flags.join(' ')
end