memcache key double escaped

Xavier Grangier grangier at gmail.com
Thu Feb 26 09:33:41 MSK 2009


Hello all,

I have trouble with nginx memcached module with urls containing  
special char, for instance :

GET /list.xml?fulltext=testé&sort=rating&dir=DESC

will store the following key in memcache :

<25 set brh:262:68:/list.xml?fulltext=test%C3%A9&sort=rating&dir=DESC  
0 21600 7006
 >25 STORED

If I query back the same URL I have the following message in nginx  
debug log :

2009/02/26 07:16:38 [info] 14614#0: *4684 key: "brh:262:68:/list.xml? 
fulltext=test%25C3%25A9&sort=rating&dir=DESC" was not found by  
memcached while reading response header from upstream, client:  
10.0.0.177, server: devel.internal.net, request: "GET /list.xml? 
fulltext=test%C3%A9&sort=rating&dir=DESC HTTP/1.0", upstream:  
"memcached://10.0.0.177:11211", host: "devel.internal.net"

The request matches the key, eq : fulltext=test%C3%A9
But the memcache module is double escaping will trying to get the  
query : fulltext=test%25C3%25A9

I don't know if this is the correct behaviour, of course this can be  
bypasse using the following code in python for exemple :

urllib.quote("/list.xml?fulltext=test 
%C3%A9&sort=rating&dir=DESC",safe="&/?=")

$memcached_key is set like this in nginx.conf :

set $memcached_key brh:$prefix:$request_uri;

Regards,

xav




More information about the nginx mailing list