excon 0.73.0 → 0.74.0

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
  SHA256:
3
- metadata.gz: ffdf8100e95ca826b5cd58ff8138554d05a65378c3834181bce8bbb534c329fa
4
- data.tar.gz: 17c20598f933ae2cf1a19cd66059a9ac2896ebf4b7b0aecd998c3386bc486637
3
+ metadata.gz: e0829b011c12032763ab3958668882f930250e9544fca526f4e09ebfe79ce1bf
4
+ data.tar.gz: 246229f30d08a81e9a8ecbb5195952a289e11f577ba055f1da163eada743e690
5
5
  SHA512:
6
- metadata.gz: 82dcaac1d006be38c712f2fd31707ad9d760c1f4c61e78ff3ecb54e3e1e2c0c7d303c6c015036d4d18d4e55c6490613e4765dcfde65b4e34eedea35f6c868573
7
- data.tar.gz: 489131092ef5d3c2fa0827f96e8d0ef0eae2d4e63b9664053a5da63bafdbf7b34a17f0206c73a7cb3a1b69160a24ee2d5886b799dc3a060d21360badab27d66b
6
+ metadata.gz: da31402d280f02562ee5ba62fa287f812fa4e40b1a03d968c9f6adff7fd499a0816ff6c32508b3451d433a8ed294bb45747bc0e45af30ab0914b346fa3479d8f
7
+ data.tar.gz: 6d792084962623065d48609dffbe0499ae6289d24bdf95f3535ff9530626349ac121b996bc4800723666a9c59dc5bf8e9b4dde59224d89166fc7fa0e3da01687
@@ -130,29 +130,29 @@ Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
130
130
  RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
131
131
  -----END CERTIFICATE-----
132
132
 
133
- AddTrust External Root
134
- ======================
135
- -----BEGIN CERTIFICATE-----
136
- MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
137
- QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybm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Zl
151
- j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
152
- 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
153
- e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
154
- G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
155
- -----END CERTIFICATE-----
133
+ ## AddTrust External Root
134
+ ## ======================
135
+ ## -----BEGIN CERTIFICATE-----
136
+ ## MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
137
+ ## QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
138
+ ## VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
139
+ ## NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
140
+ ## cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
141
+ ## Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
142
+ ## +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
143
+ ## Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
144
+ ## aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
145
+ ## 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
146
+ ## 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
147
+ ## BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
148
+ ## VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
149
+ ## VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
150
+ ## IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
151
+ ## j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
152
+ ## 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
153
+ ## e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
154
+ ## G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
155
+ ## -----END CERTIFICATE-----
156
156
 
157
157
  Entrust Root Certification Authority
158
158
  ====================================
@@ -488,6 +488,47 @@ module Excon
488
488
  end
489
489
  end
490
490
 
491
+ def proxy_match_host_port(host, port)
492
+ host_match = if host.is_a? IPAddr
493
+ begin
494
+ host.include? @data[:host]
495
+ rescue IPAddr::Error
496
+ false
497
+ end
498
+ else
499
+ /(^|\.)#{host}$/.match(@data[:host])
500
+ end
501
+ host_match && (port.nil? || port.to_i == @data[:port])
502
+ end
503
+
504
+ def proxy_from_env
505
+ if (no_proxy_env = ENV['no_proxy'] || ENV['NO_PROXY'])
506
+ no_proxy_list = no_proxy_env.scan(/\s*(?:\[([\dA-Fa-f:\/]+)\]|\*?\.?([^\s,:]+))(?::(\d+))?\s*/i).map { |e|
507
+ if e[0]
508
+ begin
509
+ [IPAddr.new(e[0]), e[2]]
510
+ rescue IPAddr::Error
511
+ nil
512
+ end
513
+ else
514
+ begin
515
+ [IPAddr.new(e[1]), e[2]]
516
+ rescue IPAddr::Error
517
+ [e[1], e[2]]
518
+ end
519
+ end
520
+ }.reject { |e| e.nil? || e[0].nil? }
521
+ end
522
+
523
+ unless no_proxy_env && no_proxy_list.index { |h| proxy_match_host_port(h[0], h[1]) }
524
+ if @data[:scheme] == HTTPS && (ENV.has_key?('https_proxy') || ENV.has_key?('HTTPS_PROXY'))
525
+ @data[:proxy] = ENV['https_proxy'] || ENV['HTTPS_PROXY']
526
+ elsif (ENV.has_key?('http_proxy') || ENV.has_key?('HTTP_PROXY'))
527
+ @data[:proxy] = ENV['http_proxy'] || ENV['HTTP_PROXY']
528
+ end
529
+ end
530
+ end
531
+
491
532
  def setup_proxy
492
533
  if @data[:disable_proxy]
493
534
  if @data[:proxy]
@@ -496,64 +537,54 @@ module Excon
496
537
  return
497
538
  end
498
539
 
