arsduo / koala

A lightweight Facebook library supporting the Graph, Marketing, and Atlas APIs, realtime updates, test users, and OAuth.
http://developers.facebook.com/
MIT License
3.56k stars 468 forks source link

OpenSSL Digest in Ruby 1.8.7 patch-level 253 (enterprise ruby) #54

Closed gabrielhase closed 13 years ago

gabrielhase commented 13 years ago

In the enterprise ruby (1.8.7 patch-level 253) the OpenSSL Digest seems to have slightly changed. The line 231 in koala.rb which tries to do a hexdigest with sha256 fails with an error message that a string is given instead of a OpenSSL::Digest::Digest type. A similar problem is reported here (has nothing to do with koala):

http://stackoverflow.com/questions/3393849/typeerror-wrong-argument-string-expected-kind-of-openssldigestdigest

I am not sure yet how to make it compatible between the different ruby versions, but I will look into it and tell you if I find out.

arsduo commented 13 years ago

Thanks for taking a look at this! I obviously hadn't seen it, but I'd be grateful for your help in getting Koala to work in that version of Ruby. Just so you know, we've just tweaked that code to reflect Facebook's new implementation of parse_signed_request, but the offending line is still more or less intact.

Best,

Alex

gabrielhase commented 13 years ago

I replaced the line: OpenSSL::HMAC.hexdigest('sha256', @app_secret, encoded_envelope).split.pack('H*')

with this one: OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA256.new, @app_secret, encoded_envelope).split.pack('H*')

which worked for ruby 1.8.7 253 as well as my dev environment.

arsduo commented 13 years ago

Awesome, thanks! I've committed that change, and all the tests pass, so it'll go out in the next release.

gabrielhase commented 13 years ago

Hi!

I just checked koala again and found that I need exactly what itchy did in his pull request (setting defaults for timeout). Do you plan do take on this pull request? (depending on this I would go with a monkeypatch or just wait for the next version of koala).

Thanks, Gabriel

Gabriel Hase politnetz.ch: Plattform fr Schweizer Politik im Netz Geschftsleitung, Konzept & Technik

+41 79 504 05 44 +41 44 450 41 50 gabriel.hase@politnetz.ch andreas.amsler@politnetz.ch

Zentralstrasse 37, 8003 Zrich

On Tue, Apr 5, 2011 at 5:26 PM, arsduo < reply@reply.github.com>wrote:

Awesome, thanks! I've committed that change, and all the tests pass, so it'll go out in the next release.

Reply to this email directly or view it on GitHub: https://github.com/arsduo/koala/issues/54#comment_959524

arsduo commented 13 years ago

Servus Gabriel!

We're going to incorporate itchy's pull request in the next release (hopefully in the next few weeks). A colleague of mine is working on some other (internal) changes to the HTTPServices modules to make them more flexible, and I've asked him to incorporate the pull request as well.

Best,

Alex

itchy commented 13 years ago

Great.

Thanks Alex.

Scott