From 09733c39766dde4af8f6996baf82c87530d12a81 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 1 Nov 2017 19:34:53 +0100 Subject: [PATCH] SSL socket class, downloadertest application, HTTP::Downloader support for HTTPS connections, authentication, proxies and POST requests # Conflicts: # CMakeLists.txt --- CMakeLists.txt | 4 +++- test/downloader.cpp | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 test/downloader.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 0893aec0..4e94e56b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -438,7 +438,6 @@ makeOutput(RTSP rtsp)#LTS makeOutput(WAV wav)#LTS if (NOT DEFINED NOSSL ) makeOutput(HTTPS https)#LTS - target_link_libraries(MistOutHTTPS mbedtls mbedcrypto mbedx509) endif() makeOutput(DASH dash_mp4 http)#LTS @@ -683,4 +682,7 @@ add_test(AESTest COMMAND aes_ctr128) add_executable(urltest test/url.cpp ${BINARY_DIR}/mist/.headers) target_link_libraries(urltest mist) add_test(URLTest COMMAND urltest) +add_executable(downloadertest test/downloader.cpp ${BINARY_DIR}/mist/.headers) +target_link_libraries(downloadertest mist) +add_test(DownloaderTest COMMAND downloadertest) diff --git a/test/downloader.cpp b/test/downloader.cpp new file mode 100644 index 00000000..81f1553b --- /dev/null +++ b/test/downloader.cpp @@ -0,0 +1,18 @@ +#include "../lib/downloader.cpp" +#include + +int main(int argc, char ** argv){ + if (argc < 2){ + std::cout << "Usage: " << argv[0] << " URL" << std::endl; + return 1; + } + HTTP::Downloader d; + if (d.get(argv[1])){ + std::cout << d.data() << std::endl; + std::cerr << "Download success!" << std::endl; + }else{ + std::cerr << "Download fail!" << std::endl; + } + return 0; +} +