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

The rack example does not work because of Rack::Lint::LintError #267

Closed
mopp opened this issue Nov 19, 2022 · 1 comment · Fixed by #268
Closed

The rack example does not work because of Rack::Lint::LintError #267

mopp opened this issue Nov 19, 2022 · 1 comment · Fixed by #268

Comments

@mopp
Copy link

mopp commented Nov 19, 2022

Overview

The rack example does not work due to it causes Rack::Lint::LintError: uppercase character in header name: Content-Type.
The reason is the breaking change for HTTP/2 at Rack 3.0.0.

Response header keys can no longer include uppercase characters.

References

Environment

Here is my environment.

> ruby --version
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]

Gemfile.lock

PATH
  remote: ../..
  specs:
    prometheus-client (4.0.0)

GEM
  remote: https://rubygems.org/
  specs:
    kgio (2.11.4)
    rack (3.0.1)
    raindrops (0.20.0)
    unicorn (6.1.0)
      kgio (~> 2.6)
      raindrops (~> 0.7)

PLATFORMS
  x86_64-linux

DEPENDENCIES
  prometheus-client!
  rack
  unicorn

BUNDLED WITH
   2.3.26

The error details

After curl http://localhost:5000

❯ bundle exec unicorn -c ./unicorn.conf 
I, [2022-11-19T23:20:37.816093 #91195]  INFO -- : Refreshing Gem list
/home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-3.0.1/lib/rack/chunked.rb:6: warning: Rack::Chunked is deprecated and will be remove
d in Rack 3.1
I, [2022-11-19T23:20:37.834067 #91195]  INFO -- : listening on addr=0.0.0.0:5000 fd=7
I, [2022-11-19T23:20:37.834157 #91195]  INFO -- : worker=0 spawning...
I, [2022-11-19T23:20:37.834850 #91195]  INFO -- : master process ready
I, [2022-11-19T23:20:37.835144 #91210]  INFO -- : worker=0 spawned pid=91210
I, [2022-11-19T23:20:37.835328 #91210]  INFO -- : worker=0 ready
Rack::Lint::LintError: uppercase character in header name: Content-Type
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-3.0.1/lib/rack/lint.rb:653:in `block in check_headers'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-3.0.1/lib/rack/lint.rb:637:in `each'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-3.0.1/lib/rack/lint.rb:637:in `check_headers'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-3.0.1/lib/rack/lint.rb:73:in `response'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-3.0.1/lib/rack/lint.rb:35:in `call'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-3.0.1/lib/rack/show_exceptions.rb:27:in `call'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-3.0.1/lib/rack/common_logger.rb:43:in `call'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-3.0.1/lib/rack/chunked.rb:102:in `call'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-3.0.1/lib/rack/content_length.rb:20:in `call'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/unicorn-6.1.0/lib/unicorn/http_server.rb:634:in `process_client'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/unicorn-6.1.0/lib/unicorn/http_server.rb:739:in `worker_loop'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/unicorn-6.1.0/lib/unicorn/http_server.rb:547:in `spawn_missing_workers'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/unicorn-6.1.0/lib/unicorn/http_server.rb:143:in `start'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/unicorn-6.1.0/bin/unicorn:128:in `<top (required)>'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/bin/unicorn:25:in `load'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/bin/unicorn:25:in `<top (required)>'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/bundler/cli/exec.rb:58:in `load'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/bundler/cli/exec.rb:58:in `kernel_load'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/bundler/cli/exec.rb:23:in `run'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/bundler/cli.rb:486:in `exec'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/bundler/cli.rb:31:in `dispatch'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/bundler/cli.rb:25:in `start'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/exe/bundle:48:in `block in <top (required)>'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/bundler/friendly_errors.rb:120:in `with_friendly_errors'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/exe/bundle:36:in `<top (required)>'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/bin/bundle:25:in `load'
        /home/mopp/.anyenv/envs/rbenv/versions/3.1.2/bin/bundle:25:in `<main>'
127.0.0.1 - - [19/Nov/2022:23:20:40 +0900] "GET / HTTP/1.1" 500 82929 0.0159
@Sinjo
Copy link
Member

Sinjo commented Nov 24, 2022

Thanks for the report @mopp! I've opened a PR to fix it over at #268

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants