Simple-Web-Server icon indicating copy to clipboard operation
Simple-Web-Server copied to clipboard

on_error was triggered with no error message

Open manageryzy opened this issue 8 years ago • 4 comments

server.on_error = [](std::shared_ptr<HttpServer::Request> request, const boost::system::error_code& e)
{
	std::cout << "Error:" << std::endl << e.message() << std::endl << e.category().name() << std::endl ;
	return; 
};

this would output "Error:" with no error message sometimes

manageryzy avatar Jun 20 '17 10:06 manageryzy

If there is no message, on_error could be called either here: https://github.com/eidheim/Simple-Web-Server/blob/master/server_http.hpp#L342 or here: https://github.com/eidheim/Simple-Web-Server/blob/master/server_http.hpp#L476.

eidheim avatar Jun 20 '17 12:06 eidheim

  asio::async_read_until(*socket, request->streambuf, "\r\n\r\n",
                     [this, socket, request, timer](const error_code& ec, size_t bytes_transferred)

in void read_request_and_content(const std::shared_ptr<socket_type> &socket) got ec true

if I try to print e.message, the console will not output anything more.

compiler: ICC 17 IDE: vs2015 boost: 1.62.0

manageryzy avatar Jun 20 '17 14:06 manageryzy

What error code type are you getting? Might be that not all error code types have messages, although that is a bit strange. It might also be an boost asio issue on Windows I'm thinking.

eidheim avatar Jun 20 '17 17:06 eidheim

m_val = 0x400f7ea0 m_cat = 0x00000001400f7ea0 {NetNew.exe!std::_Func_impl<std::decay<lambda [] type at line 508171, col. 20>::type, std::allocator, void, std::shared_ptr<SimpleWeb::ServerBaseSimpleWeb::HTTP::Request>, const SimpleWeb::error_code &>::Move(void *)} {...} boost::noncopyable::noncopyable = {...}

maybe this a bug of boost asio

manageryzy avatar Jun 21 '17 01:06 manageryzy