summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
Diffstat (limited to 'sapi')
-rw-r--r--sapi/cgi/tests/apache_request_headers.phpt2
-rw-r--r--sapi/cli/config.m42
-rw-r--r--sapi/cli/php_cli.c6
-rw-r--r--sapi/cli/php_cli_server.c8
-rw-r--r--sapi/cli/tests/php_cli_server.inc2
-rw-r--r--sapi/fpm/fpm/fpm_sockets.c6
6 files changed, 16 insertions, 10 deletions
diff --git a/sapi/cgi/tests/apache_request_headers.phpt b/sapi/cgi/tests/apache_request_headers.phpt
index 3dc3580c21..881b6bb171 100644
--- a/sapi/cgi/tests/apache_request_headers.phpt
+++ b/sapi/cgi/tests/apache_request_headers.phpt
@@ -31,7 +31,7 @@ echo "Done\n";
?>
--EXPECTF--
X-Powered-By: PHP/%s
-Content-type: text/html; charset=UTF-8
+Content-type: text/%s
Array
(
diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4
index 77fc5e9551..cdfa1f7daf 100644
--- a/sapi/cli/config.m4
+++ b/sapi/cli/config.m4
@@ -44,5 +44,7 @@ if test "$PHP_CLI" != "no"; then
PHP_SUBST(BUILD_CLI)
PHP_OUTPUT(sapi/cli/php.1)
+
+ PHP_INSTALL_HEADERS([sapi/cli/cli.h])
fi
AC_MSG_RESULT($PHP_CLI)
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 2cdd1aac6d..f9bf3ee60b 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -1167,15 +1167,15 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */
} zend_end_try();
out:
- if (exit_status == 0) {
- exit_status = EG(exit_status);
- }
if (request_started) {
php_request_shutdown((void *) 0);
}
if (translated_path) {
free(translated_path);
}
+ if (exit_status == 0) {
+ exit_status = EG(exit_status);
+ }
return exit_status;
err:
sapi_deactivate(TSRMLS_C);
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 05c2cdabc3..89262e863d 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -1618,7 +1618,11 @@ static int php_cli_server_client_read_request(php_cli_server_client *client, cha
client->parser.data = client;
nbytes_consumed = php_http_parser_execute(&client->parser, &settings, buf, nbytes_read);
if (nbytes_consumed != nbytes_read) {
- *errstr = estrdup("Malformed HTTP request");
+ if (buf[0] & 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) {
+ *errstr = estrdup("Unsupported SSL request");
+ } else {
+ *errstr = estrdup("Malformed HTTP request");
+ }
return -1;
}
if (client->current_header_name) {
@@ -2401,7 +2405,7 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */
php_localtime_r(&tv.tv_sec, &tm);
php_asctime_r(&tm, buf);
printf("PHP %s Development Server started at %s"
- "Listening on %s\n"
+ "Listening on http://%s\n"
"Document root is %s\n"
"Press Ctrl-C to quit.\n",
PHP_VERSION, buf, server_bind_address, document_root);
diff --git a/sapi/cli/tests/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc
index 3479cd0bd0..40c5361995 100644
--- a/sapi/cli/tests/php_cli_server.inc
+++ b/sapi/cli/tests/php_cli_server.inc
@@ -38,7 +38,7 @@ function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE)
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
// it might not be listening yet...need to wait until fsockopen() call returns
$i = 0;
- while (($i++ < 5) && !($fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT))) {
+ while (($i++ < 30) && !($fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT))) {
usleep(10000);
}
diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c
index d24dcccc9a..f56b9cfbd1 100644
--- a/sapi/fpm/fpm/fpm_sockets.c
+++ b/sapi/fpm/fpm/fpm_sockets.c
@@ -455,11 +455,11 @@ int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq)
#endif
-int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen) /* {{{ */
+int fpm_socket_unix_test_connect(struct sockaddr_un *sock, size_t socklen) /* {{{ */
{
int fd;
- if (!sun || sun->sun_family != AF_UNIX) {
+ if (!sock || sock->sun_family != AF_UNIX) {
return -1;
}
@@ -467,7 +467,7 @@ int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen) /* {{{
return -1;
}
- if (connect(fd, (struct sockaddr *)sun, socklen) == -1) {
+ if (connect(fd, (struct sockaddr *)sock, socklen) == -1) {
return -1;
}