@@ -408,7 +408,7 @@ static void append_essential_headers(smart_str* buffer, php_cli_server_client *c
408
408
{
409
409
{
410
410
char * * val ;
411
- if (SUCCESS == zend_hash_find (& client -> request .headers , "Host " , sizeof ("Host " ), (void * * )& val )) {
411
+ if (SUCCESS == zend_hash_find (& client -> request .headers , "host " , sizeof ("host " ), (void * * )& val )) {
412
412
smart_str_appendl_ex (buffer , "Host" , sizeof ("Host" ) - 1 , persistent );
413
413
smart_str_appendl_ex (buffer , ": " , sizeof (": " ) - 1 , persistent );
414
414
smart_str_appends_ex (buffer , * val , persistent );
@@ -558,7 +558,7 @@ static char *sapi_cli_server_read_cookies(TSRMLS_D) /* {{{ */
558
558
{
559
559
php_cli_server_client * client = SG (server_context );
560
560
char * * val ;
561
- if (FAILURE == zend_hash_find (& client -> request .headers , "Cookie " , sizeof ("Cookie " ), (void * * )& val )) {
561
+ if (FAILURE == zend_hash_find (& client -> request .headers , "cookie " , sizeof ("cookie " ), (void * * )& val )) {
562
562
return NULL ;
563
563
}
564
564
return * val ;
@@ -1556,12 +1556,9 @@ static int php_cli_server_client_read_request_on_header_value(php_http_parser *p
1556
1556
return 1 ;
1557
1557
}
1558
1558
{
1559
- char * header_name = client -> current_header_name ;
1560
- size_t header_name_len = client -> current_header_name_len ;
1561
- char c = header_name [header_name_len ];
1562
- header_name [header_name_len ] = '\0' ;
1563
- zend_hash_add (& client -> request .headers , header_name , header_name_len + 1 , & value , sizeof (char * ), NULL );
1564
- header_name [header_name_len ] = c ;
1559
+ char * header_name = zend_str_tolower_dup (client -> current_header_name , client -> current_header_name_len );
1560
+ zend_hash_add (& client -> request .headers , header_name , client -> current_header_name_len + 1 , & value , sizeof (char * ), NULL );
1561
+ efree (header_name );
1565
1562
}
1566
1563
1567
1564
if (client -> current_header_name_allocated ) {
@@ -1719,7 +1716,7 @@ static void php_cli_server_client_populate_request_info(const php_cli_server_cli
1719
1716
request_info -> post_data = client -> request .content ;
1720
1717
request_info -> content_length = request_info -> post_data_length = client -> request .content_len ;
1721
1718
request_info -> auth_user = request_info -> auth_password = request_info -> auth_digest = NULL ;
1722
- if (SUCCESS == zend_hash_find (& client -> request .headers , "Content-Type " , sizeof ("Content-Type " ), (void * * )& val )) {
1719
+ if (SUCCESS == zend_hash_find (& client -> request .headers , "content-type " , sizeof ("content-type " ), (void * * )& val )) {
1723
1720
request_info -> content_type = * val ;
1724
1721
}
1725
1722
} /* }}} */
@@ -1957,7 +1954,7 @@ static int php_cli_server_begin_send_static(php_cli_server *server, php_cli_serv
1957
1954
static int php_cli_server_request_startup (php_cli_server * server , php_cli_server_client * client TSRMLS_DC ) { /* {{{ */
1958
1955
char * * auth ;
1959
1956
php_cli_server_client_populate_request_info (client , & SG (request_info ));
1960
- if (SUCCESS == zend_hash_find (& client -> request .headers , "Authorization " , sizeof ("Authorization " ), (void * * )& auth )) {
1957
+ if (SUCCESS == zend_hash_find (& client -> request .headers , "authorization " , sizeof ("authorization " ), (void * * )& auth )) {
1961
1958
php_handle_auth_data (* auth TSRMLS_CC );
1962
1959
}
1963
1960
SG (sapi_headers ).http_response_code = 200 ;
0 commit comments