How to decode a reserved escape character in a request URI on a web server?

后端 未结 1 1926
心在旅途
心在旅途 2021-01-18 23:57

It is pretty clear that a web server has to decode any escaped unreserved character (such as alphanums, etc.) to do the URI comparison. For example, http://www.example

1条回答
  •  别那么骄傲
    2021-01-19 00:17

    tl;dr:

    Decode percent-encoded unreserved characters,
    keep percent-encoded reserved characters.


    The URI standard is STD 66, which currently is RFC 3986.

    Section 6 is about Normalization and Comparison, where section 6.2.2.2 explains what to do with percent-encoded octets:

    These URIs should be normalized by decoding any percent-encoded octet that corresponds to an unreserved character […]

    As explicitly stated in section 2 (bold emphasis mine):

    • Unreserved characters:

      URIs that differ in the replacement of an unreserved character with its corresponding percent-encoded US-ASCII octet are equivalent

    • Reserved characters:

      URIs that differ in the replacement of a reserved character with its corresponding percent-encoded octet are not equivalent.

    0 讨论(0)
提交回复
热议问题