summaryrefslogtreecommitdiff
path: root/sapi/cli/php_cli_server.c
diff options
context:
space:
mode:
authorPeter Kokot <peterkokot@gmail.com>2019-03-25 21:56:39 +0100
committerPeter Kokot <peterkokot@gmail.com>2019-03-25 21:56:39 +0100
commit58e00df9fee69012a41140101880543be4f5ae9a (patch)
treee3e0628f82acd9e18b6f0d1b89ac1ad98e632f0a /sapi/cli/php_cli_server.c
parente4d9d91462eb46249b7bed589603951a3a8cb6f9 (diff)
parent72a2ab39ba977d542fdc33109dead3a87ea9f2ab (diff)
downloadphp-git-58e00df9fee69012a41140101880543be4f5ae9a.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: [ci skip] Update NEWS Fix #77794: Incorrect Date header format in built-in server
Diffstat (limited to 'sapi/cli/php_cli_server.c')
-rw-r--r--sapi/cli/php_cli_server.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index b324958052..38cc094954 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -347,17 +347,16 @@ static void append_essential_headers(smart_str* buffer, php_cli_server_client *c
struct timeval tv = {0};
if (NULL != (val = zend_hash_str_find_ptr(&client->request.headers, "host", sizeof("host")-1))) {
- smart_str_appendl_ex(buffer, "Host", sizeof("Host") - 1, persistent);
- smart_str_appendl_ex(buffer, ": ", sizeof(": ") - 1, persistent);
+ smart_str_appends_ex(buffer, "Host: ", persistent);
smart_str_appends_ex(buffer, val, persistent);
- smart_str_appendl_ex(buffer, "\r\n", 2, persistent);
+ smart_str_appends_ex(buffer, "\r\n", persistent);
}
if (!gettimeofday(&tv, NULL)) {
- zend_string *dt = php_format_date("r", 1, tv.tv_sec, 1);
- smart_str_appendl_ex(buffer, "Date: ", 6, persistent);
+ zend_string *dt = php_format_date("D, d M Y H:i:s", sizeof("D, d M Y H:i:s") - 1, tv.tv_sec, 0);
+ smart_str_appends_ex(buffer, "Date: ", persistent);
smart_str_appends_ex(buffer, dt->val, persistent);
- smart_str_appendl_ex(buffer, "\r\n", 2, persistent);
+ smart_str_appends_ex(buffer, " GMT\r\n", persistent);
zend_string_release_ex(dt, 0);
}