pincers 0.7.8 → 0.7.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4526e8ccc6d3ead10746ee9d7e95e473d063c467
4
- data.tar.gz: 70fc43f5a6664ccbef9b0235db56e22065472882
3
+ metadata.gz: 7800842ba137af69fd78dd8480ed2a179e15230c
4
+ data.tar.gz: bbc37cecae8ce359fb2c3624a2c740323c108328
5
5
  SHA512:
6
- metadata.gz: 2ed5d778279256c922d66d71f763849edfc99f7060d818365a7ea73ffae06c5e3f7adf724d77021a05babd234f611e54c3898b657128f97a2ba81012acfc40f8
7
- data.tar.gz: a911e5c4a3cb633f16308e6c03b4b27501f5241a0d2a1261a04e2f8d1e7acbb9df7e716f7aa2401874695a2c10032e334350c98e613b8bd70c5a2f01f8236394
6
+ metadata.gz: 9de52857c3280978860ab39012a2d4b5f2dae5a106451f5c1f36de7cfeb1870fffad7b95e2e3d0b52c9b5fa983e09e06f1d9a0641365301cc2047f9dd429e089
7
+ data.tar.gz: f3ff2d63ede9741e105fe1aefbd63e20a01108a3dcd31034e2916d5bbc08517e6b65a9e8351d2d07ed546cda6316a6be7a366dbb5263b07c3146beb4152a712a
@@ -13,6 +13,7 @@ module Pincers::Http
13
13
  def self.build_from_options(_options = {})
14
14
  session = Session.new
15
15
  session.proxy = _options[:proxy] if _options.key? :proxy
16
+ session.proxy_auth = _options[:proxy_auth] if _options.key? :proxy_auth
16
17
  session.headers.merge! _options[:headers] if _options.key? :headers
17
18
  session.redirect_limit = _options[:redirect_limit] if _options.key? :redirect_limit
18
19
 
@@ -11,7 +11,7 @@ module Pincers::Http
11
11
  }
12
12
 
13
13
  attr_reader :cookie_jar, :headers
14
- attr_accessor :proxy_addr, :proxy_port, :redirect_limit
14
+ attr_accessor :proxy_addr, :proxy_port, :proxy_user, :proxy_password, :redirect_limit
15
15
 
16
16
  def initialize(_other = nil)
17
17
  if _other
@@ -35,6 +35,14 @@ module Pincers::Http
35
35
  end
36
36
  end
37
37
 
38
+ def proxy_auth=(_value)
39
+ if _value
40
+ @proxy_user, @proxy_password = _value.split ':'
41
+ else
42
+ @proxy_user, @proxy_password = [nil, nil]
43
+ end
44
+ end
45
+
38
46
  def clone
39
47
  self.class.new self
40
48
  end
@@ -84,7 +92,15 @@ module Pincers::Http
84
92
  end
85
93
 
86
94
  def connect(_uri)
87
- conn = Net::HTTP.new _uri.host, _uri.port || 80, @proxy_addr, @proxy_port
95
+ conn = Net::HTTP.new(
96
+ _uri.host,
97
+ _uri.port || 80,
98
+ proxy_addr,
99
+ proxy_port,
100
+ proxy_user,
101
+ proxy_password
102
+ )
103
+
88
104
  conn.use_ssl = true if _uri.scheme == 'https'
89
105
  conn.verify_mode = OpenSSL::SSL::VERIFY_NONE
90
106
  conn
@@ -1,3 +1,3 @@
1
1
  module Pincers
2
- VERSION = "0.7.8"
2
+ VERSION = "0.7.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pincers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.8
4
+ version: 0.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ignacio Baixas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-03 00:00:00.000000000 Z
11
+ date: 2016-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri