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

Why does $ _SERVER ['HTTP_REFERER'] (PHP) and Request.ServerVariables ("HTTP_REFERER") (ASP) return different results if the query string contains non-English characters?

php returns the correct value, but asp will not:

php: sabaka

asp: ׁ | ° | ± | ° | ÷ | °

+3
source share
1 answer

In accordance with RFC 2616 , non-ISO-8859-1 characters must be specially encoded. Therefore, it seems that the one who sends you the headers violates the specification. See Field Content and TEXT.

4.2

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

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

TEXT , . * , ISO-8859-1 [22], RFC 2047 [14].

+1

Source: https://habr.com/ru/post/1747829/


All Articles