Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix for requests that doesn't contain an HTTP_USER_AGENT #1

Merged
merged 1 commit into from

2 participants

@javiertoledo

Hi, this issue was driving me mad until I discovered rack-iframe was the source of the problem:
http://stackoverflow.com/questions/10675847/paypal-ipn-503-error-with-rails-3-0-10-and-heroku

It seems some APIs like Paypal IPN send back POST requests to the application which doesn't contain an HTTP_USER_AGENT, causing this gem to crash because of user_agent(env) returning nil. I've added a few chars to your code to avoid this issue and everything is working now.

I just wanted to share with you as I think it could be useful for more people and for more situations.

@javiertoledo javiertoledo Fix for requests that doesn't contain an HTTP_USER_AGENT
Some APIs like Paypal IPN send back POST requests to your application which doesn't contain an HTTP_USER_AGENT, causing this gem to crash. This little fix avoids this issue.
65209b1
@grimen grimen merged commit 91c6e94 into merchii:master
@grimen
Collaborator

Thanks Javier!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 20, 2012
  1. @javiertoledo

    Fix for requests that doesn't contain an HTTP_USER_AGENT

    javiertoledo authored
    Some APIs like Paypal IPN send back POST requests to your application which doesn't contain an HTTP_USER_AGENT, causing this gem to crash. This little fix avoids this issue.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/rack/iframe.rb
View
2  lib/rack/iframe.rb
@@ -38,7 +38,7 @@ def call(env)
protected
def user_agent(env)
- env['HTTP_USER_AGENT']
+ env['HTTP_USER_AGENT'] || []
end
def set_invalid_etag!(env)
Something went wrong with that request. Please try again.