mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-08 16:04:46 +07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e6ded1f36 | ||
|
|
d663588491 | ||
|
|
439caf5b79 | ||
|
|
c4ba43ca6f | ||
|
|
20cba2ecd9 | ||
|
|
0ff2e16d69 | ||
|
|
51607ec752 | ||
|
|
7992b14896 | ||
|
|
7e420aeed3 | ||
|
|
227d2c2050 | ||
|
|
93e53c91f7 | ||
|
|
58cffd3223 | ||
|
|
8f32271e8c | ||
|
|
c8c1c3d376 | ||
|
|
9f512acb42 | ||
|
|
c0b461a3b7 | ||
|
|
74fe5a5029 | ||
|
|
9d0a9d4e23 | ||
|
|
5758769ad3 | ||
|
|
e7eadc3605 | ||
|
|
07c6e58951 | ||
|
|
87994811a1 | ||
|
|
42feb7e8be | ||
|
|
26196b70af | ||
|
|
93a51979c4 | ||
|
|
ad7edc7b27 | ||
|
|
27cd4e6ffe | ||
|
|
cae5a8be1c | ||
|
|
8e10d4e8e7 | ||
|
|
b57f79f438 | ||
|
|
a9cf097951 | ||
|
|
5c3624e1af | ||
|
|
cba9ef8c0b | ||
|
|
4f8407a3a7 | ||
|
|
656e936f49 | ||
|
|
d92c314466 | ||
|
|
b747fb111d | ||
|
|
7e0a0b2d0c | ||
|
|
362d064afa | ||
|
|
1bd88de2e5 | ||
|
|
0b541ffebc | ||
|
|
106be19c3e | ||
|
|
25d72bf881 | ||
|
|
9d5b5297cc | ||
|
|
462884bebb | ||
|
|
b1cc24b795 | ||
|
|
f0eb55b327 | ||
|
|
6dc285b5ca | ||
|
|
07e614eef7 | ||
|
|
916b2a8fd3 | ||
|
|
869f5bb279 | ||
|
|
3e21338f82 | ||
|
|
37bb3c6a77 | ||
|
|
d4ab2fa0e6 | ||
|
|
72d3f4896a |
+13
-14
@@ -8,6 +8,7 @@
|
|||||||
* HTTPLIB_USE_BROTLI_IF_AVAILABLE (default on)
|
* HTTPLIB_USE_BROTLI_IF_AVAILABLE (default on)
|
||||||
* HTTPLIB_REQUIRE_BROTLI (default off)
|
* HTTPLIB_REQUIRE_BROTLI (default off)
|
||||||
* HTTPLIB_COMPILE (default off)
|
* HTTPLIB_COMPILE (default off)
|
||||||
|
* HTTPLIB_TEST (default off)
|
||||||
* BROTLI_USE_STATIC_LIBS - tells Cmake to use the static Brotli libs (only works if you have them installed).
|
* BROTLI_USE_STATIC_LIBS - tells Cmake to use the static Brotli libs (only works if you have them installed).
|
||||||
* OPENSSL_USE_STATIC_LIBS - tells Cmake to use the static OpenSSL libs (only works if you have them installed).
|
* OPENSSL_USE_STATIC_LIBS - tells Cmake to use the static OpenSSL libs (only works if you have them installed).
|
||||||
|
|
||||||
@@ -88,7 +89,7 @@ option(HTTPLIB_COMPILE "If ON, uses a Python script to split the header into a c
|
|||||||
if(HTTPLIB_COMPILE)
|
if(HTTPLIB_COMPILE)
|
||||||
set(HTTPLIB_IS_COMPILED TRUE)
|
set(HTTPLIB_IS_COMPILED TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
option(HTTPLIB_TEST "Enables testing and builds tests" OFF)
|
||||||
option(HTTPLIB_REQUIRE_BROTLI "Requires Brotli to be found & linked, or fails build." OFF)
|
option(HTTPLIB_REQUIRE_BROTLI "Requires Brotli to be found & linked, or fails build." OFF)
|
||||||
option(HTTPLIB_USE_BROTLI_IF_AVAILABLE "Uses Brotli (if available) to enable Brotli decompression support." ON)
|
option(HTTPLIB_USE_BROTLI_IF_AVAILABLE "Uses Brotli (if available) to enable Brotli decompression support." ON)
|
||||||
# Defaults to static library
|
# Defaults to static library
|
||||||
@@ -176,7 +177,7 @@ if(HTTPLIB_COMPILE)
|
|||||||
set_target_properties(${PROJECT_NAME}
|
set_target_properties(${PROJECT_NAME}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
VERSION ${${PROJECT_NAME}_VERSION}
|
VERSION ${${PROJECT_NAME}_VERSION}
|
||||||
SOVERSION ${${PROJECT_NAME}_VERSION_MAJOR}
|
SOVERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}"
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
# This is for header-only.
|
# This is for header-only.
|
||||||
@@ -193,7 +194,7 @@ target_compile_features(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
|
|||||||
cxx_std_11
|
cxx_std_11
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
|
target_include_directories(${PROJECT_NAME} SYSTEM ${_INTERFACE_OR_PUBLIC}
|
||||||
$<BUILD_INTERFACE:${_httplib_build_includedir}>
|
$<BUILD_INTERFACE:${_httplib_build_includedir}>
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
)
|
)
|
||||||
@@ -221,15 +222,8 @@ target_compile_definitions(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
|
|||||||
$<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:CPPHTTPLIB_OPENSSL_SUPPORT>
|
$<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:CPPHTTPLIB_OPENSSL_SUPPORT>
|
||||||
)
|
)
|
||||||
|
|
||||||
# Cmake's find_package search path is different based on the system
|
# CMake configuration files installation directory
|
||||||
# See https://cmake.org/cmake/help/latest/command/find_package.html for the list
|
set(_TARGET_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
||||||
set(_TARGET_INSTALL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/cmake/${PROJECT_NAME}")
|
|
||||||
else()
|
|
||||||
# On Non-Windows, it should be /usr/lib/cmake/<name>/<name>Config.cmake
|
|
||||||
# NOTE: This may or may not work for macOS...
|
|
||||||
set(_TARGET_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
@@ -247,13 +241,13 @@ if(HTTPLIB_COMPILE)
|
|||||||
write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake"
|
write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake"
|
||||||
# Example: if you find_package(httplib 0.5.4)
|
# Example: if you find_package(httplib 0.5.4)
|
||||||
# then anything >= 0.5 and <= 1.0 is accepted
|
# then anything >= 0.5 and <= 1.0 is accepted
|
||||||
COMPATIBILITY SameMajorVersion
|
COMPATIBILITY SameMinorVersion
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake"
|
write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake"
|
||||||
# Example: if you find_package(httplib 0.5.4)
|
# Example: if you find_package(httplib 0.5.4)
|
||||||
# then anything >= 0.5 and <= 1.0 is accepted
|
# then anything >= 0.5 and <= 1.0 is accepted
|
||||||
COMPATIBILITY SameMajorVersion
|
COMPATIBILITY SameMinorVersion
|
||||||
# Tells Cmake that it's a header-only lib
|
# Tells Cmake that it's a header-only lib
|
||||||
# Mildly useful for end-users :)
|
# Mildly useful for end-users :)
|
||||||
ARCH_INDEPENDENT
|
ARCH_INDEPENDENT
|
||||||
@@ -285,3 +279,8 @@ install(EXPORT httplibTargets
|
|||||||
NAMESPACE ${PROJECT_NAME}::
|
NAMESPACE ${PROJECT_NAME}::
|
||||||
DESTINATION ${_TARGET_INSTALL_CMAKEDIR}
|
DESTINATION ${_TARGET_INSTALL_CMAKEDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(HTTPLIB_TEST)
|
||||||
|
include(CTest)
|
||||||
|
add_subdirectory(test)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ A C++11 single-file header-only cross platform HTTP/HTTPS library.
|
|||||||
|
|
||||||
It's extremely easy to setup. Just include the **httplib.h** file in your code!
|
It's extremely easy to setup. Just include the **httplib.h** file in your code!
|
||||||
|
|
||||||
NOTE: This is a multi-threaded 'blocking' HTTP library. If you are looking for a 'non-blocking' library, this is not the one that you want.
|
NOTE: This library uses 'blocking' socket I/O. If you are looking for a library with 'non-blocking' socket I/O, this is not the one that you want.
|
||||||
|
|
||||||
Simple examples
|
Simple examples
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
#### Server
|
#### Server (Multi-threaded)
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
@@ -65,6 +65,7 @@ httplib::SSLServer svr("./cert.pem", "./key.pem");
|
|||||||
// Client
|
// Client
|
||||||
httplib::Client cli("https://localhost:1234"); // scheme + host
|
httplib::Client cli("https://localhost:1234"); // scheme + host
|
||||||
httplib::SSLClient cli("localhost:1234"); // host
|
httplib::SSLClient cli("localhost:1234"); // host
|
||||||
|
httplib::SSLClient cli("localhost", 1234); // host, port
|
||||||
|
|
||||||
// Use your CA bundle
|
// Use your CA bundle
|
||||||
cli.set_ca_cert_path("./ca-bundle.crt");
|
cli.set_ca_cert_path("./ca-bundle.crt");
|
||||||
@@ -212,15 +213,23 @@ svr.set_error_handler([](const auto& req, auto& res) {
|
|||||||
The exception handler gets called if a user routing handler throws an error.
|
The exception handler gets called if a user routing handler throws an error.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
svr.set_exception_handler([](const auto& req, auto& res, std::exception &e) {
|
svr.set_exception_handler([](const auto& req, auto& res, std::exception_ptr ep) {
|
||||||
res.status = 500;
|
|
||||||
auto fmt = "<h1>Error 500</h1><p>%s</p>";
|
auto fmt = "<h1>Error 500</h1><p>%s</p>";
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
snprintf(buf, sizeof(buf), fmt, e.what());
|
try {
|
||||||
|
std::rethrow_exception(ep);
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
snprintf(buf, sizeof(buf), fmt, e.what());
|
||||||
|
} catch (...) { // See the following NOTE
|
||||||
|
snprintf(buf, sizeof(buf), fmt, "Unknown Exception");
|
||||||
|
}
|
||||||
res.set_content(buf, "text/html");
|
res.set_content(buf, "text/html");
|
||||||
|
res.status = 500;
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
NOTE: if you don't provide the `catch (...)` block for a rethrown exception pointer, an uncaught exception will end up causing the server crash. Be careful!
|
||||||
|
|
||||||
### Pre routing handler
|
### Pre routing handler
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
@@ -435,7 +444,7 @@ int main(void)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto err = res.error();
|
auto err = res.error();
|
||||||
...
|
std::cout << "HTTP error: " << httplib::to_string(err) << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -468,7 +477,9 @@ enum Error {
|
|||||||
SSLConnection,
|
SSLConnection,
|
||||||
SSLLoadingCerts,
|
SSLLoadingCerts,
|
||||||
SSLServerVerification,
|
SSLServerVerification,
|
||||||
UnsupportedMultipartBoundaryChars
|
UnsupportedMultipartBoundaryChars,
|
||||||
|
Compression,
|
||||||
|
ConnectionTimeout,
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -482,6 +493,10 @@ auto res = cli.Get("/hi", headers);
|
|||||||
```
|
```
|
||||||
or
|
or
|
||||||
```c++
|
```c++
|
||||||
|
auto res = cli.Get("/hi", {{"Accept-Encoding", "gzip, deflate"}});
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```c++
|
||||||
cli.set_default_headers({
|
cli.set_default_headers({
|
||||||
{ "Accept-Encoding", "gzip, deflate" }
|
{ "Accept-Encoding", "gzip, deflate" }
|
||||||
});
|
});
|
||||||
@@ -799,12 +814,12 @@ Include `httplib.h` before `Windows.h` or include `Windows.h` by defining `WIN32
|
|||||||
|
|
||||||
Note: cpp-httplib officially supports only the latest Visual Studio. It might work with former versions of Visual Studio, but I can no longer verify it. Pull requests are always welcome for the older versions of Visual Studio unless they break the C++11 conformance.
|
Note: cpp-httplib officially supports only the latest Visual Studio. It might work with former versions of Visual Studio, but I can no longer verify it. Pull requests are always welcome for the older versions of Visual Studio unless they break the C++11 conformance.
|
||||||
|
|
||||||
Note: Windows 8 or lower and Cygwin on Windows are not supported.
|
Note: Windows 8 or lower, Visual Studio 2013 or lower, and Cygwin on Windows are not supported.
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
MIT license (© 2021 Yuji Hirose)
|
MIT license (© 2022 Yuji Hirose)
|
||||||
|
|
||||||
Special Thanks To
|
Special Thanks To
|
||||||
-----------------
|
-----------------
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ public:
|
|||||||
unique_lock<mutex> lk(m_);
|
unique_lock<mutex> lk(m_);
|
||||||
int id = id_;
|
int id = id_;
|
||||||
cv_.wait(lk, [&] { return cid_ == id; });
|
cv_.wait(lk, [&] { return cid_ == id; });
|
||||||
if (sink->is_writable()) { sink->write(message_.data(), message_.size()); }
|
sink->write(message_.data(), message_.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_event(const string &message) {
|
void send_event(const string &message) {
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
#/usr/bin/env bash
|
#/usr/bin/env bash
|
||||||
for i in {1..10000}
|
for i in {1..1000000}
|
||||||
do
|
do
|
||||||
echo "#### $i ####"
|
echo "#### $i ####"
|
||||||
curl -X POST -F image_file=@$1 http://localhost:1234/post > /dev/null
|
curl -X POST -F image_file=@$1 http://localhost:1234/post > /dev/null
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ if get_option('cpp-httplib_compile')
|
|||||||
dependencies: deps,
|
dependencies: deps,
|
||||||
cpp_args: args,
|
cpp_args: args,
|
||||||
version: version,
|
version: version,
|
||||||
|
soversion: version.split('.')[0] + '.' + version.split('.')[1],
|
||||||
install: true
|
install: true
|
||||||
)
|
)
|
||||||
cpp_httplib_dep = declare_dependency(compile_args: args, dependencies: deps, link_with: lib, sources: httplib_ch[1])
|
cpp_httplib_dep = declare_dependency(compile_args: args, dependencies: deps, link_with: lib, sources: httplib_ch[1])
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
cmake_policy(SET CMP0135 NEW)
|
||||||
|
|
||||||
|
include(FetchContent)
|
||||||
|
include(GoogleTest)
|
||||||
|
|
||||||
|
set(BUILD_GMOCK OFF)
|
||||||
|
set(INSTALL_GTEST OFF)
|
||||||
|
set(gtest_force_shared_crt ON)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
gtest
|
||||||
|
URL https://github.com/google/googletest/archive/main.tar.gz
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(gtest)
|
||||||
|
|
||||||
|
add_executable(httplib-test test.cc)
|
||||||
|
target_compile_options(httplib-test PRIVATE "$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||||
|
target_link_libraries(httplib-test PRIVATE httplib GTest::gtest_main)
|
||||||
|
gtest_discover_tests(httplib-test)
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_LIST_DIR}/www www
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_LIST_DIR}/www2 www2
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_LIST_DIR}/www3 www3
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_LIST_DIR}/ca-bundle.crt ca-bundle.crt
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_LIST_DIR}/image.jpg image.jpg
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMAND_ERROR_IS_FATAL ANY
|
||||||
|
)
|
||||||
|
|
||||||
|
if(HTTPLIB_IS_USING_OPENSSL)
|
||||||
|
find_program(OPENSSL_COMMAND
|
||||||
|
NAMES openssl
|
||||||
|
PATHS ${OPENSSL_INCLUDE_DIR}/../bin
|
||||||
|
REQUIRED
|
||||||
|
)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${OPENSSL_COMMAND} genrsa 2048
|
||||||
|
OUTPUT_FILE key.pem
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMAND_ERROR_IS_FATAL ANY
|
||||||
|
)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${OPENSSL_COMMAND} req -new -batch -config ${CMAKE_CURRENT_LIST_DIR}/test.conf -key key.pem
|
||||||
|
COMMAND ${OPENSSL_COMMAND} x509 -days 3650 -req -signkey key.pem
|
||||||
|
OUTPUT_FILE cert.pem
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMAND_ERROR_IS_FATAL ANY
|
||||||
|
)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${OPENSSL_COMMAND} req -x509 -new -config ${CMAKE_CURRENT_LIST_DIR}/test.conf -key key.pem -sha256 -days 3650 -nodes -out cert2.pem -extensions SAN
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMAND_ERROR_IS_FATAL ANY
|
||||||
|
)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${OPENSSL_COMMAND} genrsa 2048
|
||||||
|
OUTPUT_FILE rootCA.key.pem
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMAND_ERROR_IS_FATAL ANY
|
||||||
|
)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${OPENSSL_COMMAND} req -x509 -new -batch -config ${CMAKE_CURRENT_LIST_DIR}/test.rootCA.conf -key rootCA.key.pem -days 1024
|
||||||
|
OUTPUT_FILE rootCA.cert.pem
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMAND_ERROR_IS_FATAL ANY
|
||||||
|
)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${OPENSSL_COMMAND} genrsa 2048
|
||||||
|
OUTPUT_FILE client.key.pem
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMAND_ERROR_IS_FATAL ANY
|
||||||
|
)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${OPENSSL_COMMAND} req -new -batch -config ${CMAKE_CURRENT_LIST_DIR}/test.conf -key client.key.pem
|
||||||
|
COMMAND ${OPENSSL_COMMAND} x509 -days 370 -req -CA rootCA.cert.pem -CAkey rootCA.key.pem -CAcreateserial
|
||||||
|
OUTPUT_FILE client.cert.pem
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMAND_ERROR_IS_FATAL ANY
|
||||||
|
)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${OPENSSL_COMMAND} genrsa -passout pass:test123! 2048
|
||||||
|
OUTPUT_FILE key_encrypted.pem
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMAND_ERROR_IS_FATAL ANY
|
||||||
|
)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${OPENSSL_COMMAND} req -new -batch -config ${CMAKE_CURRENT_LIST_DIR}/test.conf -key key_encrypted.pem
|
||||||
|
COMMAND ${OPENSSL_COMMAND} x509 -days 3650 -req -signkey key_encrypted.pem
|
||||||
|
OUTPUT_FILE cert_encrypted.pem
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMAND_ERROR_IS_FATAL ANY
|
||||||
|
)
|
||||||
|
endif()
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -22,8 +22,6 @@ public:
|
|||||||
|
|
||||||
ssize_t write(const std::string &s) { return write(s.data(), s.size()); }
|
ssize_t write(const std::string &s) { return write(s.data(), s.size()); }
|
||||||
|
|
||||||
std::string get_remote_addr() const { return ""; }
|
|
||||||
|
|
||||||
bool is_readable() const override { return true; }
|
bool is_readable() const override { return true; }
|
||||||
|
|
||||||
bool is_writable() const override { return true; }
|
bool is_writable() const override { return true; }
|
||||||
@@ -33,6 +31,11 @@ public:
|
|||||||
port = 8080;
|
port = 8080;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void get_local_ip_and_port(std::string &ip, int &port) const override {
|
||||||
|
ip = "127.0.0.1";
|
||||||
|
port = 8080;
|
||||||
|
}
|
||||||
|
|
||||||
socket_t socket() const override { return 0; }
|
socket_t socket() const override { return 0; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
+825
-20
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user