# File rubilicious.rb, line 542 def http_get(url) # get proxy info proxy_host, proxy_port = find_http_proxy # $stderr.puts "DEBUG: proxy: host = #{proxy_host}, port = #{proxy_port}" # get host, port, and base URI for API queries uri = URI.parse(@base_uri) base = uri.request_uri # prepend base to url url = "#{base}/#{url}" # connect to delicious http = Net::HTTP.Proxy(proxy_host, proxy_port).new(uri.host, uri.port) if uri.scheme == 'https' # check to make sure we have SSL support raise NoSSLError, "Unsupported URI scheme 'https'" unless HAVE_SSL init_http_ssl(http) end # start HTTP connection http = http.start # get URL, check for error resp = http.get(url, @headers) raise HTTPError, "HTTP #{resp.code}: #{resp.message}" unless resp.code =~ /2\d{2}/ # close HTTP connection, return response http.finish resp.body end