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

Issue with check variable in MiniSSL #1182

Closed
brunowego opened this issue Dec 28, 2016 · 4 comments
Closed

Issue with check variable in MiniSSL #1182

brunowego opened this issue Dec 28, 2016 · 4 comments
Labels

Comments

@brunowego
Copy link

Steps to reproduce

  1. Open puma.rb

  2. Add the follow line of code:

ssl_bind 'localhost', '3000', {
  key: File.expand_path('../certificates/server.key', __FILE__),
  cert: File.expand_path('../certificates/server.crt', __FILE__)
}

Change certificates/server.key and certificates/server.crt to your self-signed certificate.

  1. Run on root of app the command puma.

Expected behavior

Runs puma server...

Actual behavior

2016-12-28 10:07:04 -0200: Listen loop error: #<NoMethodError: undefined method `check' for true:TrueClass>
/Users/Bruno/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/puma-3.6.2/lib/puma/minissl.rb:209:in `accept_nonblock'
/Users/Bruno/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/puma-3.6.2/lib/puma/server.rb:333:in `block in handle_servers'
/Users/Bruno/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/puma-3.6.2/lib/puma/server.rb:328:in `each'
/Users/Bruno/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/puma-3.6.2/lib/puma/server.rb:328:in `handle_servers'
/Users/Bruno/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/puma-3.6.2/lib/puma/server.rb:301:in `block in run'

System configuration

Ruby version: ruby 2.3.2p217 (2016-11-15 revision 56796) [x86_64-darwin16]
Rails version: 5.0.0.1

@brunowego
Copy link
Author

Using bind instead of ssl_bind, works.

ssl_key = File.expand_path('../certificates/server.key', __FILE__)
ssl_cert = File.expand_path('../certificates/server.crt', __FILE__)
bind "ssl://127.0.0.1:3000?key=#{ssl_key}&cert=#{ssl_cert}"

@Scong
Copy link

Scong commented Jan 20, 2017

I am seeing the same issues when trying to start to start puma for Capybara with SSL. With these attempts.

Rack::Handler::Puma.run(app, Host: host, Port: port, Threads: "0:4") do |server|
      server.config.options.instance_variable_get(:@set)[1][:binds] = ['ssl://localhost:3002?key=./spec/support/server.key&cert=./spec/support/server.crt']
   #Definitely not the right way to set a binding
    end

and

Puma::Server.new(app).tap do |server|
    context = Puma::MiniSSL::Context.new
    context.key         = "./spec/support/server.key"
    context.cert        = "./spec/support/server.crt"
    context.verify_mode = Puma::MiniSSL::VERIFY_NONE
    server.add_ssl_listener(Capybara.server_host, port, context)
    #Maybe a more reasonable way
end.run.join

Listen loop error: #<NoMethodError: undefined method `check' for true:TrueClass> /Users/scong/.rvm/gems/ruby-2.3.1/gems/puma-3.6.2/lib/puma/minissl.rb:209:in `accept_nonblock' /Users/scong/.rvm/gems/ruby-2.3.1/gems/puma-3.6.2/lib/puma/server.rb:332:in `block in handle_servers' /Users/scong/.rvm/gems/ruby-2.3.1/gems/puma-3.6.2/lib/puma/server.rb:327:in `each' /Users/scong/.rvm/gems/ruby-2.3.1/gems/puma-3.6.2/lib/puma/server.rb:327:in `handle_servers' /Users/scong/.rvm/gems/ruby-2.3.1/gems/puma-3.6.2/lib/puma/server.rb:300:in `block in run'

@nafaabout
Copy link
Contributor

I got something similar with Rails 4.2.7.1 and Ruby 2.3.3.

2017-01-23 17:46:09 +0100: Listen loop error: #<NoMethodError: undefined method `key' for true:TrueClass>
/home/nafaa/.rvm/gems/ruby-2.3.3@bytestand/gems/puma-3.5.0/lib/puma/minissl.rb:168:in `server'
/home/nafaa/.rvm/gems/ruby-2.3.3@bytestand/gems/puma-3.5.0/lib/puma/minissl.rb:168:in `accept_nonblock'
/home/nafaa/.rvm/gems/ruby-2.3.3@bytestand/gems/puma-3.5.0/lib/puma/server.rb:329:in `block in handle_servers'
/home/nafaa/.rvm/gems/ruby-2.3.3@bytestand/gems/puma-3.5.0/lib/puma/server.rb:324:in `each'
/home/nafaa/.rvm/gems/ruby-2.3.3@bytestand/gems/puma-3.5.0/lib/puma/server.rb:324:in `handle_servers'
/home/nafaa/.rvm/gems/ruby-2.3.3@bytestand/gems/puma-3.5.0/lib/puma/server.rb:297:in `block in run'

nafaabout added a commit to nafaabout/puma that referenced this issue Jan 23, 2017
This typo was causing the issue puma#1182.
@nafaabout nafaabout mentioned this issue Jan 23, 2017
nateberkopec pushed a commit that referenced this issue Feb 9, 2017
This typo was causing the issue #1182.
@nateberkopec
Copy link
Member

Fixed by #1192

annaswims added a commit to department-of-veterans-affairs/vets-api that referenced this issue Oct 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants