ftp(1) built with no TLS support is confused (confusing?) when handled
an https url.  I have noticed this during tests with
/usr/src/distrib/special/ftp.

Now:
--8<--
ritchie /usr/src/distrib/special/ftp$ obj/ftp -o/dev/null 
https://www.openbsd.org/
ftp: https: no address associated with name
ftp: Can't connect or login to host `https'
-->8--

The fix is easy: let url_get() decide if it can handle the URL, as
suggested by the comment which has been there since TLS support has been
added.  The diff below addresses this and also kills the ineffective
comment.

With the diff:
--8<--
ritchie /usr/src/distrib/special/ftp$ obj/ftp -o/dev/null 
https://www.openbsd.org/
ftp: url_get: Invalid URL 'https://www.openbsd.org/'
-->8--

--8<--
ritchie /usr/src/distrib/special/ftp$ size fetch.o obj/fetch.o ftp obj/ftp
text    data    bss     dec     hex
10927   0       104     11031   2b17    fetch.o
11002   0       104     11106   2b62    obj/fetch.o
407983  12904   43328   464215  71557   ftp
408079  12904   43328   464311  715b7   obj/ftp
-->8--

ok?  (assuming it fits on i386 floppies)


Index: fetch.c
===================================================================
RCS file: /d/cvs/src/usr.bin/ftp/fetch.c,v
retrieving revision 1.180
diff -u -p -r1.180 fetch.c
--- fetch.c     2 Dec 2019 22:32:18 -0000       1.180
+++ fetch.c     4 Dec 2019 17:07:21 -0000
@@ -1258,10 +1258,7 @@ auto_fetch(int argc, char *argv[], char 
                 * Try HTTP URL-style arguments first.
                 */
                if (strncasecmp(url, HTTP_URL, sizeof(HTTP_URL) - 1) == 0 ||
-#ifndef NOSSL
-                   /* even if we compiled without SSL, url_get will check */
-                   strncasecmp(url, HTTPS_URL, sizeof(HTTPS_URL) -1) == 0 ||
-#endif /* !NOSSL */
+                   strncasecmp(url, HTTPS_URL, sizeof(HTTPS_URL) - 1) == 0 ||
                    strncasecmp(url, FILE_URL, sizeof(FILE_URL) - 1) == 0) {
                        redirect_loop = 0;
                        retried = 0;


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to