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.5.27 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.26 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.45 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.25 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.23 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.44 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.22 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.43 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.21 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.42 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.20 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.41 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.19 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.40 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.18 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.39 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.17 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.38 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.16 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.37 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb