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

Fix CLI server date format #3982

Closed
wants to merge 4 commits into from
Closed

Fix CLI server date format #3982

wants to merge 4 commits into from

Conversation

kelunik
Copy link
Member

@kelunik kelunik commented Mar 24, 2019

Fix the date format to be compliant with https://tools.ietf.org/html/rfc7231#section-7.1.1.2

Copy link
Member

@KalleZ KalleZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a no-brainer as the CLI webserver is only meant for testing anyway, I take it no tests depends on this output and needs to be adjusted

@petk
Copy link
Member

petk commented Mar 24, 2019

+1 for following standards and standard recommendations. PHP is already too permissive up on too many places. However something more needs to be fixed here I think. With current implementation I get this:

Build: PHP 7.2.18-dev
Systems tested: Alpine 3.9 and macOS Mojave 10.14.3

./buildconf && ./configure --disable-all && make
curl -I http://localhost:8084/
HTTP/1.1 404 Not Found
Host: localhost:8084
Date: Sun GMT
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Length: 533

This is intended and ok?

Previously, local time was used instead of GMT.
@kelunik
Copy link
Member Author

kelunik commented Mar 24, 2019

@petk Yes, just noticed this while also fixing using GMT instead of local time. It was the length I forgot to change.

sapi/cli/php_cli_server.c Outdated Show resolved Hide resolved
sapi/cli/php_cli_server.c Outdated Show resolved Hide resolved
@staabm
Copy link
Contributor

staabm commented Mar 24, 2019

Just for context: this change is motivated by this tweet - which contains a example of the php-cli server misbehaving in comparison to nginx
https://twitter.com/arneblankerts/status/1109857090946957319

@krakjoe
Copy link
Member

krakjoe commented Mar 24, 2019 via email

@petk
Copy link
Member

petk commented Mar 24, 2019

Additionally, it would be really good to have a bugs.php.net ID for this if this is going in the PHP-7.2 so we can properly mark it in the NEWS files. Technically, this should go to PHP-7.4+ but if this is not affecting BC then ok.

@krakjoe
Copy link
Member

krakjoe commented Mar 25, 2019

So append_essential_headers is invoked by the static responder, can you test this with only static content or static content first, I'm quite sure it's going to fault still ... obviously this was an existing problem, but if you're familiar with this, maybe you could have a look at solving that problem ? (it doesn't/shouldn't block this pr)

@KalleZ
Copy link
Member

KalleZ commented Mar 25, 2019

@petk The builtin webserver is not intended for anything but testing & development and I would categorize it as a bug fix, so it should go into the lowest possible branch (probably 7.2 as noted).

I agree it should have a ticket associated for NEWS

@kelunik
Copy link
Member Author

kelunik commented Mar 25, 2019

Created https://bugs.php.net/bug.php?id=77794 for reference and fixed what has been mentioned.

@krakjoe I'm not familiar with the code, just saw the tweet and searched for where the date is formatted, sorry.

@kelunik
Copy link
Member Author

kelunik commented Mar 25, 2019

@petk This is a bugfix, so it should go into PHP 7.2 (lowest supported version). Without this fix, the implementation violates the RFC and that causes issues in browsers (see https://gist.github.com/theseer/dff2d65ac80df66afc0a4cca68f4030c).

@petk petk added Bug and removed Quickfix labels Mar 25, 2019
@petk
Copy link
Member

petk commented Mar 25, 2019

Applied via 7f98723 to PHP-7.2+. Thank you @kelunik and the reviewers...

@petk petk closed this Mar 25, 2019
@kelunik kelunik deleted the patch-1 branch March 26, 2019 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants