Skip to content

php_cli_server: ensure a single Date header is present #12363

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

Closed
wants to merge 3 commits into from

Conversation

coppolafab
Copy link
Contributor

Currently the PHP Development Server appends a Date header in the response, despite already set from user code.

Steps to reproduce

index.php:
<?php header('Date: Mon, 25 Mar 1985 00:20:00 GMT');

terminal 1:
$ php -S localhost:8080 index.php

terminal 2:

$ curl -i localhost:8080
HTTP/1.1 200 OK
Host: localhost:8080
Date: Thu, 05 Oct 2023 07:45:57 GMT
Connection: close
X-Powered-By: PHP/8.2.10
Date: Mon, 25 Mar 1985 00:20:00 GMT
Content-type: text/html; charset=UTF-8

I have added a check condition before append the header, and a test file.

@devnexen devnexen requested a review from nielsdos October 5, 2023 16:08
Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

Thanks for the patch @coppolafab . This mostly looks good, I just have some nits and a remark about the case sensitivity.

@coppolafab coppolafab requested a review from nielsdos October 5, 2023 21:26
Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

Looks almost perfect, just some remark

@coppolafab coppolafab requested a review from nielsdos October 5, 2023 21:47
Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!
I'll let the CI finish before merging, and I'll merge tomorrow or so.
EDIT: Windows CI failure is spurious

@nielsdos nielsdos closed this in f6ac08c Oct 6, 2023
@nielsdos
Copy link
Member

nielsdos commented Oct 6, 2023

Merged manually in 8.1 and above, thanks.

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