Skip to content

THRIFT-6079: Add Rack HTTP server support for Ruby#3634

Merged
kpumuk merged 1 commit into
apache:masterfrom
kpumuk:rb-http
Jul 13, 2026
Merged

THRIFT-6079: Add Rack HTTP server support for Ruby#3634
kpumuk merged 1 commit into
apache:masterfrom
kpumuk:rb-http

Conversation

@kpumuk

@kpumuk kpumuk commented Jul 12, 2026

Copy link
Copy Markdown
Member

Ruby HTTP server support has historically been coupled to Thin and Mongrel. Mongrel no longer works with supported Ruby versions, while Thin is inactive and its EventMachine dependency does not compile on Ruby development versions targeting Ruby 4.1.

This change extracts Thrift HTTP request processing into Thrift::RackApplication. It can run as a standalone Rack application or be mounted at a route inside an existing Rack application such as Rails. The Rack host remains responsible for listening, concurrency, lifecycle, and TLS configuration.

Thrift::ThinHTTPServer now delegates to the shared Rack application and emits a deprecation warning. Thin remains available for compatibility and continues to be covered by cross-language tests. Thrift::MongrelHTTPServer is removed.

The Ruby integration harness now exercises HTTP and HTTPS with Thin, Puma, and Falcon. The Ruby HTTP client also participates in cross-language HTTP tests and accepts ssl_ca_file for verification against test or private certificate authorities. Cross-tests use Ruby 4.0 rather than the oldest supported Ruby version, this is to allow us to test against Falcon (requires 3.3+).

The Ruby README documents the Rack and Rails mounting APIs and records the Thin deprecation and Mongrel removal for the 0.25.0 release.

Caveats

  • ONEWAY calls receive no special asynchronous handling. The processor completes inside the Rack request before the HTTP response is returned, preserving the historical Thin behavior. No detached threads, Rack hijacking, or server-specific async APIs are introduced. Cross-tests that enforce fire-and-forget timing are recorded as known failures; the processing model can be reconsidered separately.
  • Puma and Falcon support is provided through Thrift::RackApplication; this does not introduce PumaHTTPServer or FalconHTTPServer wrapper classes. Applications configure and operate those servers normally.
  • TLS termination belongs to the Rack server. The integration harness configures TLS for Thin, Puma, and Falcon, while the Rack application itself is transport-agnostic.
  • Thin is excluded from Ruby-head builds because EventMachine does not compile there. It remains tested with Ruby 4.0 but should be treated as a deprecated compatibility path.
  • The Rack endpoint currently buffers each request body before protocol processing.
  • Did you create an Apache Jira ticket? THRIFT-6079
  • If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • Did you squash your changes to a single commit? (not required, but preferred)
  • Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
  • If your change does not involve any code, include [skip ci] anywhere in the commit message to free up build resources.

@kpumuk kpumuk requested a review from fishy as a code owner July 12, 2026 14:56
Copilot AI review requested due to automatic review settings July 12, 2026 14:56
@kpumuk kpumuk requested review from Jens-G and jimexist as code owners July 12, 2026 14:56
@mergeable mergeable Bot added ruby Pull requests that update Ruby code testsuite labels Jul 12, 2026
@mergeable mergeable Bot added the github_actions Pull requests that update GitHub Actions code label Jul 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds modern Rack-based HTTP server support for the Ruby Thrift library, decoupling HTTP request handling from legacy servers while expanding cross-language HTTP/HTTPS integration coverage.

Changes:

  • Introduces Thrift::RackApplication and refactors Thrift::ThinHTTPServer to delegate to it (with a deprecation warning), removing the Mongrel HTTP server.
  • Extends the Ruby cross-test integration harness to run HTTP/HTTPS servers via Thin, Puma, and Falcon, and enables the Ruby HTTP client in cross-language HTTP tests (including CA file support).
  • Updates CI/cross-test configuration and Ruby documentation to reflect the new HTTP/Rack approach and Ruby version used for cross-tests.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/tests.json Adds Ruby HTTP client transport and new Ruby HTTP server variants (thin/puma/falcon) for cross-tests.
