
When I tried to use pion-net with the ssl flag turned on, response.receive [last line] fails with error code "asio.ssl:1". The code snippet below illustrates what I am trying to do. If I turned off the ssl flag, everything works fine without SSL. I compiled pion with --with-openssl pointing to the right directory. With the ssl flag on and capturing network data with wireshark, I can see a connection's made with the server, but the protocol seems to be incorrect. The data, however, seems to be encrypted or at least mangled because I can't see the usual HTTP traffic. I never see pion sending out an SSL "Client Hello" packet, and subsequently key exchange never happens. I was wondering if anyone's seen this issue before. Any help will be very much appreciated.
Code snippet:
boost::system::error_code error_code;
boost::shared_ptr tcp_conn(new pion::net::TCPConnection(scheduler.getIOService(), true));
error_code = tcp_conn->connect("reisz.quantee.com", 443);
tcp_conn->setLifecycle(pion::net::TCPConnection::LIFECYCLE_KEEPALIVE);
pion::net::HTTPRequest request("/");
request.setContentType(pion::net::HTTPTypes::CONTENT_TYPE_HTML);
request.setMethod("GET");
request.setVersionMajor(1);
request.setVersionMinor(1);
request.addHeader("Host", "reisz.quantee.com");
request.addHeader("User-Agent", "test");
request.send(*tcp_conn, error_code);
if (!error_code)
{
pion::net::HTTPResponse response(request);
response.receive(*tcp_conn, error_code);
}

You have to perform the SSL handshake after establishing a TCP connection.
Try adding this:
error_code = tcp_conn->handshake_client();
after this:
error_code = tcp_conn->connect("reisz.quantee.com", 443);
- Login or register to post comments
Submitted by Mike Dickey on Tue, 12/01/2009 - 09:45.