[git commit] wget: attempt to negotiate encrypted data ftps stream ("PROT P")

Denys Vlasenko vda.linux at googlemail.com
Tue Feb 6 19:49:27 UTC 2018


commit: https://git.busybox.net/busybox/commit/?id=2b7515722b929794f2f8563b80d9cea48f6b3304
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
wget_main                                           2382    2422     +40

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/wget.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/networking/wget.c b/networking/wget.c
index 7ca4bfb33..633dabb57 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -806,9 +806,13 @@ static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_
 
 	*dfpp = open_socket(lsa);
 
-	//For encrypted data, need to send "PROT P" and get "200 PROT now Private" response first
-	//Without it (or with "PROT C"), data is sent unencrypted
-	//spawn_ssl_client(target->host, fileno(*dfpp), /*flags*/ 0);
+#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);
+#endif
 
 	if (G.beg_range != 0) {
 		sprintf(G.wget_buf, "REST %"OFF_FMT"u", G.beg_range);


More information about the busybox-cvs mailing list