Rails 3.1 TemplateHandler compatibility. #12
Conversation
👍, this is getting obnoxious |
does this break 3.0.x? |
Does this fix uninitialized constant Mime::VOICE in rails 3.1.3 ? |
@cj what version of twilio-rb are you using? |
The master git://github.com/stevegraham/twilio-rb.git |
@stevegraham so I no longer get that message but doing the example with |
Is what I'm getting. Looking at https://github.com/stevegraham/twilio-rb/blob/master/lib/railtie.rb I can't see why |
wow so something very strange is going on.... if I goto /calls.xml it works fine and pulls the data from index.voice (even going to /calls.json pulls the data from index.voice) |
this is expected behaviour. using the voice mime type triggers request validation. twilio adds a request signature to the request headers. twilio-rb performs the same steps as twilio to create the signature using a shared secret, your auth token. if the results do not match, 403 forbidden is returned. code: https://github.com/stevegraham/twilio-rb/blob/master/lib/twilio/request_filter.rb explanation: http://www.twilio.com/docs/security#validating-requests |
When the request comes from twilio it gets the same 403 though...... |
|
also what's the point of validating .voice when .xml will return the content of index.voice without even validating... ? |
weird, i have this code running on several apps in production without a problem. please check that the auth token in your application code matches the auth token for the account owning the number being called. also the request filter changed recently, so |
I've done a bundle update and the auth_token is the correct one... still no luck :/ are your production apps rails 3.1.3 ones? Also is there a reason .xml and .json now use .voice files with no validation? |
I also get these in the logs:
|
i've just updated an old app to use 3.1.3, redeployed, and tested with GET and POST requests from twilio-proxy. they both work for me, so this does not look like an issue with twilio-rb to me. you can stop your application responding to arbitrary mime types by whitelisting the ones you want to allow using respond_to. the deprecation warnings are valid and what this pull request will fix once merged. your issue is unrelated to this pull request. |
Strange, thank you for looking in to it this far. I forked the lib and disabled the twilio auth check for now just so I can develop my plugin, I'll create a new issue once it's done and maybe you can check it out to see why it isn't working with it. Many thanks. |
no problem, if you get stuck or want to talk about your specific case in private feel free to email me at stevie AT twilio DOT com |
Rails 3.1 TemplateHandler compatibility.
I thought I was going to have to fork the code for rails 3.0.x vs. 3.1.0 (as HAML does here: https://github.com/nex3/haml/issues/303 ) but the test suite passes without that ugly if statement even when I drop the activesupport dependency. You may want to test this with a rails 3.0.x app just to make sure-- if it fails you can just do the same thing that the haml patch does.