Conditional get is causing exceptions during regular usage #596

Merged
merged 1 commit into from Sep 3, 2013

Conversation

Projects
None yet
2 participants
Contributor

SamSaffron commented Aug 21, 2013

Conditional get is causing exceptions during regular usage, most commonly we see HTTP_IF_MODIFIED_SINCE set to the empty string.

Caught this while profiling using rack-mini-profiler

Exceptions (2 raised during request)

ArgumentError not RFC 2822 compliant date: ""
/usr/local/rvm/rubies/ruby-2.0.0-p0-turbo/lib/ruby/2.0.0/time.rb:456:in `rfc2822'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/conditionalget.rb:64:in `to_rfc2822'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/conditionalget.rb:48:in `fresh?'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/conditionalget.rb:27:in `call'
@SamSaffron SamSaffron conditional get is causing exceptions during regular usage, avoid the…
… exception raising for all trivial cases (empty and shorter than minimal length strings)
94790b7
Member

rkh commented Sep 3, 2013

Shouldn't it also catch these exceptions maybe? So garbage doesn't result in a 500?

Contributor

SamSaffron commented Sep 3, 2013

as in passing an Object that does not respond_to :length in ? I do not think that is even possible

Member

rkh commented Sep 3, 2013

Ah, no, sorry, that's not what I meant. I missed the fact that there is a rescue nil in there already. Ignore the comment.

@rkh rkh added a commit that referenced this pull request Sep 3, 2013

@rkh rkh Merge pull request #596 from SamSaffron/master
Conditional get is causing exceptions during regular usage
0adc7ce

@rkh rkh merged commit 0adc7ce into rack:master Sep 3, 2013

1 check passed

default The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment