Get into https webpage

#1

i’ve tried to get into webpage content, but receive an error message:

SSL_connect: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

there is no problem to get into that page by web browser or curl. i’ve also run that code successfully on other domains like https://example.org or https:// httpbin .org

here is the extract from my code:

code (unfortunately it doesn’t work online, so you should run it locally)

i’m don’t know how to fix it, i’m not good at ssl stuff.
could anyone help me?

0 Likes

#2

The https://files.egplusww.com/ webpage does not open in my Chrome browser as well. Looks like it has a problem with certificate.

0 Likes

#3

if i set ssl context to
context = OpenSSL::SSL::Context::Client.insecure

and add that to http/client
client = HTTP::Client.new(uri, tls: context)

i rid off the error message, but page is still inaccessible.
@status_code=400, @status_message="Bad Request"

and i don’t like using insecure method as a solution.

– edit
i’ve changed to a webserver with the valid certificate, but the only change is another error message:

Error reading socket: Connection reset by peer

code with changed server

0 Likes

#4

SOLVED!
there was an issue on local machine with openssl and homebrew. solution was simple: read the console messages :slight_smile:

below is a message from brew install crystal

A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs

and run
/usr/local/opt/openssl/bin/c_rehash

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For pkg-config to find openssl you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

0 Likes