Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/test-passenger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ jobs:
timeout-minutes: 10
run: bundle exec bake test

- name: Dump server log
if: failure()
run: cat server.log

- name: Run benchmarks
timeout-minutes: 10
run: |
bundle exec ${{matrix.server}} &
bundle exec benchmark-http wait ${{matrix.endpoint}}
Expand Down
3 changes: 3 additions & 0 deletions gems/passenger-v6-rack-v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@

gem "base64"
gem "logger"

# export RACK_CONFORM_SERVER="passenger start"
# export RACK_CONFORM_ENDPOINT="http://127.0.0.1:3000"
17 changes: 16 additions & 1 deletion lib/rack/conform/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,25 @@ def test_middleware_body_itself(env)
Middleware::BodyItself.new(self).call(env)
end

def test_options_star(env)
request_method = env["REQUEST_METHOD"]
path_info = env["PATH_INFO"]

[200, {"allow" => "GET, POST, PUT, PATCH, DELETE, OPTIONS"}, ["#{request_method} #{path_info}"]]
end

private

def test_method_for(env)
parts = env["PATH_INFO"].split("/")
request_method = env["REQUEST_METHOD"]
path_info = env["PATH_INFO"]

# Special case for OPTIONS * request:
if request_method == "OPTIONS"
return :test_options_star
end

parts = path_info.split("/")
parts[0] = "test"

return parts.join("_").to_sym
Expand Down
21 changes: 21 additions & 0 deletions test/rack/conform/options_star.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.

require "client_context"
include ClientContext

require "protocol/http/request"

it "can handle OPTIONS / request" do
request = Protocol::HTTP::Request.new(
endpoint.scheme, endpoint.authority, "OPTIONS", "/", nil, Protocol::HTTP::Headers.new, nil
)

response = client.call(request)
expect(response.status).to be == 200
expect(response.read).to be == "OPTIONS /"
ensure
response&.finish
end