Ssi problem / memcached

hi,

is there a reason that ssi escapes the all the urls? imho it should
not escape them.
if you request some%20url%20with%20spaces - it’s escaping again.
we’re using unescaped utf-8 strings to access memcached - the
behavior of the ssi module should behave the same way.

jodok


“Readability counts.”
– The Zen of Python, by Tim Peters

Jodok B., Lovely Systems
Schmelzhütterstraße 26a, 6850 Dornbirn, Austria
phone: +43 5572 908060, fax: +43 5572 908060-77

On Mon, Oct 15, 2007 at 08:32:41AM +0200, Jodok B. wrote:

is there a reason that ssi escapes the all the urls? imho it should
not escape them.
if you request some%20url%20with%20spaces - it’s escaping again.
we’re using unescaped utf-8 strings to access memcached - the
behavior of the ssi module should behave the same way.

Try the attached patch: it unescapes SSI include, then escapes it again
if the including goes to proxy.

hi igor,

thanks for your patch.
unfortunately we still have some troubles with memcached. the problem
is that spaces in keys of memcached are not allowed at all. in our
urls,… we still need to support spaces.
finally we had the idea that it would be best to use the md5 hash of
the url as key in memcached.

i’m wondering if it’s possible to have md5 function when generating
the memcached_key?

thanks
jodok

ps.: probably something like this (note the memcached_key line)

 rewrite ^(.*)$ /memcached$1 last;

 location ^~ '/memcached/' {
     rewrite ^/memcached/(.*)$ $1;
     # set $memcached_key  books-de-beta/$uri$is_args$args;
     set $memcached_key  books-de-beta/$uri$is_args$args md5;
     # ^ would be good to have md5
     memcached_pass   127.0.0.1:11211;
     default_type     text/html;
     # cache control:
     #  we use no-cache for all memcache entries.
     expires          -1;
     # send it to zope as fallback
     error_page       404 = /zope/$uri;
     error_page       502 = /zope/$uri;
     internal;
 }

On 17.10.2007, at 13:44, Igor S. wrote:

if the including goes to proxy.


Igor S.
Igor Sysoev<patch-0.6.14.2.txt>


“In the face of ambiguity, refuse the temptation to guess.”
– The Zen of Python, by Tim Peters

Jodok B., Lovely Systems
Schmelzhütterstraße 26a, 6850 Dornbirn, Austria
phone: +43 5572 908060, fax: +43 5572 908060-77

On Fri, Oct 19, 2007 at 08:22:25PM +0200, Jodok B. wrote:

thanks for your patch.
unfortunately we still have some troubles with memcached. the problem
is that spaces in keys of memcached are not allowed at all. in our
urls,… we still need to support spaces.
finally we had the idea that it would be best to use the md5 hash of
the url as key in memcached.

i’m wondering if it’s possible to have md5 function when generating
the memcached_key?

No, currently no easy way to generate md5 function (by perl handler
only).
However, 0.6.x support escaping space and ‘%’ in $memcached_key
variable:

Changes with nginx 0.6.8 20 Aug
2007

*) Change: now nginx escapes "%" in $memcached_key variable.

Changes with nginx 0.6.5 23 Jul
2007

*) Bugfix: now nginx escapes space in $memcached_key variable.

And probably these changes will go to next 0.5.33.