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

Fix Rack LintError from uppercase response headers for client_dev #628

Merged
merged 4 commits into from
Feb 11, 2025

Conversation

coalest
Copy link
Collaborator

@coalest coalest commented Jan 29, 2025

The client dev server wasn't working, as apparently as of Rack 3 / HTTP 2 response headers should be lowercased.

Example stack trace
$ bundle exec rake client_dev
Puma starting in single mode...
* Puma version: 6.5.0 ("Sky's Version")
* Ruby version: ruby 3.3.3 (2024-06-12 revision f1c7b6f435) [x86_64-linux]
*  Min threads: 0
*  Max threads: 5
*  Environment: development
*          PID: 454193
* Listening on http://127.0.0.1:9292
* Listening on http://[::1]:9292
Use Ctrl-C to stop
Rack::Lint::LintError: uppercase character in header name: Content-Type (Rack::Lint::LintError)
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/lint.rb:717:in `block in check_headers'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/lint.rb:701:in `each'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/lint.rb:701:in `check_headers'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/lint.rb:76:in `response'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/lint.rb:41:in `call'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/show_exceptions.rb:31:in `call'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/common_logger.rb:43:in `call'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/sinatra-4.1.1/lib/sinatra/base.rb:269:in `call'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/content_length.rb:20:in `call'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/puma-6.5.0/lib/puma/configuration.rb:279:in `call'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/puma-6.5.0/lib/puma/request.rb:99:in `block in handle_request'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/puma-6.5.0/lib/puma/thread_pool.rb:389:in `with_force_shutdown'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/puma-6.5.0/lib/puma/request.rb:98:in `handle_request'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/puma-6.5.0/lib/puma/server.rb:468:in `process_client'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/puma-6.5.0/lib/puma/server.rb:249:in `block in run'
        /home/user/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/puma-6.5.0/lib/puma/thread_pool.rb:166:in `block in spawn_thread'

After these changes I finally got the client dev server working 🎉.

@tgxworld
Copy link
Collaborator

tgxworld commented Feb 3, 2025

@coalest Thank you for the contribution. Can you add a changelog entry for this change in CHANGELOG.md please?

@coalest
Copy link
Collaborator Author

coalest commented Feb 3, 2025

@tgxworld Added the changelog entry 👍

@nateberkopec nateberkopec merged commit bc57e02 into MiniProfiler:master Feb 11, 2025
4 checks passed
@nateberkopec
Copy link
Collaborator

Future TODO, we could add Rack::Lint to the test suite

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 this pull request may close these issues.

3 participants