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.27 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.4 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.26 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.3 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.25 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.2 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.24 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.1 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.23 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.22 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.0 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.21 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.5.0.beta.1 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.20 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.19 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.18 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.17 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.16 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.15 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb
workarea-core-3.4.14 lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb