Happened to notice that the gem returns an SSL related error when trying to send a GET request to https://www.fokis.se (haven't seen this error for any other sites).
[2] pry(main)> require "twingly/http"
=> true
[3] pry(main)> client = Twingly::HTTP::Client.new(logger: Logger.new(IO::NULL), base_user_agent: "")
=> #<Twingly::HTTP::Client:0x00000001059c9b58>
[4] pry(main)> client.get("https://www.fokis.se")
Twingly::HTTP::ConnectionError: Twingly::HTTP::ConnectionError
from /Users/X/.gem/ruby/3.2.2/gems/twingly-http-0.4.0/lib/twingly/http.rb:102:in `rescue in http_response_for'
Caused by Faraday::SSLError: SSL_read: unexpected eof while reading
from /Users/X/.rubies/ruby-3.2.2/lib/ruby/3.2.0/openssl/buffering.rb:214:in `sysread_nonblock'
Caused by OpenSSL::SSL::SSLError: SSL_read: unexpected eof while reading
from /Users/X/.rubies/ruby-3.2.2/lib/ruby/3.2.0/openssl/buffering.rb:214:in `sysread_nonblock'
While troubleshooting, I noticed that the request works when this line is removed:
|
faraday.headers[:user_agent] = user_agent |
I'm not sure why the user agent would cause the error, but it will hopefully get clearer after some further investigation.