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

Handling of RequestInterface::getProtocolVersion #35

Open
kelunik opened this issue Aug 14, 2017 · 3 comments
Open

Handling of RequestInterface::getProtocolVersion #35

kelunik opened this issue Aug 14, 2017 · 3 comments

Comments

@kelunik
Copy link

kelunik commented Aug 14, 2017

What's the defined behavior for clients accepting objects implementing RequestInterface? They specify one HTTP protocol version. Is the client required to obey exactly the protocol version specified in the request? PSR-7 libraries defining it as 1.1 wouldn't allow to use HTTP/2 in that case.

@dbu
Copy link

dbu commented Aug 15, 2017

does psr-7 say anything about that? imho its the job of PSR-7 to define what getProtocol on a request object signifies... i did not read it up, but assume that there is no way of distinguishing the default value from a not specified value?

@kelunik
Copy link
Author

kelunik commented Aug 15, 2017

interface MessageInterface
{
    /**
     * Retrieves the HTTP protocol version as a string.
     *
     * The string MUST contain only the HTTP version number (e.g., "1.1", "1.0").
     *
     * @return string HTTP protocol version.
     */
    public function getProtocolVersion();

It says it's the version number of the request, so I guess a client would have to respect it. That's why we use an array for that in Artax.

@dbu
Copy link

dbu commented Aug 15, 2017

bad choice indeed. one could use middleware before the request to overwrite the version based on the domain before the request goes to the actual client... but its kinda out of scope for us.

should we mention the topic at all in this PSR? if so, it would be in the spec for sendRequest, where we either say "MUST" respect the protocol or "SHOULD" respect. i'd tend for SHOULD in this case. but i am not sure we have to mention this at all. it should be a clarification on PSR-7. (and maybe a fix for PSR-7 2 to support a range here)

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

No branches or pull requests

2 participants