postrank-labs / goliath

Goliath is a non-blocking Ruby web server framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Server crash on bad uri

brenda opened this issue · comments

When get this uri:
/index?created_at=20130730T173924}
the server chash!

/Users/user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:176:in split': bad URI(is not URI?): /index?created_at=20130730T173924} (URI::InvalidURIError) from /Users/user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:211:inparse'
from /Users/user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:747:in parse' from /Users/user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:994:inURI'
from /Users/user/.rvm/gems/ruby-2.0.0-p247@my_app/gems/goliath-1.0.3/lib/goliath/request.rb:90:in parse_header' from /Users/user/.rvm/gems/ruby-2.0.0-p247@my_app/gems/goliath-1.0.3/lib/goliath/connection.rb:34:inblock in post_init'
from /Users/user/.rvm/gems/ruby-2.0.0-p247@my_app/gems/goliath-1.0.3/lib/goliath/connection.rb:63:in call' from /Users/user/.rvm/gems/ruby-2.0.0-p247@my_app/gems/goliath-1.0.3/lib/goliath/connection.rb:63:in<<'
from /Users/user/.rvm/gems/ruby-2.0.0-p247@my_app/gems/goliath-1.0.3/lib/goliath/connection.rb:63:in receive_data' from /Users/user/.rvm/gems/ruby-2.0.0-p247@my_app/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:inrun_machine'
from /Users/user/.rvm/gems/ruby-2.0.0-p247@my_app/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in run' from /Users/user/.rvm/gems/ruby-2.0.0-p247@my_app/gems/em-synchrony-1.0.3/lib/em-synchrony.rb:38:insynchrony'
from /Users/user/.rvm/gems/ruby-2.0.0-p247@my_app/gems/goliath-1.0.3/lib/goliath/server.rb:73:in start' from /Users/user/.rvm/gems/ruby-2.0.0-p247@my_app/gems/goliath-1.0.3/lib/goliath/runner.rb:304:inrun_server'
from /Users/user/.rvm/gems/ruby-2.0.0-p247@my_app/gems/goliath-1.0.3/lib/goliath/runner.rb:224:in run' from /Users/user/.rvm/gems/ruby-2.0.0-p247@my_app/gems/goliath-1.0.3/lib/goliath/application.rb:111:inrun!'
from /Users/user/.rvm/gems/ruby-2.0.0-p247@my_app/gems/goliath-1.0.3/lib/goliath/application.rb:133:in `block in module:Goliath'

What's the full request to the server?

Thanks. Well, the "}" is an invalid character, so the error is correct - it should be escaped.

We definitely shouldn't crash the server (needs to be fixed), but the most we can do here is return a 500.. so you will still need to fix whatever is generating this request.

Yes, I am aware that te request is badly escape, but it shouldn't crash the server. I tried catching the exception but couldn't find exactly where, is there any way i could capture the exception to not make the server crash? or should i wait till you get it fixed?
Thanks

This still happens to me in Goliath 1.0.3. Is there a patch for this or how could I catch it to avoid a server crash?

Looks like we're (well) overdue for a 1.0.4. release.

@nolman @dj2 any objections?

Looked at the changes, LGTM :shipit:

Awesome, thanks! 1.0.4 should be live.