Failing to parse query parameters when using a custom host name #3

Open
HoneyryderChuck opened this Issue Mar 22, 2012 · 0 comments

Comments

Projects
None yet
1 participant
@HoneyryderChuck

Greetings,

I have recently discovered something that quite amazed me: Try setting a new Rails 3 application, create a custom name for your localhost (let's say, "diddy.com"), install mongrel as gem, and then create an action that does this:


render :text => params[:page] || "unspecified"

then just do: diddy.com:3000/action?page=2

basically, i'm not getting the page parameter output, query parameters are always being parsed out all the time, so that means doing that is the same as doing diddy.com:3000/action . If I use localhost as host, it works fine.

I've currently "hacked" the mongrel.rb file in order for it to work. So, at the line 128 of mongrel.db:


params[Const::REQUEST_PATH] = uri.path
params['QUERY_STRING'] = uri.query # hack

this is just a temporary hack that works the problem around, I guess. Basically, the HttpParser (http11.c) is parsing it wrong when the host is a custom one.

What do you think? Do you get the same issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment