jeroen / curl

A Modern and Flexible Web Client for R
https://jeroen.r-universe.dev/curl
Other
216 stars 71 forks source link

error:0A00010B:SSL routines::wrong version number #305

Open scizmeli opened 1 year ago

scizmeli commented 1 year ago

I am trying to run RSelenium under ubuntu but curl_fetch_disk gives error

library(RSelenium)
rD <- rsDriver(browser="chrome", port=4545L, verbose=F)

But I get :

Error in curl::curl_fetch_disk(url, x$path, handle = handle) : 
  error:0A00010B:SSL routines::wrong version number

Made a research on the internet but can't find anything related with this issue. Tried to reinstall ubuntu package libcurl4-openssl-dev and reinstalled R library curl. But the problem persists.

Anyone any ideas?

Ubuntu version

cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

R version

platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          4                           
minor          3.1                         
year           2023                        
month          06                          
day            16                          
svn rev        84548                       
language       R                           
version.string R version 4.3.1 (2023-06-16)
nickname       Beagle Scouts      
jeroen commented 1 year ago

Sorry I have no idea. Can you figure out which server that curl is connecting to that gives this error?

scizmeli commented 1 year ago

Actually I did not provide any URL yet. I am not sure if it connects to any server yet.

My guess is that at this stage, rsDriver() is simply trying to connect to the Selenium driver for an internal check during instantiation... And it fails right there.

Have a hunch about openSSL incompatibility... but have no idea how to fix this. Using ubuntu openSSL package.

jeroen commented 1 year ago

What is your curl::curl_version() ? In particular the ssl backend and version?

OpenSSL 3 requires at least TLS v1.2 by default. Perhaps your version of Selenium does not support this? You can try lowering the sslversion in the curl handle: https://curl.se/libcurl/c/CURLOPT_SSLVERSION.html

This will set it to TLS 1.0 or higher (which is the most relaxed option):

sslversion <- curl::curl_symbols('CURL_SSLVERSION_TLSv1$')$value
curl::handle_setopt(handle, sslversion=sslversion)

One other thing you can try on ubuntu is swapping out the TLS back-end. E.g. switch between libcurl4-openssl-dev and libcurl4-gnutls-dev and then reinstall the curl R package from source.