Change the http version from 1.0 to 1.1 in PHP#186
Change the http version from 1.0 to 1.1 in PHP#186arthurdarcet wants to merge 1 commit intobobthecow:masterfrom
Conversation
|
The reason it returns That does sound like an Apache configuration issue, but I've never run into it before so I can't say for sure. Genghis is supposed to run on any PHP since 5.2, so |
07250d1 to
e53e3e5
Compare
|
I agree that this must be an Apache configuration issue, but I think i'm really not far from the stock ubuntu configuration (after at least two dist-upgrade, so I can't really say for sure). I updated the pull request to use |
e53e3e5 to
dc20a6c
Compare
|
It should still work in the absence of a proper $version = ($_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.0') ? '1.0' : '1.1';
header(sprintf('HTTP/%s %s %s', $version, $this->status, self::$statusCodes[$this->status]));Edit: updated because I hit submit before I finished actually writing valid code :) |
|
There shouldn't be any harm in serving |
dc20a6c to
722f971
Compare
|
I added a test to handle requests with no |
|
What I was suggesting is not that we should blindly return whatever is set… If they request the protocol If they request |
|
Genghis does not support 💩 |
Without this, on one of my setup, upgrading from Apache 2.2 to Apache 2.4 would make the request for the JS asset hang.
722f971 to
c673f41
Compare
|
I'm pretty sure a |
|
You may be right, but Genghis doesn't just run behind Apache. It also runs as standalone in newer versions of PHP, and I doubt PHP has any such logic in place :) |
|
Actually it does, the php builtin server would close the connection and log |
|
Oh, nice. |
|
I narrowed down my problem a bit: it has to do with SSL (switching to plain HTTP works) and the timeout which eventually closes the connection is Apache This is probably a very weird Apache bug, glad i found a dirty fix… |
Why is the requests served with a
HTTP/1.0header?Without this patch, on one of my setup, upgrading from Apache 2.2 to Apache 2.4 would make the request for the JS asset hang.
To be more specific: if the JS asset was under 8000 bytes (exactly), the request would go through perfectly and Apache would add the appropriate
Content-Lengthheader. Over 8000 bytes, Apache would serve only part of what was printed by the php script and then hang until the client timed out. (Using the PHP functionerror_logI was able to make sure the PHP script actually returned, and printed everything).With this patch, for a JS asset over 8000 bytes, Apache switches to a
Transfer-Encoding: chunkedheader (instead of theContent-Lengthone) and serve the response perfectly.I have no idea what is the underlying problem, but updating to HTTP/1.1 makes Apache happy.
Another option would be to use
$_SERVER["SERVER_PROTOCOL"]instead ofHTTP/1.1Or, even better, if Genghis is not supposed to run on PHP < 5.4, this whole line should be replaced by
http_response_code($this->status);and thestatusCodesarray could be dropped.