Mon, 07 Aug 2023 23:12:02 +0200 hgweb: encode WSGI environment using the ISO-8859-1 codec draft stable
Manuel Jacob <me@manueljacob.de> [Mon, 07 Aug 2023 23:12:02 +0200] rev 50766
hgweb: encode WSGI environment using the ISO-8859-1 codec The WSGI specification (PEP 3333) specifies that on Python 3 all strings passed by the server must be of type str with code points encodable using the ISO 8859-1 codec. For some reason, I introduced a bug in 2632c1ed8f34 by applying the reverse change. Maybe I got confused because PEP 3333 says that arbitrary operating system environment variables may be contained in the WSGI environment and therefore we need to handle the WSGI environment variables like we would handle operating system environment variables. The bug mentioned in the previous paragraph and fixed by this changeset manifested e.g. in the path of the URL being encoded in the wrong way. Browsers encode non-ASCII bytes with the percent-encoding. WSGI servers will decode the percent-encoded bytes and pass them to the application as strings where each byte is mapped to the corresponding code point with the same ordinal (i.e. it is decoded using the ISO-8859-1 codec). Mercurial uses the bytes type for these strings (which makes much more sense), so we need to encode it again using the ISO-8859-1 codec. If we use another codec, it can result in nonsense.
Mon, 07 Aug 2023 11:05:43 +0200 Added signature for changeset 787af4e0e8b7 stable
Raphaël Gomès <rgomes@octobus.net> [Mon, 07 Aug 2023 11:05:43 +0200] rev 50765
Added signature for changeset 787af4e0e8b7
(0) -30000 -10000 -3000 -1000 -300 -100 -30 -10 -2 +2 +10 +30 +100 +300 tip