hiptest-publisher 0.16.0 → 0.16.1

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: 20c1d16465040a12151db97650035e0d15079a1b
4
- data.tar.gz: 47ea43b341b4f4dc9e70aa5318c20b4007089eb2
3
+ metadata.gz: 29270dc394e18dfca03310de5ce563a722c18000
4
+ data.tar.gz: 2734c798f1eea999baf81592ec684fa3020cfacc
5
5
  SHA512:
6
- metadata.gz: 1b0b40c87019d0eed0133d5e9a7bfeb4ff2e1618cd5ff82e9d21d71589602614957f6e8681d3191474d1959cb20216d5153416e594cf61db6df8e66541d9fed6
7
- data.tar.gz: ad6fd0d858a81a7cac1ae28ef733f9105637fe71261ac9f0ec4563a166ced4de45e22421b73604f14a12e7195fcc1014a30a01983a5429d6dc7b9cfa667417aa
6
+ metadata.gz: f6387b718d78b9ef0f6490200ea2b9a3f38153ab5a669be312847c6c9d141ff76b005e98f28314d259345a320874a9de5d2e51ee41cf202110441d6e2b92e7b0
7
+ data.tar.gz: abdb1e5309327007261cc9e21346c1644b169c26a3cb70bb3de1ccf8fad78560ece9dc62d34449beff845394c2a03a0ae0bd84b4405d1777da43d1ddd18a8361
@@ -117,15 +117,25 @@ module Hiptest
117
117
 
118
118
  def send_request(request)
119
119
  request["User-Agent"] = "Ruby/hiptest-publisher"
120
- # Using Net::HTTP.new will use http proxy if http_proxy env var is set.
121
- # Using Net::HTTP.start would not.
122
- http = Net::HTTP.new(request.uri.hostname, request.uri.port)
123
- http.use_ssl = request.uri.scheme == "https"
124
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
125
- http.start do |http|
120
+ use_ssl = request.uri.scheme == "https"
121
+ proxy_uri = find_proxy_uri(request.uri.hostname, request.uri.port)
122
+ proxy_address = proxy_uri&.hostname
123
+ proxy_port = proxy_uri&.port
124
+ proxy_user, proxy_pass = proxy_uri&.userinfo&.split(':', 2)
125
+ Net::HTTP.start(
126
+ request.uri.hostname, request.uri.port,
127
+ proxy_address, proxy_port, proxy_user, proxy_pass,
128
+ use_ssl: use_ssl,
129
+ verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
126
130
  @reporter.show_verbose_message("Request sent to: #{request.uri}")
127
131
  http.request(request)
128
132
  end
129
133
  end
134
+
135
+ def find_proxy_uri(address, port)
136
+ URI::HTTP.new(
137
+ "http", nil, address, port, nil, nil, nil, nil, nil
138
+ ).find_proxy
139
+ end
130
140
  end
131
141
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiptest-publisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiptest R&D
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-02 00:00:00.000000000 Z
11
+ date: 2016-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize