Skip to content

Commit 0d735a1

Browse files
authored
Merge pull request #131 from nobu/version-binread
Read in binary mode to get rid of invalid byte sequence
2 parents d22ca54 + 2767df5 commit 0d735a1

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ jobs:
2020
run: bundle install
2121
- name: Run test
2222
run: rake test
23+
- name: Build
24+
run: rake build
25+
env:
26+
LANG: C

lib/net/http.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ class HTTPHeaderSyntaxError < StandardError; end
656656
# - {:min_version=}[rdoc-ref:Net::HTTP#min_version=]:
657657
# Sets the minimum SSL version.
658658
# - {#peer_cert}[rdoc-ref:Net::HTTP#peer_cert]:
659-
# Returns the X509 certificate chain for the session's socket peer.
659+
# Returns the X509 certificate chain for the sessions socket peer.
660660
# - {:ssl_version}[rdoc-ref:Net::HTTP#ssl_version]:
661661
# Returns the SSL version.
662662
# - {:ssl_version=}[rdoc-ref:Net::HTTP#ssl_version=]:

net-http.gemspec

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22

33
name = File.basename(__FILE__, ".gemspec")
44
version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir|
5-
break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
6-
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
7-
end rescue nil
5+
file = File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")
6+
begin
7+
break File.foreach(file, mode: "rb") do |line|
8+
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
9+
end
10+
rescue SystemCallError
11+
next
12+
end
813
end
914

1015
Gem::Specification.new do |spec|
@@ -25,7 +30,7 @@ Gem::Specification.new do |spec|
2530
# Specify which files should be added to the gem when it is released.
2631
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
2732
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28-
`git ls-files -z 2>/dev/null`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33+
`git ls-files -z 2>/dev/null`.split("\x0").reject { |f| f.match(%r{\A(?:(?:test|spec|features)/|\.git)}) }
2934
end
3035
spec.bindir = "exe"
3136
spec.require_paths = ["lib"]

0 commit comments

Comments
 (0)