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:
- Download cURL from the following URL: https://curl.haxx.se/windows/ (I chose 64bit because that's the system I'm using)
- Go into the archive and browse to
/bin
- Locate
libcurl_x64.dll
(it may be justlibcurl.dll
) - Extract to your local drive
- Rename it to
libcurl.dll
if it has the_x64
suffix - 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
How to Create a Nokogiri Case Insensitive Xpath Selector
How to Read a File from Bottom to Top in Ruby
Xpath Expression for Regex-Like Matching
Trying to Install Ruby-Filemagic on Snow Leopard Using Brew Rather Than Ports
Yaml Indentation for Array in Hash
Ruby Method That Returns Itself
Safe Navigation Operator (&.) for Nil
Ruby Regex Error: Incompatible Encoding Regexp Match (Ascii-8Bit Regexp with Utf-8 String)
Invalid Gemspec -Illformed Requirement ["#<Yaml::Syck::Defaultkey:0Xb5F9C990> 3.2.0"]
Rails Date Format in Form Field
Ruby Forgets Local Variables During a While Loop
Disable Sprockets Asset Caching in Development
How to Insert a String into a Textfile
How to Fire Raw Mongodb Queries Directly in Ruby
How to Install Redcloth on Windows
Sass::Syntaxerror: File to Import Not Found or Unreadable: Compass in Production