diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2014-02-23 23:39:47 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-02-23 23:39:47 +0100 |
| commit | 53315570bb77534d828b3cf1f06b2ca286da4962 (patch) | |
| tree | a68b1f5e4b5b6d70bbdd99e64d8fc7e4f79eb087 | |
| parent | d82046f59f8b3d338bcfe6aa3b786e13c5c54ee3 (diff) | |
| download | busybox-w32-53315570bb77534d828b3cf1f06b2ca286da4962.tar.gz busybox-w32-53315570bb77534d828b3cf1f06b2ca286da4962.tar.bz2 busybox-w32-53315570bb77534d828b3cf1f06b2ca286da4962.zip | |
wget: add commented-out code to use ssl_helper instead of openssl
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | networking/wget.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/networking/wget.c b/networking/wget.c index dfea3d4d2..3d9a1b333 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
| @@ -527,12 +527,51 @@ static int spawn_https_helper(const char *host, unsigned port) | |||
| 527 | /* notreached */ | 527 | /* notreached */ |
| 528 | } | 528 | } |
| 529 | 529 | ||
| 530 | /* parent process */ | 530 | /* Parent */ |
| 531 | free(allocated); | 531 | free(allocated); |
| 532 | close(sp[1]); | 532 | close(sp[1]); |
| 533 | return sp[0]; | 533 | return sp[0]; |
| 534 | } | 534 | } |
| 535 | 535 | ||
| 536 | /* See networking/ssl_helper/README */ | ||
| 537 | #define SSL_HELPER 0 | ||
| 538 | |||
| 539 | #if SSL_HELPER | ||
| 540 | static void spawn_https_helper1(int network_fd) | ||
| 541 | { | ||
| 542 | int sp[2]; | ||
| 543 | int pid; | ||
| 544 | |||
| 545 | if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != 0) | ||
| 546 | /* Kernel can have AF_UNIX support disabled */ | ||
| 547 | bb_perror_msg_and_die("socketpair"); | ||
| 548 | |||
| 549 | pid = BB_MMU ? xfork() : xvfork(); | ||
| 550 | if (pid == 0) { | ||
| 551 | /* Child */ | ||
| 552 | char *argv[3]; | ||
| 553 | |||
| 554 | close(sp[0]); | ||
| 555 | xmove_fd(sp[1], 0); | ||
| 556 | xdup2(0, 1); | ||
| 557 | xmove_fd(network_fd, 3); | ||
| 558 | /* | ||
| 559 | * A simple ssl/tls helper | ||
| 560 | */ | ||
| 561 | argv[0] = (char*)"ssl_helper"; | ||
| 562 | argv[1] = (char*)"-d3"; | ||
| 563 | argv[2] = NULL; | ||
| 564 | BB_EXECVP(argv[0], argv); | ||
| 565 | bb_perror_msg_and_die("can't execute '%s'", argv[0]); | ||
| 566 | /* notreached */ | ||
| 567 | } | ||
| 568 | |||
| 569 | /* Parent */ | ||
| 570 | close(sp[1]); | ||
| 571 | xmove_fd(sp[0], network_fd); | ||
| 572 | } | ||
| 573 | #endif | ||
| 574 | |||
| 536 | static void NOINLINE retrieve_file_data(FILE *dfp) | 575 | static void NOINLINE retrieve_file_data(FILE *dfp) |
| 537 | { | 576 | { |
| 538 | #if ENABLE_FEATURE_WGET_STATUSBAR || ENABLE_FEATURE_WGET_TIMEOUT | 577 | #if ENABLE_FEATURE_WGET_STATUSBAR || ENABLE_FEATURE_WGET_TIMEOUT |
| @@ -775,13 +814,19 @@ static void download_one_url(const char *url) | |||
| 775 | 814 | ||
| 776 | /* Open socket to http(s) server */ | 815 | /* Open socket to http(s) server */ |
| 777 | if (target.protocol == P_HTTPS) { | 816 | if (target.protocol == P_HTTPS) { |
| 817 | /* openssl-based helper | ||
| 818 | * Inconvenient API since we can't give it an open fd, | ||
| 819 | */ | ||
| 778 | int fd = spawn_https_helper(server.host, server.port); | 820 | int fd = spawn_https_helper(server.host, server.port); |
| 779 | sfp = fdopen(fd, "r+"); | 821 | sfp = fdopen(fd, "r+"); |
| 780 | if (!sfp) | 822 | if (!sfp) |
| 781 | bb_perror_msg_and_die(bb_msg_memory_exhausted); | 823 | bb_perror_msg_and_die(bb_msg_memory_exhausted); |
| 782 | } else | 824 | } else |
| 783 | sfp = open_socket(lsa); | 825 | sfp = open_socket(lsa); |
| 784 | 826 | #if SSL_HELPER | |
| 827 | if (target.protocol == P_HTTPS) | ||
| 828 | spawn_https_helper1(fileno(sfp)); | ||
| 829 | #endif | ||
| 785 | /* Send HTTP request */ | 830 | /* Send HTTP request */ |
| 786 | if (use_proxy) { | 831 | if (use_proxy) { |
| 787 | fprintf(sfp, "GET %s://%s/%s HTTP/1.1\r\n", | 832 | fprintf(sfp, "GET %s://%s/%s HTTP/1.1\r\n", |
