Curb (curl) for jruby?

I am trying to use curl with jruby to get response time for web pages / files. usually in ruby ​​this was not a problem and i could just install the gem (gem install curb) and all is well.

curb seems to be incompatible with jruby, so is there an alternative I can use to get webpage load time in a similar way? I looked in the net / http class, but it does not have a function that would work

curl.total_time is what I would use if I could. any ideas?

+3
source share
1 answer

According to the curb instruction ( http://curb.rubyforge.org/ ), curb is "Ruby language bindings for libcurl."

So, if the stone does not use FFI, it will not work with JRuby. I do not believe that it will work with Windows.

In jruby, you can make a shell call and use backlinks to capture the output from curl.

Or you can use Net :: HTTP and Time, for example:

require 'net/http'
require 'time'
s = Time.new
html = Net::HTTP.get(URI.parse('http://yoursite/'))
puts Time.new - s
+2
source

Source: https://habr.com/ru/post/1710046/


All Articles