Rack::Request.host crashes under specific circumstances
Reported by Heath Morrison | April 7th, 2009 @ 06:10 PM
It is possible to construct an environment under which Rack::Request.host crashes.
I encountered this while running Rack under thin and doing a manual HTTP request. I telnetted to the server and issued,
GET / HTTP/1.0
I did not specify a "Host" header. In this case, neither the HTTP_HOST or the SERVER_NAME env-var were set by thin. This causes Rack::Request.host to crash with the following error,
Unexpected error while processing request: private method
gsub' called for nil:NilClass
I acknowledge that these circumstances are not typical, and that thin should have perhaps set SERVER_NAME. Still, it feels like a flaw for Rack to crash. Rack should protect itself from the sloppiness of other projects by performing a minor sanity check on those env-vars before calling gsub.
Comments and changes to this ticket
-
manveru April 16th, 2009 @ 02:57 PM
- State changed from new to open
And Rack should raise a more specific error? Or return nil and leave the raising to something further down the stack?
-
josh August 3rd, 2009 @ 03:33 PM
- State changed from open to resolved
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป