Class URI::HTTP
In: lib/uri/http_ex.rb
Parent: Object

Methods

checkout  

Public Instance methods

[Source]

# File lib/uri/http_ex.rb, line 16
    def checkout
      tmp = TempPath.new('checkout', pathname.basename.to_s)

      begin
        uri = URI.parse(ENV['http_proxy'] || '')
        proxy_auth = [uri.host, uri.port, uri.user, uri.password]

        Net::HTTP::Proxy(*proxy_auth).start(host) do |http|
          tmp.open('w') do |out|
            http.get(path) do |str|
              out.print str
            end
          end
        end

      rescue Exception => ex
        tmp.unlink if tmp.exist?
        raise CheckoutError, "Cannot checkout #{to_s} (error: #{ex.short_pp})"
      end

      [tmp, nil]
    end

[Validate]