flyerhzm/goliath — pull request #1 by Tin (2013-06-27 22:02:00+00:00)
Title: Patches

Most http request library will pass escaped uri information to server, but some weird client may pass in invalid request. And that will cause a URI::InvalidURIError, and if we didn't catch it, it will crush the goliath server.

So I add a exception handling to URI parse, just prevent the goliath to be broken. I didn't add test, so please verify if this fix is valid. Thank you!

The example stack trace is here:
```
/home/some_user/.rvm/rubies/ruby-1.9.3-p327-falcon/lib/ruby/1.9.1/uri/common.rb:176:in `split': bad URI(is not URI?): /admin/games/example_game/leaderboards/[gvg_guild_1]/cohorts?page=6 (URI::InvalidURIError)
from /home/some_user/.rvm/rubies/ruby-1.9.3-p327-falcon/lib/ruby/1.9.1/uri/common.rb:211:in `parse'
from /home/some_user/.rvm/rubies/ruby-1.9.3-p327-falcon/lib/ruby/1.9.1/uri/common.rb:747:in `parse'
from /home/some_user/shared/bundle/ruby/1.9.1/bundler/gems/goliath-98ebcec150cd/lib/goliath/request.rb:90:in `parse_header'
from /home/some_user/shared/bundle/ruby/1.9.1/bundler/gems/goliath-98ebcec150cd/lib/goliath/connection.rb:34:in `block in post_init'
from /home/some_user/shared/bundle/ruby/1.9.1/bundler/gems/goliath-98ebcec150cd/lib/goliath/connection.rb:63:in `call'
from /home/some_user/shared/bundle/ruby/1.9.1/bundler/gems/goliath-98ebcec150cd/lib/goliath/connection.rb:63:in `<<'
from /home/some_user/shared/bundle/ruby/1.9.1/bundler/gems/goliath-98ebcec150cd/lib/goliath/connection.rb:63:in `receive_data'
from /home/some_user/shared/bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'
from /home/some_user/shared/bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run'
from /home/some_user/shared/bundle/ruby/1.9.1/gems/em-synchrony-1.0.2/lib/em-synchrony.rb:28:in `synchrony'
from /home/some_user/shared/bundle/ruby/1.9.1/bundler/gems/goliath-98ebcec150cd/lib/goliath/server.rb:73:in `start'
from /home/some_user/shared/bundle/ruby/1.9.1/bundler/gems/goliath-98ebcec150cd/lib/goliath/runner.rb:296:in `run_server'
from /home/some_user/shared/bundle/ruby/1.9.1/bundler/gems/goliath-98ebcec150cd/lib/goliath/runner.rb:221:in `run'
from /home/some_user/shared/bundle/ruby/1.9.1/bundler/gems/goliath-98ebcec150cd/lib/goliath/application.rb:120:in `run!'
from /home/some_user/shared/bundle/ruby/1.9.1/bundler/gems/goliath-98ebcec150cd/lib/goliath/application.rb:142:in `block in '
```