CVSROOT:        /cvs
Module name:    src
Changes by:     k...@cvs.openbsd.org    2021/11/06 08:27:45

Modified files:
        usr.bin/ftp    : fetch.c 

Log message:
Stop URL encoding the tilde character

RFC 1738 Uniform Resource Locators (URL) lists tilde as unsafe character.
RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax updates it to

The tilde "~" character was added to those in the "unreserved" set,
since it is extensively used on the Internet in spite of the
difficulty to transcribe it with some keyboards.

In theory, this shouldn't make a difference, but some servers do not decode
"%7e" and thus erroneously serve a 404.

RFC 2396 2.4.2. When to Escape and Unescape says:

In some cases, data that could be represented by an unreserved
character may appear escaped; for example, some of the unreserved
"mark" characters are automatically escaped by some systems.  If the
given URI scheme defines a canonicalization algorithm, then
unreserved characters may be unescaped according to that algorithm.
For example, "%7e" is sometimes used instead of "~" in an http URL
path, but the two are equivalent for an http URL.

Update ftp(1) to RFC 2396 by no longer treating "~" as unsafe character.
This is effectively a one-character diff;  update comments accordingly as
well as the order of characters to ease code-to-standard comparison.

This matches curl(1) and wget(1) behaviour wrt. encoding of "~".

OK sthen

Reply via email to