Boost logo

Boost Users :

From: Kurata Sayuri (magicalsayuri_at_[hidden])
Date: 2008-05-18 12:16:17


I want to use asio::ssl over the http proxy.
sample code:

----
io_service i;
tcp::socket t( i );
ssl::context c( i, ssl::context::sslv3_client );
ssl::stream<tcp::socket&> s( t, c );
tcp::resolver r( i );
tcp::resolver::query q( "proxy.example.com", "3128" );
t.connect( *r.resolve( q ) );
write( t, buffer( "CONNECT www.example.com:443 HTTP/1.0\r\n\r\n" ) );
asio::streambuf res;
read_until( t, res, "\r\n\r\n" );
cout << &res; // => "HTTP/1.0 200 Connection established\r\n\r\n"
error_code e;
s.handshake( ssl::stream_base::client, e );
if( e ){
  cout << "handshake() failed: " << e.message() << endl;
  // e.message() => "End of file"
  return 1;
}
write( s, buffer( "GET / HTTP/1.0\r\n\r\n" ) );
while( read( s, res, transfer_at_least(1), e ) )
  cout << &res;
----
The http proxy returns correct response. But handshake() failed.
What should I do?

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net