no_proxy_fix 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8c0dc4449d7c7c03d699bbcd65104f86cfadf1bf
4
+ data.tar.gz: 9d2d52834f50440a76de641f8758ff85b99f2eb0
5
+ SHA512:
6
+ metadata.gz: 95cca4964fe8480a4c8c24d99152914edc473ff188dc443d709b4f56fe519b6f397307946b2ab1b30b12a6b0fb256a5346d82479f466ee63d4e411955b4923c0
7
+ data.tar.gz: d94366169343b0197a3b8d6d9b1f178972eb885acce63c8957de58920ac9026a42165fd2c05397476f43c4cdb6c6caf149af50be96c9285b324cb51e47db35a3
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /spec/examples.txt
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,12 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ Exclude:
5
+ - 'lib/cext/generic_find_proxy.rb'
6
+
7
+ Style/Documentation:
8
+ Enabled: false
9
+
10
+ Metrics/BlockLength:
11
+ Exclude:
12
+ - 'spec/**/*'
data/.rubocop_todo.yml ADDED
File without changes
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2
5
+ - 2.0
6
+ - 2.1
7
+ - 2.2
8
+ - 2.3.1
9
+ - 2.4.0
10
+ before_install:
11
+ - gem update --system
12
+ - gem install bundler
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in no_proxy_fix.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,46 @@
1
+ guard :bundler do
2
+ require 'guard/bundler'
3
+ require 'guard/bundler/verify'
4
+ helper = Guard::Bundler::Verify.new
5
+
6
+ files = ['Gemfile']
7
+ files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
8
+
9
+ # Assume files are symlinked from somewhere
10
+ files.each { |file| watch(helper.real_path(file)) }
11
+ end
12
+
13
+ # Note: The cmd option is now required due to the increasing number of ways
14
+ # rspec may be run, below are examples of the most common uses.
15
+ # * bundler: 'bundle exec rspec'
16
+ # * bundler binstubs: 'bin/rspec'
17
+ # * spring: 'bin/rspec' (This will use spring if running and you have
18
+ # installed the spring binstubs per the docs)
19
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
20
+ # * 'just' rspec: 'rspec'
21
+
22
+ guard :rspec, cmd: 'bundle exec rspec' do
23
+ require 'guard/rspec/dsl'
24
+ dsl = Guard::RSpec::Dsl.new(self)
25
+
26
+ # Feel free to open issues for suggestions and improvements
27
+
28
+ # RSpec files
29
+ rspec = dsl.rspec
30
+ watch(rspec.spec_helper) { rspec.spec_dir }
31
+ watch(rspec.spec_support) { rspec.spec_dir }
32
+ watch(rspec.spec_files)
33
+
34
+ # Ruby files
35
+ ruby = dsl.ruby
36
+ dsl.watch_spec_files_for(ruby.lib_files)
37
+ end
38
+
39
+ guard :rubocop do
40
+ watch(/.+\.rb$/)
41
+ watch(/^Gemfile$/)
42
+ watch(/^Rakefile$/)
43
+ watch(/^Guardfile$/)
44
+ watch(/.+\.gemspec$/)
45
+ watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
46
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Minwoo Lee
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # no_proxy_fix
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/no_proxy_fix.svg)](http://badge.fury.io/rb/no_proxy_fix)
4
+ [![Build Status](https://travis-ci.org/ermaker/no_proxy_fix.svg?branch=master)](https://travis-ci.org/ermaker/no_proxy_fix)
5
+ [![Dependency Status](https://gemnasium.com/ermaker/no_proxy_fix.svg)](https://gemnasium.com/ermaker/no_proxy_fix)
6
+
7
+
8
+ This fixes https://github.com/ruby/ruby/commit/556e3da4216c926e71dea9ce4ea4a08dcfdc1275 for ruby 2.4.0.
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'no_proxy_fix'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install no_proxy_fix
25
+
26
+ ## Usage
27
+
28
+ ```ruby
29
+ require 'no_proxy_fix'
30
+ ```
31
+
32
+ ## Development
33
+
34
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
+
36
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ermaker/no_proxy_fix.
41
+
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
46
+
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ begin
2
+ require 'bundler/gem_tasks'
3
+ rescue LoadError # rubocop:disable Lint/HandleExceptions
4
+ end
5
+
6
+ begin
7
+ require 'rspec/core/rake_task'
8
+ RSpec::Core::RakeTask.new(:spec)
9
+ task default: :spec
10
+ rescue LoadError # rubocop:disable Lint/HandleExceptions
11
+ end
12
+
13
+ begin
14
+ require 'rubocop/rake_task'
15
+ RuboCop::RakeTask.new
16
+ namespace :rubocop do
17
+ desc "Run 'rubocop --auto-gen-config'"
18
+ task :todo do
19
+ sh 'rubocop --auto-gen-config'
20
+ end
21
+ end
22
+ rescue LoadError # rubocop:disable Lint/HandleExceptions
23
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'no_proxy_fix'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'uri'
4
+
5
+ # = uri/generic.rb
6
+ #
7
+ # Author:: Akira Yamada <akira@ruby-lang.org>
8
+ # License:: You can redistribute it and/or modify it under the same term as Ruby.
9
+ # Revision:: $Id: generic.rb 56878 2016-11-22 23:44:51Z kazu $
10
+ #
11
+ # See URI for general documentation
12
+ #
13
+
14
+ require 'uri/common'
15
+
16
+ module URI
17
+
18
+ #
19
+ # Base class for all URI classes.
20
+ # Implements generic URI syntax as per RFC 2396.
21
+ #
22
+ class Generic
23
+ # returns a proxy URI.
24
+ # The proxy URI is obtained from environment variables such as http_proxy,
25
+ # ftp_proxy, no_proxy, etc.
26
+ # If there is no proper proxy, nil is returned.
27
+ #
28
+ # If the optional parameter, +env+, is specified, it is used instead of ENV.
29
+ #
30
+ # Note that capitalized variables (HTTP_PROXY, FTP_PROXY, NO_PROXY, etc.)
31
+ # are examined too.
32
+ #
33
+ # But http_proxy and HTTP_PROXY is treated specially under CGI environment.
34
+ # It's because HTTP_PROXY may be set by Proxy: header.
35
+ # So HTTP_PROXY is not used.
36
+ # http_proxy is not used too if the variable is case insensitive.
37
+ # CGI_HTTP_PROXY can be used instead.
38
+ def find_proxy(env=ENV)
39
+ raise BadURIError, "relative URI: #{self}" if self.relative?
40
+ name = self.scheme.downcase + '_proxy'
41
+ proxy_uri = nil
42
+ if name == 'http_proxy' && env.include?('REQUEST_METHOD') # CGI?
43
+ # HTTP_PROXY conflicts with *_proxy for proxy settings and
44
+ # HTTP_* for header information in CGI.
45
+ # So it should be careful to use it.
46
+ pairs = env.reject {|k, v| /\Ahttp_proxy\z/i !~ k }
47
+ case pairs.length
48
+ when 0 # no proxy setting anyway.
49
+ proxy_uri = nil
50
+ when 1
51
+ k, _ = pairs.shift
52
+ if k == 'http_proxy' && env[k.upcase] == nil
53
+ # http_proxy is safe to use because ENV is case sensitive.
54
+ proxy_uri = env[name]
55
+ else
56
+ proxy_uri = nil
57
+ end
58
+ else # http_proxy is safe to use because ENV is case sensitive.
59
+ proxy_uri = env.to_hash[name]
60
+ end
61
+ if !proxy_uri
62
+ # Use CGI_HTTP_PROXY. cf. libwww-perl.
63
+ proxy_uri = env["CGI_#{name.upcase}"]
64
+ end
65
+ elsif name == 'http_proxy'
66
+ unless proxy_uri = env[name]
67
+ if proxy_uri = env[name.upcase]
68
+ warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.'
69
+ end
70
+ end
71
+ else
72
+ proxy_uri = env[name] || env[name.upcase]
73
+ end
74
+
75
+ if proxy_uri.nil? || proxy_uri.empty?
76
+ return nil
77
+ end
78
+
79
+ if self.hostname
80
+ require 'socket'
81
+ begin
82
+ addr = IPSocket.getaddress(self.hostname)
83
+ return nil if /\A127\.|\A::1\z/ =~ addr
84
+ rescue SocketError
85
+ end
86
+ end
87
+
88
+ name = 'no_proxy'
89
+ if no_proxy = env[name] || env[name.upcase]
90
+ no_proxy.scan(/(?!\.)([^:,\s]+)(?::(\d+))?/) {|host, port|
91
+ if (!port || self.port == port.to_i)
92
+ if /(\A|\.)#{Regexp.quote host}\z/i =~ self.host
93
+ return nil
94
+ elsif addr
95
+ require 'ipaddr'
96
+ return nil if
97
+ begin
98
+ IPAddr.new(host)
99
+ rescue IPAddr::InvalidAddressError
100
+ next
101
+ end.include?(addr)
102
+ end
103
+ end
104
+ }
105
+ end
106
+ URI.parse(proxy_uri)
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,5 @@
1
+ require 'no_proxy_fix/version'
2
+
3
+ module NoProxyFix
4
+ require 'cext/generic_find_proxy' if RUBY_VERSION.start_with?('2.4.0')
5
+ end
@@ -0,0 +1,3 @@
1
+ module NoProxyFix
2
+ VERSION = '0.1.0'.freeze
3
+ end
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'no_proxy_fix/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'no_proxy_fix'
8
+ spec.version = NoProxyFix::VERSION
9
+ spec.authors = ['Minwoo Lee']
10
+ spec.email = ['ermaker@gmail.com']
11
+
12
+ spec.summary = 'A fix for a no_proxy bug on ruby 2.4.0'
13
+ spec.description = 'A fix for a no_proxy bug: https://github.com/ruby/ruby/commit/556e3da4216c926e71dea9ce4ea4a08dcfdc1275'
14
+ spec.homepage = 'https://github.com/ermaker/no_proxy_fix'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = 'exe'
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_development_dependency 'bundler'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rspec'
27
+ spec.add_development_dependency 'rspec-its'
28
+ spec.add_development_dependency 'rubocop'
29
+ spec.add_development_dependency 'guard'
30
+ spec.add_development_dependency 'guard-bundler'
31
+ spec.add_development_dependency 'guard-rspec'
32
+ spec.add_development_dependency 'guard-rubocop'
33
+ end
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: no_proxy_fix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Minwoo Lee
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-02-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-its
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-bundler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard-rubocop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: 'A fix for a no_proxy bug: https://github.com/ruby/ruby/commit/556e3da4216c926e71dea9ce4ea4a08dcfdc1275'
140
+ email:
141
+ - ermaker@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".gitignore"
147
+ - ".rspec"
148
+ - ".rubocop.yml"
149
+ - ".rubocop_todo.yml"
150
+ - ".travis.yml"
151
+ - Gemfile
152
+ - Guardfile
153
+ - LICENSE.txt
154
+ - README.md
155
+ - Rakefile
156
+ - bin/console
157
+ - bin/setup
158
+ - lib/cext/generic_find_proxy.rb
159
+ - lib/no_proxy_fix.rb
160
+ - lib/no_proxy_fix/version.rb
161
+ - no_proxy_fix.gemspec
162
+ homepage: https://github.com/ermaker/no_proxy_fix
163
+ licenses:
164
+ - MIT
165
+ metadata: {}
166
+ post_install_message:
167
+ rdoc_options: []
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ requirements: []
181
+ rubyforge_project:
182
+ rubygems_version: 2.6.8
183
+ signing_key:
184
+ specification_version: 4
185
+ summary: A fix for a no_proxy bug on ruby 2.4.0
186
+ test_files: []