Skip to content

Commit 58e00df

Browse files
committed
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
2 parents e4d9d91 + 72a2ab3 commit 58e00df

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

sapi/cli/php_cli_server.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,17 +347,16 @@ static void append_essential_headers(smart_str* buffer, php_cli_server_client *c
347347
struct timeval tv = {0};
348348

349349
if (NULL != (val = zend_hash_str_find_ptr(&client->request.headers, "host", sizeof("host")-1))) {
350-
smart_str_appendl_ex(buffer, "Host", sizeof("Host") - 1, persistent);
351-
smart_str_appendl_ex(buffer, ": ", sizeof(": ") - 1, persistent);
350+
smart_str_appends_ex(buffer, "Host: ", persistent);
352351
smart_str_appends_ex(buffer, val, persistent);
353-
smart_str_appendl_ex(buffer, "\r\n", 2, persistent);
352+
smart_str_appends_ex(buffer, "\r\n", persistent);
354353
}
355354

356355
if (!gettimeofday(&tv, NULL)) {
357-
zend_string *dt = php_format_date("r", 1, tv.tv_sec, 1);
358-
smart_str_appendl_ex(buffer, "Date: ", 6, persistent);
356+
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);
357+
smart_str_appends_ex(buffer, "Date: ", persistent);
359358
smart_str_appends_ex(buffer, dt->val, persistent);
360-
smart_str_appendl_ex(buffer, "\r\n", 2, persistent);
359+
smart_str_appends_ex(buffer, " GMT\r\n", persistent);
361360
zend_string_release_ex(dt, 0);
362361
}
363362

0 commit comments

Comments
 (0)