diff options
author | Tjerk Meesters <datibbaw@php.net> | 2014-07-12 12:45:50 +0800 |
---|---|---|
committer | Tjerk Meesters <datibbaw@php.net> | 2014-07-12 12:45:50 +0800 |
commit | 1684ba3c6f2f0aa8700363acbca98acf9f3afc45 (patch) | |
tree | a84dfb4285e4ac5ab1af0853c4f373d3642023bf /sapi/cli | |
parent | 377750cd8f9618498d05c0ac7a79b05a5c6794d4 (diff) | |
download | php-git-1684ba3c6f2f0aa8700363acbca98acf9f3afc45.tar.gz |
Fix #67594 - invisible colon should be stripped off header name
Diffstat (limited to 'sapi/cli')
-rw-r--r-- | sapi/cli/php_cli_server.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 15b4f29bf3..6cefa2de9f 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -1685,10 +1685,14 @@ static int php_cli_server_client_read_request_on_header_value(php_http_parser *p return 1; } { - 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); - zend_hash_add(&client->request.headers_original_case, client->current_header_name, client->current_header_name_len + 1, &value, sizeof(char *), NULL); - efree(header_name); + /* strip off the colon */ + char *orig_header_name = estrndup(client->current_header_name, client->current_header_name_len); + char *lc_header_name = zend_str_tolower_dup(client->current_header_name, client->current_header_name_len); + + zend_hash_add(&client->request.headers, lc_header_name, client->current_header_name_len + 1, &value, sizeof(char *), NULL); + zend_hash_add(&client->request.headers_original_case, orig_header_name, client->current_header_name_len + 1, &value, sizeof(char *), NULL); + efree(lc_header_name); + efree(orig_header_name); } if (client->current_header_name_allocated) { |