2009/4/7 Clodoaldo Pinto Neto <clodoaldo.pinto@xxxxxxxxx>:
Flushing input makes no sense to me so I deleted them and it still> 2009/4/3 André Warnier <aw@xxxxxxxxxx>:
>> Clodoaldo Pinto Neto wrote:
>>>
>>> I want to rewrite a url to a query string like this:
>>>
>>> from http://example.com/x+ to http://example.com/var=x%2B
>>> or
>>> from http://example.com/x%2B to http://example.com/var=x%2B
>>>
>>> Using:
>>> RewriteRule ^(/([\w-()+]+))?/$ /?var=$2 [QSA]
>>>
>>> The problem i have is that the query string is passed to the
>>> application unencoded so the "+" is understood by the application as
>>> space. How to reencode the query string before it is passed to the
>>> application?
>>>
>> Hi.
>> I don't really know why precisely, but I have a bad feeling about the above,
>> in the sense that an initial URL like you show two examples above may lead
>> to trouble at some point.
>>
>> But assuming you insist..
>>
>> You may want to lookup this page :
>> http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
>> in the following sections :
>> Internal Function (escape)
>> or
>> External Rewriting Program
>
> I could not make the internal escape function work for me. So I used
> an external rewriting program. If someone is interested this is it:
>
> #!/usr/bin/env python
>
> from sys import stdin as si
> from sys import stdout as so
> from urllib import quote
>
> linha = si.readline()
> si.flush
> while linha:
> so.write(quote(linha, '/\n'))
> so.flush()
> linha = si.readline()
> si.flush()
works. If I'm wrong please comment.
Regards, Clodoaldo
>
> Then in httpd.conf:
>
> RewriteMap escape_url prg:/home/carroarodo/escape_url.py
> RewriteRule ^(.*)$ ${escape_url:$1}
>
> Regards, Clodoaldo
>
>>
>> I have never used them, and I am not sure they allow to create the
>> query-string part of the rewritten request.
>> But it's worth trying out.
>> Otherwise, mod_perl would be your friend.
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
>> " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
>> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>>
>>
>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
" from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx