Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

typhoeus: disable_ssl_peer_verification is invalid #226

Closed
bootstraponline opened this Issue · 21 comments

6 participants

bootstraponline Hans Hasselberg Iain Barnett Alex Koppel Niranjana Srinivasan ballenjr
bootstraponline

I meant to open this on Faraday.

Hans Hasselberg
Owner

Hi @bootstraponline, you're right here. Faraday will move every adapter in its own gem(https://github.com/technoweenie/faraday/issues/202) and typhoeus is the first supporting that(http://rubydoc.info/github/typhoeus/typhoeus/Faraday/Adapter/Typhoeus). You have to require 'typhoeus/adapters/faraday' to make it work.

bootstraponline

@i0rek Thanks! require 'typhoeus/adapters/faraday' works.

Iain Barnett

A few questions:

  • When did this change? There's nothing I can find in the changelog about this.
  • Where is it documented?
  • Why does require 'typhoeus/adapters/faraday' work on one project with Faraday and Typhoeus but on another it says that's not found and require 'faraday/adapter/typhoeus' is what's needed?
Hans Hasselberg
Owner

@yb66 A few answers:

When did this change? There's nothing I can find in the changelog about this.

I assume you mean: When did disable_ssl_peer_verification option was renamed to ssl_verifypeer? It was changed in 0.5.0 and is mentioned in the changelog here:

The options you can set might have a slightly other names, as Ethon sticks to libcurl names

.

Where is it documented?

Here: http://rubydoc.info/github/typhoeus/ethon/Ethon/Easy/Options#ssl_verifypeer%3D-instance_method

Why does require 'typhoeus/adapters/faraday' work on one project with Faraday and Typhoeus but on another it says that's not found and require 'faraday/adapter/typhoeus' is what's needed?

Faraday does not support Typhoeus 0.5. If you want to use Typhoeus 0.5 with Faraday you have to require typhoeus/adapters/faraday.

Iain Barnett

@i0rek

I don't even know what Ethon is, and if I have to know about the options of underlying libraries to the one I actually want to use, I'd say that's an issue with the documentation (at the least).

Thanks for letting me know about the Faraday support.

Hans Hasselberg
Owner

@yb66 You are right, you don't have to know that because its documented here: http://rubydoc.info/github/typhoeus/typhoeus/Typhoeus/Request#initialize-instance_method.

Iain Barnett

@i0rek Glad to see that. I think the link in that note would be better as http://rubydoc.info/github/typhoeus/ethon/Ethon/Easy/Options btw.

Thanks for you patience.

Cyril Fluck Cyril-sf referenced this issue in arsduo/koala
Merged

Add support for debug_token #265

Alex Koppel

This is me jumping into a discussion without perhaps all the background, but as a maintainer of a gem that uses Faraday (Koala), it would make me a little nervous if different adapters take differently named options; it seems like that removes a bit of the benefit of Faraday. I'm not sure that's what's happening here (hopefully I'm wrong), and if so the real solution seems like Faraday should publish a set of options available through it and ask all adapters to translate those automatically.

For the most part I'm just passing HTTP options through without changing them, so it won't immediately affect me, but I'm for anything that moves the complexity to our (the gem-writer's) layers and away from the end users, who are less familiar with Faraday/Facebook/whatever system we're working with.

PS great work, @i0rek, it's exciting to see Typheous maintained and useful again! I cut my remote API teeth with the gem.

Hans Hasselberg
Owner

@arsduo I think you are wrong. The option name change doesn't affect Faraday users - only the underlying typhoeus adapter, which is the reason why I rewrote it.

Graeme C c0ley referenced this issue in sferik/twitter
Closed

thread safe? #354

Niranjana Srinivasan

My app uses ethon (0.5.10) faraday (0.7.6) typhoeus (0.6.2) for the panda gem. I got this error and so added require 'typhoeus/adapters/faraday' inside easy.rb (in ethon gem). But now when I try to fire up the rails console, it is throwing the following error:

    /home/vasu/.rvm/gems/ruby-1.8.7-p371/gems/typhoeus-0.6.2/lib/typhoeus/adapters/faraday.rb:19: 
   undefined method `supports_parallel=' for Faraday::Adapter::Typhoeus:Class (NoMethodError)
from /home/vasu/.rvm/gems/ruby-1.8.7-p371/gems/ethon-0.5.10/lib/ethon/easy.rb:11:in `require'
from /home/vasu/.rvm/gems/ruby-1.8.7-p371/gems/ethon-0.5.10/lib/ethon/easy.rb:11

I am noob, please can you tell me what I am doing wrong?

Hans Hasselberg
Owner
i0rek commented

Don't put the require in easy.rb but in your own class after you required Faraday.
Something like that:

require 'faraday'
require 'typhoeus'
require 'typhoeus/adapters/faraday'

conn = Faraday.new(url: "www.example.com") do |faraday|
  faraday.adapter :typhoeus
end

response = conn.get("/")

Docs: http://rubydoc.info/github/typhoeus/typhoeus/frames/Faraday/Adapter/Typhoeus,

Niranjana Srinivasan

many thanks i0rek, am able to get it working now!

ballenjr

Hello @i0rek,

I am having the same problem. I started with the issue at the top, found this issue, put require into my script, and now I get the supports_parallel=' for Faraday::Adapter::Typhoeus:Class (NoMethodError).
I didn't put the require into a dependency file like nsrini2, mine is in the correct place.
The error happens on this line /typhoeus-0.6.4/lib/typhoeus/adapters/faraday.rb:19:in
class:Typhoeus': if it matters.

Does the order of inclusion matter here? I tried moving my require 'faraday_middleware' below your adapter require, but still the same error. I am not sure what is happening here, I am fairly new to ruby. Any help would be greatly appreciated.

Hans Hasselberg
Owner

@ballenjr could you give me a small piece of code to reproduce your problem?

ballenjr

CODE:
#!/usr/bin/env ruby

require 'rubygems'
require 'bundler/setup'
require 'airbrake'
require 'enumerator'
require 'work_queue'

require 'choice'
require 'faraday'
require 'json'
require 'typhoeus'
require 'typhoeus/adapters/faraday'
require 'faraday_middleware'
:END CODE

TEST FILE PROPERTIES:
ll test.rb
-rw-r--r-- 1 root root 306 Aug 14 18:17 test.rb

PERMISSIONS:
root

COMMAND:
ruby test.rb

ERROR:
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/typhoeus-0.6.4/lib/typhoeus/adapters/faraday.rb:19:in <class:Typhoeus>': undefined methodsupports_parallel=' for Faraday::Adapter::Typhoeus:Class (NoMethodError)
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/typhoeus-0.6.4/lib/typhoeus/adapters/faraday.rb:18:in <class:Adapter>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/typhoeus-0.6.4/lib/typhoeus/adapters/faraday.rb:4:in
module:Faraday'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/typhoeus-0.6.4/lib/typhoeus/adapters/faraday.rb:3:in <top (required)>'
from test.rb:13:in
require'
from test.rb:13:in `'

GEMFILE:
source 'http://rubygems.org'

gem 'airbrake', '3.0.9'
gem 'choice'
gem 'faraday', '0.7.5'
gem 'faraday_middleware', '0.9.0'
gem 'typhoeus'
gem 'json'
gem 'work_queue'

group :development do
gem 'capistrano', '2.9.0'
gem 'railsless-deploy', '1.0.2'
gem 'pry'
end

BUNDLE SHOW:
Gems included by the bundle:

  • activesupport (3.2.8)
  • addressable (2.2.8)
  • airbrake (3.0.9)
  • builder (3.1.4)
  • bundler (1.3.5)
  • capistrano (2.9.0)
  • choice (0.1.6)
  • coderay (1.0.9)
  • ethon (0.6.0)
  • faraday (0.7.5)
  • faraday_middleware (0.9.0)
  • ffi (1.9.0)
  • highline (1.6.19)
  • i18n (0.6.1)
  • json (1.8.0)
  • method_source (0.8.1)
  • mime-types (1.23)
  • multi_json (1.3.6)
  • multipart-post (1.1.5)
  • net-scp (1.1.1)
  • net-sftp (2.1.2)
  • net-ssh (2.6.7)
  • net-ssh-gateway (1.2.0)
  • pry (0.9.12.2)
  • rack (1.4.1)
  • railsless-deploy (1.0.2)
  • slop (3.4.5)
  • typhoeus (0.6.4)
  • work_queue (2.5.2)

Distro:
lubuntu

uname -a:
Linux 3.8.0-27-generic #40-Ubuntu SMP Tue Jul 9 00:19:35 UTC 2013 i686 i686 i686 GNU/Linux

Hopefully that is verbose enough. I am guessing its overkill though, because when trying to reproduce the error with the least amount of code I noticed that the 3 requires by themselves did not do it. I am contemplating whether or not I should pursue that. All I want to do is batch a bunch of api requests so that they run in parallel. I also have the work_queue that I tried to get to queue the requests but it doesn't seem to be working right. But either way I am guessing that an issue like this will interest you.

I have also noticed something else with my bundler, maybe you could explain it? It doesn't seem to handle recursive dependencies very well. I will do bundle install and it will say everything is good then I get an error saying that one of my dependencies is missing a dependancy. So I navigate to that gem and run bundle install again and sure enough it installs some more stuff that I didn't have. ???

ballenjr

@i0rek, I updated faraday to 0.8.8 and the error has disappeared. Sorry for taking up your time.

Wouldn't mind an explanation for that bundler issue, if you happen to have one, though.

Hans Hasselberg
Owner
ballenjr

@i0rek, So now that I got rid of the error how do I make my api calls in parallel with this adapter? The only examples I can find are without faraday and they don't explain how to consume the response in parallel.

Hans Hasselberg
Owner

@ballenjr Pls ask them how to use it - I'm not a faraday user myself.

ballenjr
sideci-sample sideci-sample referenced this issue from a commit in sideci-sample/sideci-sample-koala
Cyril Fluck Support for Faraday with Typhoeus 0.5 24f9d4a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.