Boost asio async_read_some

I'm having difficulty implementing a simple TCP server. Below is the code from boost :: asio examples , "Http Server 1", to be exact.

void connection::start() {
    socket_.async_read_some(
            boost::asio::buffer(buffer_),
            boost::bind(
                &connection::handle_read, shared_from_this(),
                boost::asio::placeholders::error,
                boost::asio::placeholders::bytes_transferred
            )
        );
}
void connection::handle_read(const boost::system::error_code& e, std::size_t bytes_transferred) {
        if (!e && bytes_transferred)    {
                std::cout << " " << bytes_transferred <<"b" << std::endl;
                data_.append(buffer_.data(), buffer_.data()+bytes_transferred);

                //(1) what here?                
                socket_.async_read_some(
                    boost::asio::buffer(buffer_), 
                    boost::bind(
                        &connection::handle_read, shared_from_this(),
                        boost::asio::placeholders::error,
                        boost::asio::placeholders::bytes_transferred
                    )
                ); 

            }
            else// if (e != boost::asio::error::operation_aborted)
            {
                std::cout << data_ << std::endl;
                connection_manager_.stop(shared_from_this());
            }
        }

The source code buffer_is large enough to save the entire request. This is not what I need. I resized to 32 bytes.

The server compiles and listens on port 80 of the local host, so I'm trying to connect to it through my web browser.

Now, if statement (1) is commented out, only the first 32 bytes of the request are read and the connection freezes. The web browser continues to wait for a response, the server does. I do not know what.

(1) , ( data_), - , else { } stdout.

1: ?
2: ( )?
3:. , ? HTTP , - , , (, , "200 OK" )?

+5
1

, 1360 , asio, , , 32 . , , 32 . , (1), ( , , , ), , , io_service::run !!

(1), , , , ... , , , , , asio, , ( ), , , , , , .!!

, , , - : HTTP , , , . \r\n\r\n, , , , , .

+9

All Articles