Rails Typhoeus Curl Trouble

Rails Typhoeus Curl Trouble

Is libcurl properly installed? Typhoeus has no native extensions but it requires libcurl dynamic library (.so) since it works with the FFI library:

# from lib/typhoeus/curl.rb
ffi_lib 'libcurl'

I would say that the development files (headers) are not needed so sudo apt-get install libcurl3 should do the trick (otherwise install the devel version w/ SSL support via sudo apt-get install libcurl4-openssl-dev).

How to solve 'libcurl' not found with Rails on Windows

Answer that worked for me (W10/Ruby2.6.0) was:

  1. Download cURL from the following URL: https://curl.haxx.se/windows/ (I chose 64bit because that's the system I'm using)
  2. Go into the archive and browse to /bin
  3. Locate libcurl_x64.dll (it may be just libcurl.dll)
  4. Extract to your local drive
  5. Rename it to libcurl.dll if it has the _x64 suffix
  6. Cut + paste the file into the /bin directory of your Ruby installation

Typhoeus Windows installation

Seem to have figured it out. If anyone is having the same issue, make sure to download the following package from curl.haxx.se/download.html

Win32 2000/XP zip 7.34.0 libcurl SSL Günter Knauf 3.34 MB

Extract the bin directory to wherever and make sure to add it to your PATH. I also added .DLL to PATHEXT reset comp and it worked.

Typhoeus ssl_connect_error

After some sometime I reached into https://imlc.me/dh-key-too-small where it gives directions on how to lower one's own security level.

But it also tell you that you can add the --cipher 'DEFAULT:!DH into curl command line

Now, to get that flag working in Typhoeus, you have to send an option to Ethon about it. In Ethon Options the ssl_cipher_list is a valid option.

So now you can just add ssl_cipher_list into your Request options like so

request = Typhoeus::Request.new(url,
method: method,
body: body,
headers: headers,
params: params,
ssl_cipher_list: 'DEFAULT:!DH')

Typhoeus::Request.new(...) doesn't work, but Typhoeus::Request.get(...) does!

You need to run the request in a Hydra:

request = Typhoeus::Request.new
hydra = Typhoeus::Hydra.new
hydra.queue(request)
hydra.run
request.response #=> "response"

I monkey patched Typhoeus so that it will automatically queue up the response in a Hydra if it hasn't been ran already.

How do I denote content from curl's user flag (-u) in Typhoeus?


How can I set the -u flag equivalent in a Typhoeus request?

Use the userpwd key within the options hash, e.g:

url = "http://httpbin.org/basic-auth/john/pwd1234"
Typhoeus::Request.new(url, userpwd: "john:pwd1234").run

Why am I getting a segmentation fault in Typheous when I perform a POST request?

After I upgraded the curl from 7.15 to 7.22. The problem has been solved.

gem install typhoeus - failed to build gem extension

Not sure, but it seems that your system is not quite as the gem source expects.

Since its using curl and from this old problem, I would guess that your curl needs updating.

Is it the system installed curl, or are you using macports - perhaps its worth doing an update...

Alternatively can you try the install on a recent *nix system - that might work and so confirm its an environment issue.

From the github page, there are some notes on how to use it with an old curl...

Good luck, Chris



Related Topics



Leave a reply



Submit