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

Add SERVER_PROTOCOL to SPEC #1883

Merged
merged 1 commit into from
Apr 29, 2022
Merged

Commits on Apr 29, 2022

  1. Add SERVER_PROTOCOL to SPEC

    SPEC currently does not currently specify a way to get the HTTP
    version in use.  However, both Chunked and CommonLogger need access
    to the http version for correct functioning, and other users in
    the rack ecosystem need it as well (Roda needs it, and I've just
    identified a need for it in rack-test).
    
    Unicorn, Webrick, and Puma all currently set SERVER_PROTOCOL.
    However, Puma currently sets SERVER_PROTOCOL statically to
    HTTP/1.1, unlike Unicorn and Webrick, which set it to the
    protocol used by the client.  Unicorn and Puma set HTTP_VERSION
    to the protocol used by the client.
    
    This specifies that SERVER_PROTOCOL should match the protocol
    used by the client, that it should be a valid protocol matching
    HTTP/\d(\.\d)?, and that if HTTP_VERSION is provided, it must
    match SERVER_PROTOCOL.  This will require minor changes to Puma
    to be compliant with the new SPEC.
    
    Set SERVER_PROTOCOL to HTTP/1.1 by default in Rack::MockRequest,
    allowing it to be set by the :http_version option. Update
    CommonLogger specs to include the version.
    
    This removes a spec in Chunked for usage without SERVER_PROTOCOL.
    A comment in the removed lines indicate unicorn will not set
    SERVER_PROTOCOL for HTTP/0.9 requests, but that is incorrect, as
    unicorn has set SERVER_PROTOCOL to HTTP/0.9 since 2009 (see unicorn
    commit bd0599c4ac91d95cae1f34df3ae99c92f3225391).  The related
    comment was correct when added in 2009 (rack commit
    895beec), but has been incorrect
    since the code was changed from HTTP_VERSION to SERVER_PROTOCOL in
    2015 (rack commit e702d31).
    jeremyevans committed Apr 29, 2022
    Configuration menu
    Copy the full SHA
    ebc21cb View commit details
    Browse the repository at this point in the history