Merge branch 'davidgfnet-testfixes'
This commit is contained in:
commit
3b3f358b15
@ -1516,9 +1516,10 @@ inline void Server::stop()
|
|||||||
{
|
{
|
||||||
if (is_running_) {
|
if (is_running_) {
|
||||||
assert(svr_sock_ != INVALID_SOCKET);
|
assert(svr_sock_ != INVALID_SOCKET);
|
||||||
detail::shutdown_socket(svr_sock_);
|
auto sock = svr_sock_;
|
||||||
detail::close_socket(svr_sock_);
|
|
||||||
svr_sock_ = INVALID_SOCKET;
|
svr_sock_ = INVALID_SOCKET;
|
||||||
|
detail::shutdown_socket(sock);
|
||||||
|
detail::close_socket(sock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,19 +2,19 @@
|
|||||||
CC = clang++
|
CC = clang++
|
||||||
#CC = g++
|
#CC = g++
|
||||||
|
|
||||||
CFLAGS = -O0 -std=c++11 -DGTEST_USE_OWN_TR1_TUPLE -I.. -I. -Wall -Wextra
|
CFLAGS = -ggdb -O0 -std=c++11 -DGTEST_USE_OWN_TR1_TUPLE -I.. -I. -Wall -Wextra
|
||||||
OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -lssl -lcrypto
|
OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -lssl -lcrypto
|
||||||
ZLIB_SUPPORT = -DCPPHTTPLIB_ZLIB_SUPPORT -lz
|
ZLIB_SUPPORT = -DCPPHTTPLIB_ZLIB_SUPPORT -lz
|
||||||
|
|
||||||
all : test
|
all : test
|
||||||
./test
|
./test
|
||||||
|
|
||||||
test : test.cc ../httplib.h Makefile
|
test : test.cc ../httplib.h Makefile cert.pem
|
||||||
$(CC) -o test $(CFLAGS) test.cc gtest/gtest-all.cc gtest/gtest_main.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) -lpthread
|
$(CC) -o test $(CFLAGS) test.cc gtest/gtest-all.cc gtest/gtest_main.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) -lpthread
|
||||||
|
|
||||||
pem:
|
cert.pem:
|
||||||
openssl genrsa 2048 > key.pem
|
openssl genrsa 2048 > key.pem
|
||||||
openssl req -new -key key.pem | openssl x509 -days 3650 -req -signkey key.pem > cert.pem
|
openssl req -new -batch -config test.conf -key key.pem | openssl x509 -days 3650 -req -signkey key.pem > cert.pem
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm test *.pem
|
rm -f test *.pem
|
||||||
|
@ -363,7 +363,7 @@ protected:
|
|||||||
persons_["john"] = "programmer";
|
persons_["john"] = "programmer";
|
||||||
|
|
||||||
t_ = thread([&](){
|
t_ = thread([&](){
|
||||||
svr_.listen(HOST, PORT);
|
ASSERT_TRUE(svr_.listen(HOST, PORT));
|
||||||
});
|
});
|
||||||
|
|
||||||
while (!svr_.is_running()) {
|
while (!svr_.is_running()) {
|
||||||
@ -890,7 +890,7 @@ protected:
|
|||||||
});
|
});
|
||||||
|
|
||||||
t_ = thread([&]() {
|
t_ = thread([&]() {
|
||||||
svr_.listen(nullptr, PORT, AI_PASSIVE);
|
ASSERT_TRUE(svr_.listen(nullptr, PORT, AI_PASSIVE));
|
||||||
});
|
});
|
||||||
|
|
||||||
while (!svr_.is_running()) {
|
while (!svr_.is_running()) {
|
||||||
@ -932,7 +932,7 @@ protected:
|
|||||||
t_ = thread([&](){
|
t_ = thread([&](){
|
||||||
svr_.bind_to_any_port(HOST);
|
svr_.bind_to_any_port(HOST);
|
||||||
msleep(500);
|
msleep(500);
|
||||||
svr_.listen_after_bind();
|
ASSERT_TRUE(svr_.listen_after_bind());
|
||||||
});
|
});
|
||||||
|
|
||||||
while (!svr_.is_running()) {
|
while (!svr_.is_running()) {
|
||||||
|
18
test/test.conf
Normal file
18
test/test.conf
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
[req]
|
||||||
|
default_bits = 2048
|
||||||
|
distinguished_name = req_distinguished_name
|
||||||
|
attributes = req_attributes
|
||||||
|
prompt = no
|
||||||
|
output_password = mypass
|
||||||
|
|
||||||
|
[req_distinguished_name]
|
||||||
|
C = US
|
||||||
|
ST = Test State or Province
|
||||||
|
L = Test Locality
|
||||||
|
O = Organization Name
|
||||||
|
OU = Organizational Unit Name
|
||||||
|
CN = Common Name
|
||||||
|
emailAddress = test@email.address
|
||||||
|
|
||||||
|
[req_attributes]
|
||||||
|
challengePassword = 1234
|
Loading…
x
Reference in New Issue
Block a user