# File lib/plugins/expand-tinyurl.rb, line 46
def expand_url(host, path)
  http_class = Net::HTTP
  unless config.proxy.host.nil? or config.proxy.host.empty?
    http_class = Net::HTTP::Proxy(config.proxy.host,
                                  config.proxy.port,
                                  config.proxy.user_name,
                                  config.proxy.password)
  end
  res = http_class.new(host).head(path)
  return nil unless res.code == "301" or res.code == "302"
  res['Location'].force_encoding(Encoding::UTF_8)
rescue
  nil
end