Sha256: d9a71aa003feb799fe62b0127fe28755a616a436b285f7fe833b525855907810

Contents?: true

Size: 567 Bytes

Versions: 62

Compression:

Stored size: 567 Bytes

Contents

module Dragonfly
  class Job
    class FetchUrl < Step
      def get(url)
        url = parse_url(url)
        proxy_url = ENV['HTTPS_PROXY'] || ENV['HTTP_PROXY']
        proxy = URI.parse(proxy_url) if proxy_url.present?

        http = Net::HTTP.new(url.host, url.port, proxy&.host, proxy&.port)
        http.use_ssl = true if url.scheme == 'https'

        request = Net::HTTP::Get.new(url.request_uri)

        if url.user || url.password
          request.basic_auth(url.user, url.password)
        end

        http.request(request)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.4.13 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.12 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb