[Mongrel] 502 proxy error, malformed request

Eden Li eden at mojiti.com
Wed Feb 6 20:31:34 EST 2008


I ran into this last year and patched the ragel parser to allow  
quotes, but it looks like it never made it to trunk.

http://rubyforge.org/pipermail/mongrel-users/2006-October/001847.html

It's out of spec, so I'm guessing that's the reason it never made it  
in.  Apache, nginx and lighttpd all handle quotes transparently,  
however.  So you can do it with rewrite rules, but it's a tad hairy.   
This might work for you (not tested):

RewriteCond %{QUERY_STRING} ^([^"]+)"(.*)
RewriteRule ^/(.*) /$1\?%1\%22%2 [N]

And, this works in nginx (for up to 3 quotes, before the location  
block):

if ($args ~ ^([^\"]+)\"(.*)$) { set $args $1%22$2; }
if ($args ~ ^([^\"]+)\"(.*)$) { set $args $1%22$2; }
if ($args ~ ^([^\"]+)\"(.*)$) { set $args $1%22$2; }
if ($args) { rewrite ^/(.*) /$1?$args last; }

This doesn't handle quotes in the path part of the uri however.

On Feb 7, 2008, at 8:08 AM, Dave Cheney wrote:

> I submitted a patch for this behavior, you can find it here
>
> http://rubyforge.org/tracker/index.php?func=detail&aid=15664&group_id=1306&atid=5145
>
> the patch was applied and the ticket closed, however the patch was
> rolled back in mongrel 1.1.3
>
> Cheers
>
> Dave
>
> On 07/02/2008, at 10:24 AM, Brad Carson wrote:
>
>> If there are double quotes in the url, Firefox escapes them to %22  
>> but
>> Internet explorer gives \", which when proxied to Mongrel results in
>> an
>> HTTP parse error.
>>
>> Is there a RewriteRule or something I can employ to fix this?  I'm
>> dying
>> here!
>> -- 
>> Posted via http://www.ruby-forum.com/.
>> _______________________________________________
>> Mongrel-users mailing list
>> Mongrel-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/mongrel-users
>
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users



More information about the Mongrel-users mailing list