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

Request protocol version #1698

Merged
merged 2 commits into from
Dec 22, 2015
Merged

Request protocol version #1698

merged 2 commits into from
Dec 22, 2015

Conversation

abbert
Copy link

@abbert abbert commented Dec 22, 2015

Property protocolVersion of Request defaults to 1.1. This change makes it change to the actual request protocol version. Is str_replace('HTTP/' sufficient?

@AndrewCarterUK
Copy link
Contributor

👎 in current form

The 'host' header isn't supported by HTTP/1.0 so you need to make sure you strip it in that scenario.

@akrabat
Copy link
Member

akrabat commented Dec 22, 2015

I don't understand what problem you are having.

The protocol is set via the Environment which merges the information from $_SERVER, so if it's set in $_SERVER, then we pick it up.

@AndrewCarterUK
Copy link
Contributor

@akrabat The protocol version is hard-coded to 1.1 in the message class (I think).

I don't actually think this is the wrong approach. The PSR-7 specification is only for the representation of HTTP/1.1 messages, there are features of it that are incompatible with HTTP/1.0 - so I think it's dangerous pretending to support it.

@AndrewCarterUK
Copy link
Contributor

Although that said, you can still do withProtocolVersion() :s

@akrabat
Copy link
Member

akrabat commented Dec 22, 2015

@abbert
Copy link
Author

abbert commented Dec 22, 2015

@AndrewCarterUK Yes indeed. That's why I thought it needed to be implemented. Also, this comment is from the MessageInterface: The version string MUST contain only the HTTP version number (e.g., "1.1", "1.0").

@akrabat when I delete the lines of code I added in the constructor of Request the test will fail..That means the protocolVersion is never overwritten with the version in the actual request

@AndrewCarterUK
Copy link
Contributor

Reading this I think @abbert is right - I can't see where the protocol version is extracted from the environment?

@akrabat
Copy link
Member

akrabat commented Dec 22, 2015

Yeah - I understand the issue now.

@akrabat akrabat merged commit daabd4d into slimphp:3.x Dec 22, 2015
@akrabat
Copy link
Member

akrabat commented Dec 22, 2015

Thanks very much for this @abbert!

@abbert
Copy link
Author

abbert commented Dec 22, 2015

No problem :)

@akrabat akrabat added this to the 3.1.0 milestone Jan 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants