根据RFC 2109,2965 cookie的值可以是HTTP令牌或带引号的字符串,而令牌不能包含非ASCII字符.
Cookie的RFC 2109和RFC2965
HTTP的RFC 2068和2616令牌定义:http://tools.ietf.org/html/rfc2616#page-16
但是我发现Firefox浏览器(3.0.6)按原样发送带有utf-8字符串的cookie,我测试的三个Web服务器(apache2,lighttpd,nginx)按原样将该字符串传递给应用程序.
例如,来自浏览器的原始请求:
$ nc -l -p 8080 GET /hello HTTP/1.1 Host: localhost:8080 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.9) Gecko/2009050519 Firefox/2.0.0.13 (Debian-3.0.6-1) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: windows-1255,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: wikipp=1234; wikipp_username=?????? Cache-Control: max-age=0
和apache,nginx和lighttpd HTTP_COOKIE
CGI变量的原始响应:
wikipp=1234; wikipp_username=??????
我错过了什么?