tags:

views:

319

answers:

1

i'm trying to use curl with jruby to get some response times for webpages/files. normally in ruby this would not be an issue and i could just install the gem (gem install curb) and all is well.

curb appears to be incompatible with jruby, so is there an alternative that i can use to get web page load times in a similar fashion? i looked into the net/http class however it doesn't have a function that would work

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

A: 

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

So unless the gem uses FFI, no it wont work with JRuby. I don't believe it will work with Windows either.

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

Or you could use Net::HTTP and Time like so:

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