test/rb/integration/TestServer.rb Adds rack-backed HTTP server modes and TLS setup for Thin/Puma/Falcon in the Ruby integration server.
test/rb/integration/TestClient.rb Adds HTTP client transport support (including TLS CA file) and skips oneway timing assertions for HTTP.
test/rb/Gemfile Adds Puma and Falcon dependencies for integration harness HTTP server coverage.
test/rb/Gemfile.lock Locks the new Ruby test harness dependencies (Puma/Falcon and their transitive deps).
test/known_failures_Linux.json Records expected cross-test failures for HTTP over domain sockets / known HTTP matrix gaps.
lib/rb/spec/thin_http_server_spec.rb Updates Thin HTTP server specs for deprecation warning, Rack delegation, and SSL option wiring.
lib/rb/spec/rack_application_spec.rb Adds specs for the new Thrift::RackApplication Rack endpoint behavior.
lib/rb/spec/http_client_spec.rb Adds spec coverage for ssl_ca_file handling in the Ruby HTTP client transport.
lib/rb/README.md Documents Rack/Rails mounting APIs and notes Thin deprecation + Mongrel removal for 0.25.0.
lib/rb/lib/thrift/transport/http_client_transport.rb Adds ssl_ca_file support to HTTPS requests.
lib/rb/lib/thrift/server/thin_http_server.rb Deprecates Thin HTTP server, delegates request processing to shared Rack application, adds SSL wiring.
lib/rb/lib/thrift/server/rack_application.rb Introduces shared Rack endpoint implementation for Ruby HTTP request processing.
lib/rb/lib/thrift/server/mongrel_http_server.rb Removes legacy Mongrel HTTP server implementation.
.github/workflows/build.yml Updates cross-test matrix to include rb.thin/rb.puma/rb.falcon and switches Ruby cross-test version to 4.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/rb/Gemfile
Comment thread lib/rb/lib/thrift/server/rack_application.rb Outdated
Comment thread lib/rb/lib/thrift/server/rack_application.rb
Copilot AI review requested due to automatic review settings July 12, 2026 15:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.

Comment thread test/tests.json
Comment thread test/known_failures_Linux.json Outdated
Comment thread test/known_failures_Linux.json
Copilot AI review requested due to automatic review settings July 12, 2026 15:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.

Comment thread test/tests.json Outdated
Comment thread lib/rb/lib/thrift/server/rack_application.rb Outdated
Comment thread lib/rb/lib/thrift/server/rack_application.rb
Copilot AI review requested due to automatic review settings July 12, 2026 15:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 12, 2026 15:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.

Comment thread lib/rb/lib/thrift/server/rack_application.rb Outdated
Copilot AI review requested due to automatic review settings July 12, 2026 15:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 12, 2026 15:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.

Comment thread lib/rb/lib/thrift/server/rack_application.rb Outdated
Comment thread test/tests.json
Copilot AI review requested due to automatic review settings July 12, 2026 15:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.

Comment thread lib/rb/README.md
Comment thread lib/rb/README.md
Copilot AI review requested due to automatic review settings July 12, 2026 16:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.

Comment thread test/tests.json
Copilot AI review requested due to automatic review settings July 12, 2026 16:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.

Comment thread test/tests.json
Copilot AI review requested due to automatic review settings July 12, 2026 16:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 12, 2026 16:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.

Comment thread test/rb/integration/TestServer.rb Outdated
Copilot AI review requested due to automatic review settings July 12, 2026 16:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.

Comment thread test/rb/integration/TestClient.rb
Copilot AI review requested due to automatic review settings July 12, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated no new comments.

Client: rb

Co-Authored-By: OpenAI Codex (GPT-5.4) <codex@openai.com>
Copilot AI review requested due to automatic review settings July 12, 2026 17:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.

Comment thread test/tests.json
@kpumuk kpumuk marked this pull request as draft July 13, 2026 14:51
@kpumuk kpumuk marked this pull request as ready for review July 13, 2026 16:50
@kpumuk kpumuk merged commit 882bc8f into apache:master Jul 13, 2026
96 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code ruby Pull requests that update Ruby code testsuite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants