Added custom response stream and possibility to flush response to clients synchronously and asynchronously. Various speed ups, including reduced use of regex and preprocessing of regex objects. boost::asio::ip::tcp::no_delay is now turned on for both Client and Server. Note: Not backward compatible with earlier versions.

This commit is contained in:
eidheim 2015-02-20 11:14:39 +01:00
commit a6154c7c5b
8 changed files with 331 additions and 168 deletions

View file

@ -28,13 +28,16 @@ namespace SimpleWeb {
void accept() {
//Create new socket for this connection
//Shared_ptr is used to pass temporary objects to the asynchronous functions
std::shared_ptr<HTTPS> socket(new HTTPS(m_io_service, context));
std::shared_ptr<HTTPS> socket(new HTTPS(io_service, context));
acceptor.async_accept((*socket).lowest_layer(), [this, socket](const boost::system::error_code& ec) {
//Immediately start accepting a new connection
accept();
if(!ec) {
boost::asio::ip::tcp::no_delay option(true);
socket->lowest_layer().set_option(option);
//Set timeout on the following boost::asio::ssl::stream::async_handshake
std::shared_ptr<boost::asio::deadline_timer> timer;
if(timeout_request>0)