mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-17 06:16:47 -06:00
- lib/cask/url.rb: initialize(): add new `:data` attribute to hold post parameters - lib/cask/download.rb: perform(): dispatch to new class based on `:using => :post` - lib/cask/download_strategy.rb: Cask::CurlPostDownloadStrategy: extend curl_args with x-www-form-urlencoded data - doc/CASK_LANGUAGE_REFERENCE.md: HTTP URLs: document new strategy - test/cask/test_download_strategy.rb: Cask::CurlPostDownloadStrategy: test new strategy
29 lines
694 B
Ruby
29 lines
694 B
Ruby
require 'forwardable'
|
|
|
|
class Cask::URL
|
|
FAKE_USER_AGENT = 'Chrome/32.0.1000.00'
|
|
|
|
attr_reader :using, :revision, :trust_cert, :uri, :cookies, :referer, :data
|
|
|
|
extend Forwardable
|
|
def_delegators :uri, :path, :scheme, :to_s
|
|
|
|
def initialize(uri, options={})
|
|
@uri = Cask::UnderscoreSupportingURI.parse(uri)
|
|
@user_agent = options[:user_agent]
|
|
@cookies = options[:cookies]
|
|
@referer = options[:referer]
|
|
@using = options[:using]
|
|
@revision = options[:revision]
|
|
@trust_cert = options[:trust_cert]
|
|
@data = options[:data]
|
|
end
|
|
|
|
def user_agent
|
|
if @user_agent == :fake
|
|
FAKE_USER_AGENT
|
|
else
|
|
@user_agent
|
|
end
|
|
end
|
|
end
|