Fixes #144 Use cookie jar to prevent infinite redirections loop
This commit is contained in:
@@ -180,8 +180,11 @@ class Browser
|
||||
end
|
||||
|
||||
# Disable SSL-Certificate checks
|
||||
params = params.merge(ssl_verifypeer: false)
|
||||
params = params.merge(ssl_verifyhost: 0)
|
||||
params.merge!(ssl_verifypeer: false)
|
||||
params.merge!(ssl_verifyhost: 0)
|
||||
|
||||
params.merge!(cookie_jar: CACHE_DIR + '/cookie-jar')
|
||||
params.merge!(cookie_file: CACHE_DIR + '/cookie-jar')
|
||||
|
||||
params
|
||||
end
|
||||
|
||||
@@ -47,6 +47,20 @@ module Typhoeus
|
||||
end
|
||||
end
|
||||
|
||||
module Ethon
|
||||
class Easy
|
||||
module Options
|
||||
def cookie_jar=(value)
|
||||
Curl.set_option(:cookiejar, value_for(value, :string), handle)
|
||||
end
|
||||
|
||||
def cookie_file=(value)
|
||||
Curl.set_option(:cookiefile, value_for(value, :string), handle)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Override for puts to enable logging
|
||||
def puts(o = '')
|
||||
# remove color for logging
|
||||
|
||||
@@ -260,8 +260,16 @@ describe Browser do
|
||||
end
|
||||
|
||||
describe '#merge_request_params' do
|
||||
let(:params) { {} }
|
||||
let(:default_expectation) { { cache_ttl: 250, headers: { 'User-Agent' => 'SomeUA' }, ssl_verifypeer: false, ssl_verifyhost: 0 } }
|
||||
let(:params) { {} }
|
||||
let(:cookie_jar) { CACHE_DIR + '/cookie-jar' }
|
||||
let(:default_expectation) {
|
||||
{
|
||||
cache_ttl: 250,
|
||||
headers: { 'User-Agent' => 'SomeUA' },
|
||||
ssl_verifypeer: false, ssl_verifyhost: 0,
|
||||
cookie_jar: cookie_jar, cookie_file: cookie_jar
|
||||
}
|
||||
}
|
||||
|
||||
after :each do
|
||||
@browser.stub(user_agent: 'SomeUA')
|
||||
|
||||
Reference in New Issue
Block a user