Skip to content

Commit a88eca5

Browse files
committed
Improve error message for ssl request
1 parent fd50bf2 commit a88eca5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sapi/cli/php_cli_server.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,11 @@ static int php_cli_server_client_read_request(php_cli_server_client *client, cha
16181618
client->parser.data = client;
16191619
nbytes_consumed = php_http_parser_execute(&client->parser, &settings, buf, nbytes_read);
16201620
if (nbytes_consumed != nbytes_read) {
1621-
*errstr = estrdup("Malformed HTTP request");
1621+
if (buf[0] & 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) {
1622+
*errstr = estrdup("Unsupported SSL request");
1623+
} else {
1624+
*errstr = estrdup("Malformed HTTP request");
1625+
}
16221626
return -1;
16231627
}
16241628
if (client->current_header_name) {

0 commit comments

Comments
 (0)