{"action":"created","issue":{"url":"https://api.github.com/repos/excon/excon/issues/453","labels_url":"https://api.github.com/repos/excon/excon/issues/453/labels{/name}","comments_url":"https://api.github.com/repos/excon/excon/issues/453/comments","events_url":"https://api.github.com/repos/excon/excon/issues/453/events","html_url":"https://github.com/excon/excon/issues/453","id":52958106,"number":453,"title":"Unknown protocol (OpenSSL::SSL::SSLError) after redirect to SSL","user":{"login":"jarthod","id":201687,"avatar_url":"https://avatars.githubusercontent.com/u/201687?v=3","gravatar_id":"","url":"https://api.github.com/users/jarthod","html_url":"https://github.com/jarthod","followers_url":"https://api.github.com/users/jarthod/followers","following_url":"https://api.github.com/users/jarthod/following{/other_user}","gists_url":"https://api.github.com/users/jarthod/gists{/gist_id}","starred_url":"https://api.github.com/users/jarthod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarthod/subscriptions","organizations_url":"https://api.github.com/users/jarthod/orgs","repos_url":"https://api.github.com/users/jarthod/repos","events_url":"https://api.github.com/users/jarthod/events{/privacy}","received_events_url":"https://api.github.com/users/jarthod/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-12-27T14:22:38Z","updated_at":"2015-01-06T18:52:19Z","closed_at":"2015-01-05T21:53:19Z","body":"Hi,\r\n\r\nWhile comparing `em-http-request`, `excon` and `typhoeus` for my project, I think I found a bug related to redirection following & SSL.\r\n\r\nHere is how to reproduce it:\r\n```ruby\r\nrequire 'excon'\r\nExcon.defaults[:middlewares] << Excon::Middleware::RedirectFollower\r\nresponse = Excon.head('http://relaterocket.co')\r\nputs \"complete #{response.status}\"\r\n```\r\n\r\nAnd here is the exception I got:\r\n```\r\nexcon-0.42.1/lib/excon/ssl_socket.rb:121:in `connect_nonblock': SSL_connect returned=1 errno=0 state=unknown state: unknown protocol (OpenSSL::SSL::SSLError) (Excon::Errors::SocketError) (Excon::Errors::SocketError)\r\n  from excon-0.42.1/lib/excon/ssl_socket.rb:121:in `block in initialize'\r\n  from timeout.rb:91:in `block in timeout'\r\n  from timeout.rb:35:in `block in catch'\r\n  from timeout.rb:35:in `catch'\r\n  from timeout.rb:35:in `catch'\r\n  from timeout.rb:106:in `timeout'\r\n  from excon-0.42.1/lib/excon/ssl_socket.rb:117:in `initialize'\r\n  from excon-0.42.1/lib/excon/connection.rb:380:in `new'\r\n  from excon-0.42.1/lib/excon/connection.rb:380:in `socket'\r\n  from excon-0.42.1/lib/excon/connection.rb:105:in `request_call'\r\n  from excon-0.42.1/lib/excon/middlewares/base.rb:15:in `request_call'\r\n  from excon-0.42.1/lib/excon/middlewares/mock.rb:47:in `request_call'\r\n  from excon-0.42.1/lib/excon/middlewares/instrumentor.rb:22:in `request_call'\r\n  from excon-0.42.1/lib/excon/middlewares/base.rb:15:in `request_call'\r\n  from excon-0.42.1/lib/excon/middlewares/base.rb:15:in `request_call'\r\n  from excon-0.42.1/lib/excon/middlewares/base.rb:15:in `request_call'\r\n  from excon-0.42.1/lib/excon/connection.rb:232:in `request'\r\n  from excon-0.42.1/lib/excon/middlewares/redirect_follower.rb:37:in `response_call'\r\n  from excon-0.42.1/lib/excon/middlewares/base.rb:19:in `response_call'\r\n  from excon-0.42.1/lib/excon/middlewares/instrumentor.rb:30:in `response_call'\r\n  from excon-0.42.1/lib/excon/middlewares/base.rb:19:in `response_call'\r\n  from excon-0.42.1/lib/excon/middlewares/expects.rb:13:in `response_call'\r\n  from excon-0.42.1/lib/excon/middlewares/response_parser.rb:8:in `response_call'\r\n  from excon-0.42.1/lib/excon/connection.rb:365:in `response'\r\n  from excon-0.42.1/lib/excon/connection.rb:235:in `request'\r\n  from excon-0.42.1/lib/excon.rb:226:in `head'\r\n  from ./excon_bug.rb:3:in `<main>'\r\n```\r\n\r\nThis it working fine with `typhoeus/curl`, here is the curl output:\r\n```\r\n$> curl -LI http://relaterocket.co\r\nHTTP/1.1 302 Found\r\nCache-Control: no-cache\r\nContent-length: 0\r\nLocation: https://relaterocket.co/\r\nConnection: close\r\n\r\nHTTP/1.1 200 OK\r\nServer: nginx\r\nDate: Sat, 27 Dec 2014 14:13:14 GMT\r\nContent-Type: text/html\r\nContent-Length: 4147\r\nLast-Modified: Tue, 02 Dec 2014 04:40:10 GMT\r\nVary: Accept-Encoding\r\nETag: \"547d42aa-1033\"\r\nAccept-Ranges: bytes\r\nStrict-Transport-Security: max-age=31536000; includeSubDomains\r\n\r\n```\r\nThe HEAD request with `excon` works fine to `https://relaterocket.co` directly though, that's why I think the issue is related to the redirection following middleware.\r\n\r\nAnyway thanks for your work on `excon`, very nice library.\r\n:christmas_tree: Merry Christmas"},"comment":{"url":"https://api.github.com/repos/excon/excon/issues/comments/68912591","html_url":"https://github.com/excon/excon/issues/453#issuecomment-68912591","issue_url":"https://api.github.com/repos/excon/excon/issues/453","id":68912591,"user":{"login":"geemus","id":4138,"avatar_url":"https://avatars.githubusercontent.com/u/4138?v=3","gravatar_id":"","url":"https://api.github.com/users/geemus","html_url":"https://github.com/geemus","followers_url":"https://api.github.com/users/geemus/followers","following_url":"https://api.github.com/users/geemus/following{/other_user}","gists_url":"https://api.github.com/users/geemus/gists{/gist_id}","starred_url":"https://api.github.com/users/geemus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geemus/subscriptions","organizations_url":"https://api.github.com/users/geemus/orgs","repos_url":"https://api.github.com/users/geemus/repos","events_url":"https://api.github.com/users/geemus/events{/privacy}","received_events_url":"https://api.github.com/users/geemus/received_events","type":"User","site_admin":false},"created_at":"2015-01-06T18:52:19Z","updated_at":"2015-01-06T18:52:19Z","body":"Yeah, hopefully we can change that default soon. According to specs it is supposed to be safe to include (or not), so I thought at the time it would be nice to keep it simple and just always include it. Unfortunately, lots of servers behave differently when it is present (or not), among other things, which ended up being a big pain..."}}