From: Dmitry Stogov Date: Mon, 14 Jul 2014 07:44:53 +0000 (+0400) Subject: Merge branch 'master' into phpng X-Git-Tag: POST_PHPNG_MERGE~58 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32e477c98c706303e1935e3af96632a02949137a;p=php Merge branch 'master' into phpng * master: (40 commits) Bug #67609: TLS connections fail behind HTTP proxy Updated NEWS for #67594 Updated NEWS for #67594 Fix #67594 - invisible colon should be stripped off header name Updated NEWS for 34407 Updated NEWS for 34407 Updated NEWS for 34407 Fix for bug #34407 - ucwords and title case fixed broken merged code Fixed a bug that cannot access custom request header stored in apache_request_headers() though array index. fixed broken merged code Fixed a bug that cannot access custom request header stored in apache_request_headers() though array index. Fixed a bug that cannot access custom request header stored in apache_request_headers() though array index. Fixed a bug that cannot access custom request header stored in apache_request_headers() though array index. Test output relies on expose_php being on 1.2 is a problematic float to print out Lower the default display precision for this test The test output is dependent on expose_php ini fix makefile in phpize mode fixe output_as_table() when no ext was enabled fix end of stream exception when generating makefile ... Conflicts: ext/standard/http_fopen_wrapper.c ext/standard/string.c sapi/cli/php_cli_server.c --- 32e477c98c706303e1935e3af96632a02949137a diff --cc ext/standard/http_fopen_wrapper.c index f7d6fc4500,3eecd7bdae..eb6cebf534 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@@ -120,7 -120,7 +120,7 @@@ php_stream *php_stream_url_wrap_http_ex char *scratch = NULL; char *tmp = NULL; char *ua_str = NULL; - zval *ua_zval = NULL, *tmpzval = NULL; - zval **ua_zval = NULL, **tmpzval = NULL, *ssl_proxy_peer_name = NULL; ++ zval *ua_zval = NULL, *tmpzval = NULL, ssl_proxy_peer_name; int scratch_len = 0; int body = 0; char location[HTTP_HEADER_BLOCK_SIZE]; @@@ -224,6 -224,13 +224,12 @@@ efree(transport_string); if (stream && use_proxy && use_ssl) { + /* Set peer_name or name verification will try to use the proxy server name */ - if (!context || php_stream_context_get_option(context, "ssl", "peer_name", &tmpzval) == FAILURE) { - MAKE_STD_ZVAL(ssl_proxy_peer_name); - ZVAL_STRING(ssl_proxy_peer_name, resource->host, 1); - php_stream_context_set_option(stream->context, "ssl", "peer_name", ssl_proxy_peer_name); ++ if (!context || (tmpzval = php_stream_context_get_option(context, "ssl", "peer_name")) == NULL) { ++ ZVAL_STRING(&ssl_proxy_peer_name, resource->host); ++ php_stream_context_set_option(stream->context, "ssl", "peer_name", &ssl_proxy_peer_name); + } + smart_str header = {0}; smart_str_appendl(&header, "CONNECT ", sizeof("CONNECT ")-1); diff --cc ext/standard/string.c index ec9b8a02a2,ab8280346f..5f4f360ca6 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@@ -2748,25 -2738,22 +2748,30 @@@ PHP_FUNCTION(lcfirst Uppercase the first character of every word in a string */ PHP_FUNCTION(ucwords) { - char *str; + char *str, *delims = " \t\r\n\f\v"; register char *r, *r_end; - int str_len; + int str_len, delims_len = 6; + char mask[256]; +#ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &delims, &delims_len) == FAILURE) { return; } +#else - ZEND_PARSE_PARAMETERS_START(1, 1) ++ ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STRING(str, str_len) ++ Z_PARAM_OPTIONAL ++ Z_PARAM_STRING(delims, delims_len) + ZEND_PARSE_PARAMETERS_END(); +#endif if (!str_len) { RETURN_EMPTY_STRING(); } + php_charmask((unsigned char *)delims, delims_len, mask TSRMLS_CC); + - ZVAL_STRINGL(return_value, str, str_len, 1); + ZVAL_STRINGL(return_value, str, str_len); r = Z_STRVAL_P(return_value); *r = toupper((unsigned char) *r); diff --cc sapi/cli/php_cli_server.c index 4b16e97a56,4cd251ed42..8fe195f6d7 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@@ -1615,10 -1621,14 +1615,13 @@@ static int php_cli_server_client_read_r return 1; } { - char *header_name = zend_str_tolower_dup(client->current_header_name, client->current_header_name_len); - zend_hash_str_add_ptr(&client->request.headers, header_name, client->current_header_name_len, value); - zend_hash_str_add_ptr(&client->request.headers_original_case, client->current_header_name, client->current_header_name_len, value); - efree(header_name); + /* strip off the colon */ - char *orig_header_name = estrndup(client->current_header_name, client->current_header_name_len); ++ zend_string *orig_header_name = STR_INIT(client->current_header_name, client->current_header_name_len, 1); + 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); ++ zend_hash_str_add_ptr(&client->request.headers, lc_header_name, client->current_header_name_len, value); ++ zend_hash_add_ptr(&client->request.headers_original_case, orig_header_name, value); + efree(lc_header_name); - efree(orig_header_name); ++ STR_RELEASE(orig_header_name); } if (client->current_header_name_allocated) {