Sascha2018 has asked for the wisdom of the Perl Monks concerning the following question:

Hello. i tried to get working my Perl Script. ( Chatserver ) I have installed it on localhost and i created a certificate with mkcert. ( Linux Mint ) Now, everytime, i want to login into my page i get an error in the browser:
Secure Connection Failed An error occurred during a connection to 127.0.0.1:22222. SSL_ERROR_RX +_UNEXPECTED_RECORD_TYPE
In my console i got this error:
DEBUG: .../IO/Socket/SSL.pm:1042: local error: SSL accept attempt fail +ed error:140940F4:SSL routines:ssl3_read_bytes:unexpected message [07.04.2020 - 20:17:06] SSL Error: SSL accept attempt failed error:140 +940F4:SSL routines:ssl3_read_bytes:unexpected message DEBUG: .../IO/Socket/SSL.pm:2875: free ctx 94723586472400 open=9472358 +6472400 94723590508016 DEBUG: .../IO/Socket/SSL.pm:2886: OK free ctx 94723586472400 DEBUG: .../IO/Socket/SSL.pm:962: no socket yet DEBUG: .../IO/Socket/SSL.pm:964: accept created normal socket IO::Sock +et::SSL=GLOB(0x56268dfe9eb0) DEBUG: .../IO/Socket/SSL.pm:992: starting sslifying DEBUG: .../IO/Socket/SSL.pm:1039: Net::SSLeay::accept -> 1 DEBUG: .../IO/Socket/SSL.pm:1087: handshake done, socket ready DEBUG: .../IO/Socket/SSL.pm:980: accept_SSL ok DEBUG: .../IO/Socket/SSL.pm:2853: new ctx 94723586472400 DEBUG: .../IO/Socket/SSL.pm:1540: start handshake DEBUG: .../IO/Socket/SSL.pm:992: starting sslifying DEBUG: .../IO/Socket/SSL.pm:1039: Net::SSLeay::accept -> -1 DEBUG: .../IO/Socket/SSL.pm:1042: SSL accept attempt failed DEBUG: .../IO/Socket/SSL.pm:1042: local error: SSL accept attempt fail +ed error:140940F4:SSL routines:ssl3_read_bytes:unexpected message [07.04.2020 - 20:17:06] SSL Error: SSL accept attempt failed error:140 +940F4:SSL routines:ssl3_read_bytes:unexpected message DEBUG: .../IO/Socket/SSL.pm:2875: free ctx 94723586472400 open=9472359 +0508016 94723586472400 DEBUG: .../IO/Socket/SSL.pm:2886: OK free ctx 94723586472400
How can i resolve the problem? Thank you very much

Replies are listed 'Best First'.
Re: IO::Socket::SSL -> unexpected message !
by haukex (Bishop) on Apr 11, 2020 at 19:47 UTC

    I think that in addition to Corion's advice, a Short, Self-Contained, Correct Example would be very useful here. Reduce your script to the bare minimum needed to reproduce the error by removing pieces of code bit by bit: if the problems goes away, then the problem was in that piece of code, and if the problem stays, you know that piece of code wasn't relevant. Doing this will help you, as it will narrow down the issue to the part of the code that is causing the problem, and it well help us, because it'll give you a short piece of code to post here that we can download and run to try to reproduce the problem.

Re: IO::Socket::SSL -> unexpected message !
by Corion (Pope) on Apr 11, 2020 at 19:31 UTC
Re: IO::Socket::SSL -> unexpected message !
by Sascha2018 (Acolyte) on Apr 17, 2020 at 22:10 UTC
    Hello. Thank you for the replies. This is the output of curl:
    curl https://127.0.0.1:2222 curl: (56) OpenSSL SSL_read: error:1408F1BB:SSL routines:ssl3_get_reco +rd:bad record type, errno 0
    In the browser i get this message:
    Secure Connection Failed An error occurred during a connection to 127.0.0.1:2222. SSL_ERROR_RX_ +UNEXPECTED_RECORD_TYPE The page you are trying to view cannot be shown because the authen +ticity of the received data could not be verified. Please contact the website owners to inform them of this problem.
    The code of my program is very long. I can not post it here... Can you help me please? Thanks

      This random StackOverflow comment still suggests that your webserver is mixing up plaintext connections and SSL connections.

      Maybe the following "works" and returns a webpage?

      curl http://127.0.0.1:2222

      Alternatively, maybe you're trying to start an SSLv3 connection, but your web server does not speak SSLv3 ?

      Without anything to replicate this situation, all I can do is Google your error message and guess. I think this is something you can do as well...

        Thank you very much... i solved the problem. Now i use another file ( i have programmed earlier ) and it works ;)