@@ -412,7 +412,7 @@ static void append_essential_headers(smart_str* buffer, php_cli_server_client *c
412
412
{
413
413
{
414
414
char * * val ;
415
- if (SUCCESS == zend_hash_find (& client -> request .headers , "Host " , sizeof ("Host " ), (void * * )& val )) {
415
+ if (SUCCESS == zend_hash_find (& client -> request .headers , "host " , sizeof ("host " ), (void * * )& val )) {
416
416
smart_str_appendl_ex (buffer , "Host" , sizeof ("Host" ) - 1 , persistent );
417
417
smart_str_appendl_ex (buffer , ": " , sizeof (": " ) - 1 , persistent );
418
418
smart_str_appends_ex (buffer , * val , persistent );
@@ -568,7 +568,7 @@ static char *sapi_cli_server_read_cookies(TSRMLS_D) /* {{{ */
568
568
{
569
569
php_cli_server_client * client = SG (server_context );
570
570
char * * val ;
571
- if (FAILURE == zend_hash_find (& client -> request .headers , "Cookie " , sizeof ("Cookie " ), (void * * )& val )) {
571
+ if (FAILURE == zend_hash_find (& client -> request .headers , "cookie " , sizeof ("cookie " ), (void * * )& val )) {
572
572
return NULL ;
573
573
}
574
574
return * val ;
@@ -1566,12 +1566,9 @@ static int php_cli_server_client_read_request_on_header_value(php_http_parser *p
1566
1566
return 1 ;
1567
1567
}
1568
1568
{
1569
- char * header_name = client -> current_header_name ;
1570
- size_t header_name_len = client -> current_header_name_len ;
1571
- char c = header_name [header_name_len ];
1572
- header_name [header_name_len ] = '\0' ;
1573
- zend_hash_add (& client -> request .headers , header_name , header_name_len + 1 , & value , sizeof (char * ), NULL );
1574
- header_name [header_name_len ] = c ;
1569
+ char * header_name = zend_str_tolower_dup (client -> current_header_name , client -> current_header_name_len );
1570
+ zend_hash_add (& client -> request .headers , header_name , client -> current_header_name_len + 1 , & value , sizeof (char * ), NULL );
1571
+ efree (header_name );
1575
1572
}
1576
1573
1577
1574
if (client -> current_header_name_allocated ) {
@@ -1729,7 +1726,7 @@ static void php_cli_server_client_populate_request_info(const php_cli_server_cli
1729
1726
request_info -> post_data = client -> request .content ;
1730
1727
request_info -> content_length = request_info -> post_data_length = client -> request .content_len ;
1731
1728
request_info -> auth_user = request_info -> auth_password = request_info -> auth_digest = NULL ;
1732
- if (SUCCESS == zend_hash_find (& client -> request .headers , "Content-Type " , sizeof ("Content-Type " ), (void * * )& val )) {
1729
+ if (SUCCESS == zend_hash_find (& client -> request .headers , "content-type " , sizeof ("content-type " ), (void * * )& val )) {
1733
1730
request_info -> content_type = * val ;
1734
1731
}
1735
1732
} /* }}} */
@@ -1967,7 +1964,7 @@ static int php_cli_server_begin_send_static(php_cli_server *server, php_cli_serv
1967
1964
static int php_cli_server_request_startup (php_cli_server * server , php_cli_server_client * client TSRMLS_DC ) { /* {{{ */
1968
1965
char * * auth ;
1969
1966
php_cli_server_client_populate_request_info (client , & SG (request_info ));
1970
- if (SUCCESS == zend_hash_find (& client -> request .headers , "Authorization " , sizeof ("Authorization " ), (void * * )& auth )) {
1967
+ if (SUCCESS == zend_hash_find (& client -> request .headers , "authorization " , sizeof ("authorization " ), (void * * )& auth )) {
1971
1968
php_handle_auth_data (* auth TSRMLS_CC );
1972
1969
}
1973
1970
SG (sapi_headers ).http_response_code = 200 ;
0 commit comments