Boost logo

Boost :

Subject: [boost] [asio] HTTPS async_read() question
From: Gregory Dai (gregory.dai_at_[hidden])
Date: 2008-10-22 15:20:57


I'm playing with the following SSL client example against an https site:

http://www.boost.org/doc/libs/1_36_0/doc/html/boost_asio/example/ssl/client.cpp

I replaced

std::cout << "Enter message: "

with the part of the URL corresponding to an HTTP GET request, and changed
the

handle_read()

to

  void handle_read(const boost::system::error_code& error,
      size_t bytes_transferred)
  {
    if (!error)
    {
      std::cout << "Reply: ";
      std::cout.write(reply_, bytes_transferred);
      std::cout << "\n";

      boost::asio::async_read(socket_,
          boost::asio::buffer(reply_, bytes_transferred),
          boost::bind(&client::handle_read, this,
            boost::asio::placeholders::error,
            boost::asio::placeholders::bytes_transferred));
    }
    else
    {
      std::cout << "Read failed: " << error << "\n";
    }
  }

so that it goes back to read more data. I'm able to get more than 20k data
in response, but unable to reach the end of the data stream as the browser
can.

What could be a good reason for this behavior?

Thanks,
Greg


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk