The behavior of exceptions thrown from an on_body handler differs based upon the value passed to the verbose switch. Ideally the behavior should be the same or the difference in behavior documented if intentional.
You can run this example code to see a demonstration of the issue:
#!/usr/bin/env ruby
require 'ethon'
# Use a healthy endpoint of your choice
URL = "http://0.0.0.0"
handler = proc do
raise "My Exception"
end
puts "Running with verbose: true"
easy = Ethon::Easy.new(url: URL, verbose: true)
easy.on_body(&handler)
easy.perform
puts "No exception here: #{easy.return_code}"
puts "Running with verbose: false"
easy2 = Ethon::Easy.new(url: URL, verbose: false)
easy2.on_body(&handler)
easy2.perform
puts "This will never print."
Note that the when verbose is true an exception is not thrown.
A quick review of the cURL source wasn't helpful. I believe the issue lies either in ethon or ffi, but was not able to determine where.
The behavior of exceptions thrown from an
on_bodyhandler differs based upon the value passed to theverboseswitch. Ideally the behavior should be the same or the difference in behavior documented if intentional.You can run this example code to see a demonstration of the issue:
Note that the when
verboseistruean exception is not thrown.A quick review of the cURL source wasn't helpful. I believe the issue lies either in ethon or ffi, but was not able to determine where.