diff options
author | Stanley Sufficool <ssufficool@php.net> | 2013-09-26 19:52:01 -0700 |
---|---|---|
committer | Stanley Sufficool <ssufficool@php.net> | 2013-09-26 19:52:01 -0700 |
commit | 9aa904c375cd50a6e8a345f3c053e80a6617a377 (patch) | |
tree | 2ffe61739fa2e38048edbced922ab9b414e450e4 /sapi/cli/php_cli_server.c | |
parent | 67c03eac620993e0c323658ab5cd6bff4616cbfb (diff) | |
parent | 30e0442c549bd20288ca8754daa0cdf24d98f055 (diff) | |
download | php-git-9aa904c375cd50a6e8a345f3c053e80a6617a377.tar.gz |
Merge branch 'PHP-5.4' of https://git.php.net/push/php-src into PHP-5.4
* 'PHP-5.4' of https://git.php.net/push/php-src: (140 commits)
Copy dba_*() keys before converting to string.
Fix the broken sh syntax in ext/imap/config.m4.
Revert "EmptyIterator now implements Countable; fixes bug 60577"
RFC 6598 reserved ip range starts at 100.64.0.0
fix a very rare case of use of uninitialized value combined with a memleak
NEWS for added reserved ip addresses according to RFC 6598
Add RFC 6598 IPs to reserved addresses
NEWS for #60577
NEWS for bug #64441
Fix bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names)
EmptyIterator now implements Countable; fixes bug 60577
News for bugfix #64157
Bug 64157 Changed error message to make sense
Tinker with the wording of the short_open_tag description.
Handle CLI server request headers case insensitively.
5.4.21 now
Typo....
Add a XFAIL test for #64896
Fixed Bug #65564 stack-buffer-overflow in DateTimeZone stuff caught by AddressSanitizer
Fixed bug #60598 (cli/apache sapi segfault on objects manipulation)
...
Diffstat (limited to 'sapi/cli/php_cli_server.c')
-rw-r--r-- | sapi/cli/php_cli_server.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 335d589a67..4da55acc6c 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -408,7 +408,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); @@ -558,7 +558,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; @@ -1325,7 +1325,7 @@ static void php_cli_server_request_translate_vpath(php_cli_server_request *reque static const char *index_files[] = { "index.php", "index.html", NULL }; char *buf = safe_pemalloc(1, request->vpath_len, 1 + document_root_len + 1 + sizeof("index.html"), 1); char *p = buf, *prev_path = NULL, *q, *vpath; - size_t prev_path_len; + size_t prev_path_len = 0; int is_static_file = 0; if (!buf) { @@ -1556,12 +1556,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) { @@ -1719,7 +1716,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; } } /* }}} */ @@ -1957,7 +1954,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; |