Skip to content

Commit

Permalink
Merge pull request #131 from nobu/version-binread
Browse files Browse the repository at this point in the history
Read in binary mode to get rid of invalid byte sequence
  • Loading branch information
nobu authored Mar 6, 2023
2 parents d22ca54 + 2767df5 commit 0d735a1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ jobs:
run: bundle install
- name: Run test
run: rake test
- name: Build
run: rake build
env:
LANG: C
2 changes: 1 addition & 1 deletion lib/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ class HTTPHeaderSyntaxError < StandardError; end
# - {:min_version=}[rdoc-ref:Net::HTTP#min_version=]:
# Sets the minimum SSL version.
# - {#peer_cert}[rdoc-ref:Net::HTTP#peer_cert]:
# Returns the X509 certificate chain for the session's socket peer.
# Returns the X509 certificate chain for the sessions socket peer.
# - {:ssl_version}[rdoc-ref:Net::HTTP#ssl_version]:
# Returns the SSL version.
# - {:ssl_version=}[rdoc-ref:Net::HTTP#ssl_version=]:
Expand Down
13 changes: 9 additions & 4 deletions net-http.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

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

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

0 comments on commit 0d735a1

Please sign in to comment.