Open mishra-b opened 5 years ago
This question is interesting me also.
yes it does support HTTPS server there are examples..
Hi Have a problem with http_listener class if implemenetd the below way.
uri_builder uri(L"http://localhost:8023/");
auto addr = uri.to_string();
http_listener listener(addr);
try
{
listener.open().then([&listener](){TRACE(L"\nstarting to listen\n"); }).wait();
//while (true);
}
catch (exception const & e)
{
wcout << e.what() << endl;
}
std::string line;
std::wcout << U("Hit Enter to close the listener.");
std::getline(std::cin, line);
listener.close().wait();
as per the above code the code should block after calling listener open.wait(), but the control just fall through and the above code exits as it goes out of scope. if i add the while(true) the execution blocks and the server listens. but the issue is it eats up all the CPU. I also tried putting the while(true) inside the lambda, but still the same CPU occupied.
1) is this the way wait() should behave on listener open(). 2) is there any other way apart from while(true) to block scope loose.
Any answers will be appreciated
@coolsabby7 What I do is create a condition and have it wait on it. At least with my server, there will be no code that issues a notify to the condition.
std::mutex mutex;
std::condition_variable cond;
std::unique_lock<std::mutex> mlock(mutex);
while (1) {
cond.wait(mlock);
}
Does this library support HTTPS server on Linux and windows and also is IPv6 supported & how to implement that?