wget: do not ask for TLS-encrypted downloads on plain ftp:// URLs
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 7 Feb 2018 23:28:30 +0000 (00:28 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 7 Feb 2018 23:28:30 +0000 (00:28 +0100)
function                                             old     new   delta
wget_main                                           2422    2431      +9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/wget.c

index 633dabb574753bde28d09c43c2a6d77f7778fe8f..95b88ad37129cce803fef1dacbf8156dfcf4d99b 100644 (file)
@@ -807,11 +807,13 @@ static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_
        *dfpp = open_socket(lsa);
 
 #if ENABLE_FEATURE_WGET_HTTPS
-       /* "PROT P" enables encryption of data stream.
-        * Without it (or with "PROT C"), data is sent unencrypted.
-        */
-       if (ftpcmd("PROT P", NULL, sfp) == 200)
-               spawn_ssl_client(target->host, fileno(*dfpp), /*flags*/ 0);
+       if (target->protocol == P_FTPS) {
+               /* "PROT P" enables encryption of data stream.
+                * Without it (or with "PROT C"), data is sent unencrypted.
+                */
+               if (ftpcmd("PROT P", NULL, sfp) == 200)
+                       spawn_ssl_client(target->host, fileno(*dfpp), /*flags*/ 0);
+       }
 #endif
 
        if (G.beg_range != 0) {