Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test against Ruby 3.0 #34

Merged
merged 1 commit into from Mar 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -9,6 +9,7 @@ rvm:
- ruby-2.5
- ruby-2.6
- ruby-2.7
- ruby-3.0
- ruby-head
script:
- bundle exec bundler-audit
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -19,7 +19,7 @@ This gem provides a safe and easy way to fetch content from user-submitted urls.
- handles URIs/IPv4/IPv6, redirects, DNS, etc, correctly
- has 0 runtime dependencies
- has a comprehensive test suite (100% code coverage)
- is tested against ruby `2.0`, `2.1`, `2.2`, `2.3`, `2.4`, `2.5`, `2.6`, `2.7`, and `ruby-head`
- is tested against ruby `2.0`, `2.1`, `2.2`, `2.3`, `2.4`, `2.5`, `2.6`, `2.7`, `3.0`, and `ruby-head`

### Quick start

Expand Down
4 changes: 2 additions & 2 deletions spec/lib/ssrf_filter_spec.rb
Expand Up @@ -172,7 +172,7 @@
it 'should disallow header values with newlines and carriage returns' do
# Starting in ruby 2.5, assigning a header value with newlines throws an ArgumentError
major, minor = RUBY_VERSION.scan(/\A(\d+)\.(\d+)\.\d+\Z/).first.map(&:to_i)
exception = major >= 2 && minor >= 5 ? ArgumentError : SsrfFilter::CRLFInjection
exception = major >= 3 || (major >= 2 && minor >= 5) ? ArgumentError : SsrfFilter::CRLFInjection

expect do
SsrfFilter.get("https://#{public_ipv4}", headers: {'name' => "val\nue"})
Expand Down Expand Up @@ -419,7 +419,7 @@ def inject_custom_trust_store(*certificates)
it 'should follow redirects and succeed on a public hostname' do
stub_request(:post, "https://#{public_ipv4}/path?key=value").with(headers: {host: 'www.example.com'})
.to_return(status: 301, headers: {location: 'https://www.example2.com/path2?key2=value2'})
stub_request(:post, "https://#{public_ipv6}/path2?key2=value2")
stub_request(:post, "https://[#{public_ipv6}]/path2?key2=value2")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is due to bblimke/webmock#933.

.with(headers: {host: 'www.example2.com'}).to_return(status: 200, body: 'response body')
resolver = proc do |hostname|
[{
Expand Down
5 changes: 2 additions & 3 deletions ssrf_filter.gemspec
Expand Up @@ -20,9 +20,8 @@ Gem::Specification.new do |gem|
gem.add_development_dependency('bundler-audit', '~> 0.6.1')
gem.add_development_dependency('coveralls', '~> 0.8.22')
gem.add_development_dependency('rspec', '~> 3.8.0')
gem.add_development_dependency('webmock', '~> 3.5.1')

raise 'Unsupported version of ruby' unless major == 2
gem.add_development_dependency('webmock', '>= 3.5.1')
gem.add_development_dependency('webrick') if major >= 3

if minor > 1
gem.add_development_dependency('rubocop', '~> 0.65.0')
Expand Down