cpprestsdk
cpprestsdk copied to clipboard
It is not possible to recreate a listener with the same uri and a different protocol
The scenario:
- Create and open two listeners on different ports with the http protocol.
- Close and delete one of them.
- Re-create and open the same listener, but with https protocol.
The result: An exception is thrown std::invalid_argument with the message : "Error: http_listener can not simultaneously listen both http and https paths of one host". But if initially there were not two listeners but one, then everything would work correctly.
The analysis:
http_linux_server has a map std::map<std::string, std::unique_ptr<hostport_listener>, iequal_to> m_listeners, where new hostport_listener are added with the host+port key in the pplx::task
Here I offered my solution.
I have attached a file with an example example.txt.