rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: Gaius <james.a.rosen@gmail.com>
To: Rack Development <rack-devel@googlegroups.com>
Subject: Re: Trouble with Unicode in URLs
Date: Fri, 15 Jan 2010 08:46:20 -0800 (PST)	[thread overview]
Message-ID: <b76c37e7-ce52-47ba-b8a4-e301fa348db8@r24g2000yqd.googlegroups.com> (raw)
In-Reply-To: <201001151743.12887.ibc@aliax.net>

I agree with your analysis of _why_ the server is getting the hex-
escaped version. (That's why I used CGI.unescape to fix the problem.)
I'm also quite sure that Apache isn't unescaping before passing the
request on to Rack.

My setup:

$ apachectl -v
Server version: Apache/2.2.13 (Unix)
Server built:   Sep 28 2009 16:04:37

$ gem list passenger
*** LOCAL GEMS ***
passenger (2.2.4)


On Jan 15, 11:43 am, Iñaki Baz Castillo <i...@aliax.net> wrote:
> El Viernes, 15 de Enero de 2010, Gaius escribió:
>
> > I have a Rails app in which I'd like to use some Unicode URLs:
>
> >     # in routes.rb:
> >     map.resources 'proteges', :as => 'protégés', :only => [:index]
>
> > When I go tohttp://localhost:3000/protégés, I get
>
> >     No route matches "/prot%C3%A9g%C3%A9s" with {:method=>:get}
>
> > That was on Mongrel,
>
> Unicode symbols are not allowed in URL according to its BNF grammar. So the
> client (the web browser in your case) hex-escapes these symbols.
>
> This is: the client is sending a request like:
>
>   GET /prot%C3%A9g%C3%A9s HTTP/1.1
>
> which is correct.
>
> Then the server must hex-unescape it, and this is what you do with your Rack
> middleware :)
>
> Rack by itself doesn't require that the URL must be hex-unescaped before
> passing then to the application, so if a task for your application to do it.
>
> > though I also tried Passenger.
>
> And the same happened? I don't think so as Apache unescapes the URL before
> passing the request to the backend (in this case mod_rack). I've checked it
> before: when a request with hex-escaped URL arrives to Apache it unescapes
> before passing the data to mod_rack so you get the Rack variables hex-
> unescaped (you should already see the unicode symbols).
>
> I wonder how is possible your Apache not to unescape the URL before passing it
> to Rack, could you please re-check it? which Apache version do you use?
>
> --
> Iñaki Baz Castillo <i...@aliax.net>

  reply	other threads:[~2010-01-15 16:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-15 16:26 Trouble with Unicode in URLs Gaius
2010-01-15 16:43 ` Iñaki Baz Castillo
2010-01-15 16:46   ` Gaius [this message]
2010-01-15 17:03     ` Iñaki Baz Castillo
2010-01-15 17:13       ` Gaius
2010-01-15 17:16         ` Gaius
2010-01-15 17:48           ` Iñaki Baz Castillo
2010-01-15 17:21         ` Gaius
2010-01-15 17:49           ` Iñaki Baz Castillo
2010-01-15 19:23             ` Gaius
2010-01-15 21:08               ` Iñaki Baz Castillo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://groups.google.com/group/rack-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b76c37e7-ce52-47ba-b8a4-e301fa348db8@r24g2000yqd.googlegroups.com \
    --to=rack-devel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).