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!
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!
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
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.
Eden Li wrote:
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]
Eden, thank you, that’s great. I’ve found it only works for the first "
in Apache.
The double quotes in the URL are coming from a 3rd party, so I’m going
to try my best to get them to properly escape their URLs. Otherwise, is
it possible to make a Rewrite rule to escape all the double quotes
properly if a request is coming from IE?
Many thanks.
Eden, thank you, that’s great. I’ve found it only works for the first "
in Apache.
Never mind, I’m mistaken and understand what’s happening now. Thanks, I
owe you one!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs