I tried to write a web scraper in CHICKEN Scheme, but it didn’t go well not far from the beginning. I had OpenSSL installed via Homebrew, and installed the http-client and openssl eggs. But when I tried to get the content of an HTTPS website, it showed an error:
The problem is from the setup between the openssl egg and the OpenSSL library. Because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries, the OpenSSL from Homebrew is not symlinked into the standard location, and its CA file is put at /usr/local/etc/openssl/cert.pem. And the openssl egg doesn’t know to look at this location.
So to make it work, we need to make sure that the openssl egg uses this CA file. I didn’t find a compiler option or some arguments to config this, so I had to change the egg’s code to make it work.
Get the openssl egg’s source code, and edit openssl.scm:
$ chicken-install -r openssl
$ cd openssl
$ open openssl.scm
In the function ssl-make-client-context*, there is the code:
This means if neither the CA file, or the CA directory is available, it uses the default CA directory. And we can do something similar: in addition to using the default CA directory, we just specify the CA file: