Loading CMakeLists.txt +8 −5 Original line number Diff line number Diff line project(libhttppp) cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.26) enable_testing () set(LIBV "1.0.0") Loading @@ -7,21 +7,24 @@ set(Upstream_VERSION 1.0.0) set (BLOCKSIZE 16384 CACHE STRING "Block size from Network Packages") set (DEFAULT_UPLOADSIZE 4e+6 CACHE STRING "Block size from Network Packages") include(CheckIncludeFileCXX) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) find_package(libnetplus REQUIRED) find_package(libcmdplus REQUIRED) find_package(MbedTLS REQUIRED) find_package(htmlpp) SET(CMAKE_CXX_FLAGS "-fPIC -Wall") include(CheckIncludeFileCXX) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/) configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${NETPLUS_INCLUDE_DIR} ${CMDPLUS_INCLUDE_DIR} ) add_subdirectory(doc) add_subdirectory(src) Loading CMakeSettings.json +2 −4 Original line number Diff line number Diff line Loading @@ -9,8 +9,7 @@ "cmakeCommandArgs": "", "buildCommandArgs": "", "ctestCommandArgs": "", "inheritEnvironments": [ "msvc_x64_x64" ], "variables": [] "inheritEnvironments": [ "msvc_x64_x64" ] }, { "name": "x64-Release", Loading @@ -21,8 +20,7 @@ "cmakeCommandArgs": "", "buildCommandArgs": "", "ctestCommandArgs": "", "inheritEnvironments": [ "msvc_x64_x64" ], "variables": [] "inheritEnvironments": [ "msvc_x64_x64" ] } ] } No newline at end of file config.h.in +3 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ #define DEFAULTCONNECTTRIES 5 #define ARCH_${CMAKE_SYSTEM_PROCESSOR} #define ${CMAKE_SYSTEM_NAME} #define DEFAULT_UPLOADSIZE ${DEFAULT_UPLOADSIZE} examples/CMakeLists.txt +10 −11 Original line number Diff line number Diff line find_package(htmlpp COMPONENTS) find_package(htmlpp) option(BUILD_EXAMPLES "Create and install the HTML examples (requires Doxygen)" TRUE) if(BUILD_EXAMPLES AND ${htmlpp_FOUND}) include_directories( ${CMAKE_INCLUDE_DIRECTORIES} ${CMAKE_SOURCE_DIR}/src ${systempp_INCLUDE_DIRS} ${htmlpp_INCLUDE_DIRS} ) add_executable (httpcon httpcon.cpp) target_link_libraries(httpcon httppp-static htmlpp::htmlpp-static) target_link_libraries(httpcon httppp-static netplus::netplus-static htmlpp::htmlpp-static) add_executable (httpform httpform.cpp) target_link_libraries(httpform httppp-static htmlpp::htmlpp-static) target_link_libraries(httpform httppp-static netplus::netplus-static htmlpp::htmlpp-static) add_executable (httpsysinfo httpsysinfo.cpp) target_link_libraries(httpsysinfo httppp-static htmlpp::htmlpp-static) target_link_libraries(httpsysinfo httppp-static netplus::netplus-static htmlpp::htmlpp-static) add_executable (httpcookie httpcookie.cpp) target_link_libraries(httpcookie httppp-static htmlpp::htmlpp-static) target_link_libraries(httpcookie httppp-static netplus::netplus-static htmlpp::htmlpp-static) add_executable (httpauth httpauth.cpp) target_link_libraries(httpauth httppp-static htmlpp::htmlpp-static) target_link_libraries(httpauth httppp-static netplus::netplus-static htmlpp::htmlpp-static) add_executable (httpproxy httpproxy.cpp) target_link_libraries(httpproxy httppp-static htmlpp::htmlpp-static) target_link_libraries(httpproxy httppp-static netplus::netplus-static) add_executable (httphello httphello.cpp) target_link_libraries(httphello httppp-static htmlpp::htmlpp-static) target_link_libraries(httphello httppp-static netplus::netplus-static) endif() add_executable (httpclient httpclient.cpp) Loading examples/httpclient.cpp +11 −6 Original line number Diff line number Diff line Loading @@ -80,9 +80,11 @@ size_t readchunk(const char *data,size_t datasize,size_t &pos){ } int main(int argc, char** argv){ #ifndef Windows signal(SIGPIPE, SIG_IGN); #endif netplus::tcp cltsock; netplus::tcp srvsock(argv[1],atoi(argv[2]),1,0); netplus::tcp srvsock(argv[1],(SOCKET)atoi(argv[2]),1,0); try{ srvsock.connect(&cltsock); Loading @@ -101,14 +103,14 @@ int main(int argc, char** argv){ return -1; } char data[16384]; char *data = new char[16384]; size_t recv=srvsock.recvData(&cltsock,data,16384); std::string html; libhttppp::HttpResponse res; size_t len=recv,chunklen=0,hsize=0; bool chunked=false; int rlen=0; long long rlen=0; hsize=res.parse(data,recv); Loading @@ -122,15 +124,15 @@ int main(int argc, char** argv){ } }catch(...){ chunked=false; rlen=res.getContentLength(); rlen=(long)res.getContentLength(); }; if(!chunked){ do{ html.append(data+hsize,recv-hsize); rlen-=recv-hsize; rlen-=((long)recv-hsize); if(rlen>0){ recv=srvsock.recvData(&cltsock,data,16384); recv=(long)srvsock.recvData(&cltsock,data,16384); hsize=0; } }while(rlen>0); Loading @@ -147,6 +149,9 @@ int main(int argc, char** argv){ } }while((chunklen=readchunk(data,recv,cpos))>0); } delete[] data; std::cout << html << std::endl; return 0; }catch(netplus::NetException &exp){ Loading Loading
CMakeLists.txt +8 −5 Original line number Diff line number Diff line project(libhttppp) cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.26) enable_testing () set(LIBV "1.0.0") Loading @@ -7,21 +7,24 @@ set(Upstream_VERSION 1.0.0) set (BLOCKSIZE 16384 CACHE STRING "Block size from Network Packages") set (DEFAULT_UPLOADSIZE 4e+6 CACHE STRING "Block size from Network Packages") include(CheckIncludeFileCXX) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) find_package(libnetplus REQUIRED) find_package(libcmdplus REQUIRED) find_package(MbedTLS REQUIRED) find_package(htmlpp) SET(CMAKE_CXX_FLAGS "-fPIC -Wall") include(CheckIncludeFileCXX) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/) configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${NETPLUS_INCLUDE_DIR} ${CMDPLUS_INCLUDE_DIR} ) add_subdirectory(doc) add_subdirectory(src) Loading
CMakeSettings.json +2 −4 Original line number Diff line number Diff line Loading @@ -9,8 +9,7 @@ "cmakeCommandArgs": "", "buildCommandArgs": "", "ctestCommandArgs": "", "inheritEnvironments": [ "msvc_x64_x64" ], "variables": [] "inheritEnvironments": [ "msvc_x64_x64" ] }, { "name": "x64-Release", Loading @@ -21,8 +20,7 @@ "cmakeCommandArgs": "", "buildCommandArgs": "", "ctestCommandArgs": "", "inheritEnvironments": [ "msvc_x64_x64" ], "variables": [] "inheritEnvironments": [ "msvc_x64_x64" ] } ] } No newline at end of file
config.h.in +3 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ #define DEFAULTCONNECTTRIES 5 #define ARCH_${CMAKE_SYSTEM_PROCESSOR} #define ${CMAKE_SYSTEM_NAME} #define DEFAULT_UPLOADSIZE ${DEFAULT_UPLOADSIZE}
examples/CMakeLists.txt +10 −11 Original line number Diff line number Diff line find_package(htmlpp COMPONENTS) find_package(htmlpp) option(BUILD_EXAMPLES "Create and install the HTML examples (requires Doxygen)" TRUE) if(BUILD_EXAMPLES AND ${htmlpp_FOUND}) include_directories( ${CMAKE_INCLUDE_DIRECTORIES} ${CMAKE_SOURCE_DIR}/src ${systempp_INCLUDE_DIRS} ${htmlpp_INCLUDE_DIRS} ) add_executable (httpcon httpcon.cpp) target_link_libraries(httpcon httppp-static htmlpp::htmlpp-static) target_link_libraries(httpcon httppp-static netplus::netplus-static htmlpp::htmlpp-static) add_executable (httpform httpform.cpp) target_link_libraries(httpform httppp-static htmlpp::htmlpp-static) target_link_libraries(httpform httppp-static netplus::netplus-static htmlpp::htmlpp-static) add_executable (httpsysinfo httpsysinfo.cpp) target_link_libraries(httpsysinfo httppp-static htmlpp::htmlpp-static) target_link_libraries(httpsysinfo httppp-static netplus::netplus-static htmlpp::htmlpp-static) add_executable (httpcookie httpcookie.cpp) target_link_libraries(httpcookie httppp-static htmlpp::htmlpp-static) target_link_libraries(httpcookie httppp-static netplus::netplus-static htmlpp::htmlpp-static) add_executable (httpauth httpauth.cpp) target_link_libraries(httpauth httppp-static htmlpp::htmlpp-static) target_link_libraries(httpauth httppp-static netplus::netplus-static htmlpp::htmlpp-static) add_executable (httpproxy httpproxy.cpp) target_link_libraries(httpproxy httppp-static htmlpp::htmlpp-static) target_link_libraries(httpproxy httppp-static netplus::netplus-static) add_executable (httphello httphello.cpp) target_link_libraries(httphello httppp-static htmlpp::htmlpp-static) target_link_libraries(httphello httppp-static netplus::netplus-static) endif() add_executable (httpclient httpclient.cpp) Loading
examples/httpclient.cpp +11 −6 Original line number Diff line number Diff line Loading @@ -80,9 +80,11 @@ size_t readchunk(const char *data,size_t datasize,size_t &pos){ } int main(int argc, char** argv){ #ifndef Windows signal(SIGPIPE, SIG_IGN); #endif netplus::tcp cltsock; netplus::tcp srvsock(argv[1],atoi(argv[2]),1,0); netplus::tcp srvsock(argv[1],(SOCKET)atoi(argv[2]),1,0); try{ srvsock.connect(&cltsock); Loading @@ -101,14 +103,14 @@ int main(int argc, char** argv){ return -1; } char data[16384]; char *data = new char[16384]; size_t recv=srvsock.recvData(&cltsock,data,16384); std::string html; libhttppp::HttpResponse res; size_t len=recv,chunklen=0,hsize=0; bool chunked=false; int rlen=0; long long rlen=0; hsize=res.parse(data,recv); Loading @@ -122,15 +124,15 @@ int main(int argc, char** argv){ } }catch(...){ chunked=false; rlen=res.getContentLength(); rlen=(long)res.getContentLength(); }; if(!chunked){ do{ html.append(data+hsize,recv-hsize); rlen-=recv-hsize; rlen-=((long)recv-hsize); if(rlen>0){ recv=srvsock.recvData(&cltsock,data,16384); recv=(long)srvsock.recvData(&cltsock,data,16384); hsize=0; } }while(rlen>0); Loading @@ -147,6 +149,9 @@ int main(int argc, char** argv){ } }while((chunklen=readchunk(data,recv,cpos))>0); } delete[] data; std::cout << html << std::endl; return 0; }catch(netplus::NetException &exp){ Loading