$_SERVER['HTTP_REFERER'] 与 Request.ServerVariables("HTTP_REFERER")

发布于 2024-09-03 23:42:23 字数 190 浏览 4 评论 0 原文

如果查询字符串包含非英文字符,为什么 $_SERVER['HTTP_REFERER'] (PHP) 和 Request.ServerVariables("HTTP_REFERER") (ASP) 返回不同的结果?

php 返回正确的值,但 asp 不会:

php: сабака

asp: ׁ׀°׀±׀°׀÷׀°

Why $_SERVER['HTTP_REFERER'] (PHP) and Request.ServerVariables("HTTP_REFERER") (ASP) return different result if query string has non english characters?

php return correct value but asp will not:

php: сабака

asp: ׁ׀°׀±׀°׀÷׀°

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一抹淡然 2024-09-10 23:42:23

根据 RFC 2616,不在 ISO-8859-1 中的字符应该特殊编码。因此,似乎向您发送标头的人都违反了规范。请参阅字段内容TEXT

4.2 消息标头

message-header = 字段名称 ":" [ 字段值 ]
字段名称 = 标记
字段值 = *( 字段内容 | LWS )
字段内容 = <构成字段值的 OCTET
                 并由 *TEXT 或组合组成
                 标记、分隔符和引用字符串的数量>

2.2 基本规则

TEXT = <除 CTL 之外的任何 OCTET,
                 但包括LWS>

TEXT 规则仅用于描述性字段内容和值
不打算由消息解析器解释。仅当根据 RFC 2047 [14]。

According to RFC 2616, characters not in ISO- 8859-1 should be specially encoded. Therefore it seems that whoever is sending you the headers is breaking the spec. See field-content and TEXT.

4.2 Message Headers

message-header = field-name ":" [ field-value ]
field-name     = token
field-value    = *( field-content | LWS )
field-content  = <the OCTETs making up the field-value
                 and consisting of either *TEXT or combinations
                 of token, separators, and quoted-string>

2.2 Basic Rules

TEXT           = <any OCTET except CTLs,
                 but including LWS>

The TEXT rule is only used for descriptive field contents and values that are
not intended to be interpreted by the message parser. Words of *TEXT MAY contain characters from character sets other than ISO- 8859-1 [22] only when encoded according to the rules of RFC 2047 [14].

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文