499
- unless @data[:scheme] == UNIX
500
- if no_proxy_env = ENV["no_proxy"] || ENV["NO_PROXY"]
501
- no_proxy_list = no_proxy_env.scan(/\*?\.?([^\s,:]+)(?::(\d+))?/i).map { |s| [s[0], s[1]] }
540
+ return if @data[:scheme] == UNIX
541
+
542
+ proxy_from_env
543
+
544
+ case @data[:proxy]
545
+ when nil
546
+ @data.delete(:proxy)
547
+ when ''
548
+ @data.delete(:proxy)
549
+ when Hash
550
+ # no processing needed
551
+ when String, URI
552
+ uri = @data[:proxy].is_a?(String) ? URI.parse(@data[:proxy]) : @data[:proxy]
553
+ @data[:proxy] = {
554
+ :host => uri.host,
555
+ :hostname => uri.hostname,
556
+ # path is only sensible for a Unix socket proxy
557
+ :path => uri.scheme == UNIX ? uri.path : nil,
558
+ :port => uri.port,
559
+ :scheme => uri.scheme,
560
+ }
561
+ if uri.password
562
+ @data[:proxy][:password] = uri.password
502
563
  end
503
-
504
- unless no_proxy_env && no_proxy_list.index { |h| /(^|\.)#{h[0]}$/.match(@data[:host]) && (h[1].nil? || h[1].to_i == @data[:port]) }
505
- if @data[:scheme] == HTTPS && (ENV.has_key?('https_proxy') || ENV.has_key?('HTTPS_PROXY'))
506
- @data[:proxy] = ENV['https_proxy'] || ENV['HTTPS_PROXY']
507
- elsif (ENV.has_key?('http_proxy') || ENV.has_key?('HTTP_PROXY'))
508
- @data[:proxy] = ENV['http_proxy'] || ENV['HTTP_PROXY']
509
- end
564
+ if uri.user
565
+ @data[:proxy][:user] = uri.user
510
566
  end
511
-
512
- case @data[:proxy]
513
- when nil
514
- @data.delete(:proxy)
515
- when ''
516
- @data.delete(:proxy)
517
- when Hash
518
- # no processing needed
519
- when String, URI
520
- uri = @data[:proxy].is_a?(String) ? URI.parse(@data[:proxy]) : @data[:proxy]
521
- @data[:proxy] = {
522
- :host => uri.host,
523
- :hostname => uri.hostname,
524
- # path is only sensible for a Unix socket proxy
525
- :path => uri.scheme == UNIX ? uri.path : nil,
526
- :port => uri.port,
527
- :scheme => uri.scheme,
528
- }
529
- if uri.password
530
- @data[:proxy][:password] = uri.password
531
- end
532
- if uri.user
533
- @data[:proxy][:user] = uri.user
534
- end
535
- if @data[:proxy][:scheme] == UNIX
536
- if @data[:proxy][:host]
537
- raise ArgumentError, "The `:host` parameter should not be set for `unix://` proxies.\n" +
538
- "When supplying a `unix://` URI, it should start with `unix:/` or `unix:///`."
539
- end
540
- else
541
- unless uri.host && uri.port && uri.scheme
542
- raise Excon::Errors::ProxyParse, "Proxy is invalid"
543
- end
567
+ if @data[:proxy][:scheme] == UNIX
568
+ if @data[:proxy][:host]
569
+ raise ArgumentError, "The `:host` parameter should not be set for `unix://` proxies.\n" +
570
+ "When supplying a `unix://` URI, it should start with `unix:/` or `unix:///`."
544
571
  end
545
572
  else
546
- raise Excon::Errors::ProxyParse, "Proxy is invalid"
573
+ unless uri.host && uri.port && uri.scheme
574
+ raise Excon::Errors::ProxyParse, "Proxy is invalid"
575
+ end
547
576
  end
577
+ else
578
+ raise Excon::Errors::ProxyParse, "Proxy is invalid"
579
+ end
548
580
 
549
- if @data.has_key?(:proxy) && @data[:scheme] == 'http'
550
- @data[:headers]['Proxy-Connection'] ||= 'Keep-Alive'
551
- # https credentials happen in handshake
552
- if @data[:proxy].has_key?(:user) || @data[:proxy].has_key?(:password)
553
- user, pass = Utils.unescape_form(@data[:proxy][:user].to_s), Utils.unescape_form(@data[:proxy][:password].to_s)
554
- auth = ["#{user}:#{pass}"].pack('m').delete(Excon::CR_NL)
555
- @data[:headers]['Proxy-Authorization'] = 'Basic ' + auth
556
- end
581
+ if @data.has_key?(:proxy) && @data[:scheme] == 'http'
582
+ @data[:headers]['Proxy-Connection'] ||= 'Keep-Alive'
583
+ # https credentials happen in handshake
584
+ if @data[:proxy].has_key?(:user) || @data[:proxy].has_key?(:password)
585
+ user, pass = Utils.unescape_form(@data[:proxy][:user].to_s), Utils.unescape_form(@data[:proxy][:password].to_s)
586
+ auth = ["#{user}:#{pass}"].pack('m').delete(Excon::CR_NL)
587
+ @data[:headers]['Proxy-Authorization'] = 'Basic ' + auth
557
588
  end
558
589
  end
559
590
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Excon
3
- VERSION = '0.73.0'
3
+ VERSION = '0.74.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.73.0
4
+ version: 0.74.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dpiddy (Dan Peterson)
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-03-17 00:00:00.000000000 Z
13
+ date: 2020-06-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec