From 640a0181abfce1cafdefa85b2347db03813487e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= Date: Sat, 28 Jan 2012 01:38:10 +0100 Subject: [PATCH] Fix federation with GnuTLS by passing the ca_file to Typhoeus How did this ever work? Anyway Diaspora now works with libcurl4-gnutls-dev which already supports SNI in most distributions and is also the default for many distros. Everybody should switch to it. Do so by installing it and then do a gem uninstall typhoeus followed by a bundle to compile it with GnuTLS --- lib/hydra_wrapper.rb | 1 + spec/lib/hydra_wrapper_spec.rb | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/hydra_wrapper.rb b/lib/hydra_wrapper.rb index 6edf54c93..bd04f53fb 100644 --- a/lib/hydra_wrapper.rb +++ b/lib/hydra_wrapper.rb @@ -8,6 +8,7 @@ require 'active_support/base64' class HydraWrapper OPTS = {:max_redirects => 3, :timeout => 25000, :method => :post, + :ssl_capath => EnviromentConfiguration.ca_cert_file_location, :headers => {'Expect' => '', 'Transfer-Encoding' => ''} } diff --git a/spec/lib/hydra_wrapper_spec.rb b/spec/lib/hydra_wrapper_spec.rb index 1218642e3..08b9fe4d8 100644 --- a/spec/lib/hydra_wrapper_spec.rb +++ b/spec/lib/hydra_wrapper_spec.rb @@ -2,7 +2,7 @@ # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. -require 'hydra_wrapper' +require 'spec_helper' describe HydraWrapper do before do @@ -74,6 +74,27 @@ describe HydraWrapper do end + describe "#insert_job" do + before do + @wrapper.hydra.stub!(:queue) + @wrapper.stub!(:prepare_request!) + end + + it 'passes the correct options' do + xml = "" + url = "blub" + Typhoeus::Request.should_receive(:new).with(url, { + :max_redirects => 3, :timeout => 25000, :method => :post, + #:ssl_capath => EnvironmentConfiguration. + :headers => {'Expect' => '', + 'Transfer-Encoding' => ''}, + :ssl_capath => EnviromentConfiguration.ca_cert_file_location, + :params => {:xml => CGI.escape(xml)} + }) + @wrapper.insert_job(url, xml, stub) + end + end + describe '#redirecting_to_https?!' do it 'does not execute unless response has a 3xx code' do resp = stub(:code => 200)