summaryrefslogtreecommitdiff
path: root/sapi/cli/php_cli_server.c
diff options
context:
space:
mode:
authorChristopher Jones <sixd@php.net>2013-09-13 14:10:53 -0700
committerChristopher Jones <sixd@php.net>2013-09-13 14:10:53 -0700
commitd52dbd569fd0f68ec2c79a96f1a3466c71ef549e (patch)
tree229c4412dc163d13a880f2650c1499ea02065e31 /sapi/cli/php_cli_server.c
parente5678c9b95a68c28f40c43217e299eb22780a526 (diff)
parent9eaffd34c123ae5782054cd32bf6caa50ff2b7d2 (diff)
downloadphp-git-d52dbd569fd0f68ec2c79a96f1a3466c71ef549e.tar.gz
Merge branch 'PHP-5.5' of https://git.php.net/repository/php-src into PHP-5.5
# By Adam Harvey (3) and others # Via Adam Harvey (2) and Michael Wallner (1) * 'PHP-5.5' of https://git.php.net/repository/php-src: fix broken sha2 configure tests Fixed minor bug in test. Move NEWS entries to correct version Fix bug #64782: SplFileObject constructor make $context optional Fix bug #65502: DateTimeImmutable::createFromFormat returns DateTime Fix bug #65548: Comparison for DateTimeImmutable doesn't work Tinker with the wording of the short_open_tag description. Fix NEWS: these commits were after 5.5.4 was branched and will be in 5.5.5. Handle CLI server request headers case insensitively. ensure that the defined interpolation method is used by the generic scaling functions Fixed issue #128 (opcache_invalidate segmentation fault) 5.4.21 now
Diffstat (limited to 'sapi/cli/php_cli_server.c')
-rw-r--r--sapi/cli/php_cli_server.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index cbe9c7bd66..d50cc4f8a0 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -412,7 +412,7 @@ static void append_essential_headers(smart_str* buffer, php_cli_server_client *c
{
{
char **val;
- if (SUCCESS == zend_hash_find(&client->request.headers, "Host", sizeof("Host"), (void**)&val)) {
+ if (SUCCESS == zend_hash_find(&client->request.headers, "host", sizeof("host"), (void**)&val)) {
smart_str_appendl_ex(buffer, "Host", sizeof("Host") - 1, persistent);
smart_str_appendl_ex(buffer, ": ", sizeof(": ") - 1, persistent);
smart_str_appends_ex(buffer, *val, persistent);
@@ -568,7 +568,7 @@ static char *sapi_cli_server_read_cookies(TSRMLS_D) /* {{{ */
{
php_cli_server_client *client = SG(server_context);
char **val;
- if (FAILURE == zend_hash_find(&client->request.headers, "Cookie", sizeof("Cookie"), (void**)&val)) {
+ if (FAILURE == zend_hash_find(&client->request.headers, "cookie", sizeof("cookie"), (void**)&val)) {
return NULL;
}
return *val;
@@ -1566,12 +1566,9 @@ static int php_cli_server_client_read_request_on_header_value(php_http_parser *p
return 1;
}
{
- char *header_name = client->current_header_name;
- size_t header_name_len = client->current_header_name_len;
- char c = header_name[header_name_len];
- header_name[header_name_len] = '\0';
- zend_hash_add(&client->request.headers, header_name, header_name_len + 1, &value, sizeof(char *), NULL);
- header_name[header_name_len] = c;
+ char *header_name = zend_str_tolower_dup(client->current_header_name, client->current_header_name_len);
+ zend_hash_add(&client->request.headers, header_name, client->current_header_name_len + 1, &value, sizeof(char *), NULL);
+ efree(header_name);
}
if (client->current_header_name_allocated) {
@@ -1729,7 +1726,7 @@ static void php_cli_server_client_populate_request_info(const php_cli_server_cli
request_info->post_data = client->request.content;
request_info->content_length = request_info->post_data_length = client->request.content_len;
request_info->auth_user = request_info->auth_password = request_info->auth_digest = NULL;
- if (SUCCESS == zend_hash_find(&client->request.headers, "Content-Type", sizeof("Content-Type"), (void**)&val)) {
+ if (SUCCESS == zend_hash_find(&client->request.headers, "content-type", sizeof("content-type"), (void**)&val)) {
request_info->content_type = *val;
}
} /* }}} */
@@ -1967,7 +1964,7 @@ static int php_cli_server_begin_send_static(php_cli_server *server, php_cli_serv
static int php_cli_server_request_startup(php_cli_server *server, php_cli_server_client *client TSRMLS_DC) { /* {{{ */
char **auth;
php_cli_server_client_populate_request_info(client, &SG(request_info));
- if (SUCCESS == zend_hash_find(&client->request.headers, "Authorization", sizeof("Authorization"), (void**)&auth)) {
+ if (SUCCESS == zend_hash_find(&client->request.headers, "authorization", sizeof("authorization"), (void**)&auth)) {
php_handle_auth_data(*auth TSRMLS_CC);
}
SG(sapi_headers).http_response_code = 200;