ssi problem / memcached

Igor Sysoev is at rambler-co.ru
Fri Oct 19 23:09:01 MSD 2007


On Fri, Oct 19, 2007 at 08:22:25PM +0200, Jodok Batlogg 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.

> 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 Sysoev wrote:
> 
> >On Mon, Oct 15, 2007 at 08:32:41AM +0200, Jodok Batlogg 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.
> >
> >
> >-- 
> >Igor Sysoev
> >http://sysoev.ru/en/<patch-0.6.14.2.txt>
> 
> --
> "In the face of ambiguity, refuse the temptation to guess."
>   -- The Zen of Python, by Tim Peters
> 
> Jodok Batlogg, Lovely Systems
> Schmelzh?tterstra?e 26a, 6850 Dornbirn, Austria
> phone: +43 5572 908060, fax: +43 5572 908060-77
> 
> 



-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list