summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/CMakeLists.txt11
-rw-r--r--apps/higet/higet.cc20
2 files changed, 18 insertions, 13 deletions
diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt
index f5075a7aa..5f5604256 100644
--- a/apps/CMakeLists.txt
+++ b/apps/CMakeLists.txt
@@ -32,9 +32,11 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
find_package(Threads REQUIRED)
include_directories(${LIBTRANSPORT_INCLUDE_DIRS})
else()
- if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
+ if (DISABLE_SHARED_LIBRARIES)
find_package(OpenSSL REQUIRED)
- find_package(ZLIB REQUIRED)
+ if (NOT WIN32)
+ find_package(ZLIB REQUIRED)
+ endif ()
set(LIBTRANSPORT_LIBRARIES ${LIBTRANSPORT_STATIC})
else ()
set(LIBTRANSPORT_LIBRARIES ${LIBTRANSPORT_SHARED})
@@ -68,6 +70,7 @@ include(Packaging)
set(HIGET higet)
set(HTTP_PROXY hicn-http-proxy)
-
-add_subdirectory(http-proxy)
+if (NOT WIN32)
+ add_subdirectory(http-proxy)
+endif ()
add_subdirectory(higet)
diff --git a/apps/higet/higet.cc b/apps/higet/higet.cc
index 5877c96b3..7584148a9 100644
--- a/apps/higet/higet.cc
+++ b/apps/higet/higet.cc
@@ -16,9 +16,8 @@
#include <hicn/transport/http/client_connection.h>
#include <fstream>
#include <map>
-
-#include <experimental/algorithm>
-#include <experimental/functional>
+#include <algorithm>
+#include <functional>
#define ASIO_STANDALONE
#include <asio.hpp>
@@ -114,12 +113,9 @@ class ReadBytesCallbackImplementation
// read next chunk size
const char *begin = (const char *)payload->data();
const char *end = (const char *)payload->tail();
-
- using std::experimental::make_boyer_moore_searcher;
- auto it = std::experimental::search(
- begin, end,
- make_boyer_moore_searcher(chunk_separator.begin(),
- chunk_separator.end()));
+ const char *begincrlf2 = (const char *)chunk_separator.c_str();
+ const char *endcrlf2 = begincrlf2 + chunk_separator.size();
+ auto it = std::search(begin, end, begincrlf2, endcrlf2);
if (it != end) {
chunk_size_ = std::stoul(begin, 0, 16);
content_size_ += chunk_size_;
@@ -200,9 +196,15 @@ class ReadBytesCallbackImplementation
void print_bar(long value, long max_value, bool last) {
float progress = (float)value / max_value;
+#ifdef _WIN32
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+ GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
+ int barWidth = csbi.srWindow.Right - csbi.srWindow.Left + 7;
+#else
struct winsize size;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &size);
int barWidth = size.ws_col - 8;
+#endif
std::cout << "[";
int pos = barWidth * progress;