Hello!
On Tue, Sep 01, 2009 at 03:40:33AM -0700, [email protected] wrote:
>
> Hello all !
> I use memcached-1.2.8 and spymemcached-2.3.1
> I put JSON into memcached OK.
> But then I receive garbage after GET from memcached:
> -------------------------------------------------------------------------------------
> GET /portal-facade-ng/v1/vod/categories/168 HTTP/1.1
> Host: 172.20.1.183
> User-Agent: Mozilla/5.0 (X11; U; Linux sh4;
> chrome://navigator/locale/navigator.properties; rv:1.8) Gecko/20080417
> Accept:
> text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/
> plain;q=0.8,image/png,*/*;q=0.5
> Accept-Encoding: gzip,deflate
> Keep-Alive: 300
> Connection: keep-alive
> Cookie: JSESSIONID=8DA22E16808D4658D041183473A71953
>
> -----------------------------------------------------------------------------------
> HTTP/1.1 200 OK
> Server: nginx/0.6.36
> Date: Tue, 01 Sep 2009 09:22:05 GMT
> Content-Type: application/x-javascript;charset=UTF-8
> Transfer-Encoding: chunked
> Connection: keep-alive
> Keep-Alive: timeout=20
> X-Powered-By: Servlet 2.4; JBoss-4.2.2.GA (build:
> SVNTag=JBoss_4_2_2_GA
> date=200710221139)/Tomcat-5.5
> cache-control: no-cache
> Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
> Accept-Ranges: bytes
>
> 2a0
> data=[{"id":4,"count":5,"name":"........","display":"<div
> class='vod_movies_category_name'>........<\/div><div
> class='vod_movies_category_count'>5<\/div>"},
> {"id":7,"count":3,"name":"....................","display":"<div
> class='vod_movies_category_name'>....................<\/div><div
> class='vod_movies_category_count'>3<\/div>"},
> {"id":0,"count":1,"name":"..................","display":"<div
> class='vod_movies_category_name'>..................<\/div><div
> class='vod_movies_category_count'>1<\/div>"},
> {"id":-1,"count":1,"name":"..................","display":"<div
> class='vod_movies_category_name'>..................<\/div><div
> class='vod_movies_category_count'>1<\/div>"}];
> 0
>
> ----------------
> garbage: "2ao" before JSON and "0" after JSON.
It's not garbage but chunked transfer encoding, as indicated by
response headers. Consult RFC 2616 for details.
On the other hand, it's quite possible that the snipped above
isn't real conversation but data with chunked encoding already
removed. In raw data (try telnet) you should get duplicated
chunked markers in this case. This may indicate backend bug
returning chunked to nginx despite the fact that it uses HTTP/1.0
for backend connections.
Anyway, it doesn't looks like memcached problem.
Maxim Dounin
>
> My browser failed during eval this JSON.
>
> Please, help me.
> --
> Best Regards, Eugene Batogov