5

According to RFC 2109, 2965 cookie's value can be either HTTP token or quoted string, and token can't include non-ASCII characters.

  1. Cookie's RFC 2109 and RFC2965
  2. HTTP's RFC 2068 and 2616 token definition: https://www.rfc-editor.org/rfc/rfc2616#page-16

However I had found that Firefox browser (3.0.6) sends cookies with utf-8 string as-is and three web servers I tested (apache2, lighttpd, nginx) pass this string as-is to the application.

For example, raw request from browser:

$ 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

And raw response of apache, nginx and lighttpd HTTP_COOKIE CGI variable:

wikipp=1234; wikipp_username=ארתיום

What do I miss?

4

2 に答える 2

3

Internet Official Protocol Standards (STD 1、RFC 5000)に従って、RFC 2109 (Feb 1997) は廃止され、 RFC 2965 (Oct 2000)に取って代わられました。

2010 年 3 月 7 日のより最近の2965 を改訂するドラフトにも興味があるかもしれません。

2965 年のトークンの唯一の定義は次のとおりです。

非公式に、非特殊文字、非空白文字のシーケンス

UTF-8全体がその定義によって許可されていないとは考えていません.制御/構文文字と誤解される可能性のある文字のみです.

于 2010-05-23T03:57:07.927 に答える