/*! @file

    @id $Id$
*/
//       1         2         3         4         5         6         7         8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890

//#define OPENSSL_LOG(X)
#include <openssl.hxx>
#include <iostream>

int main(int argc, char** argv) try {
  openssl::Init init;
  std::string host(argc>1?argv[1]:"swisssign.com");
  std::string port(argc>2?argv[2]:"80");
  std::cout<<"Library-Version: "<<pcsc::version()<<std::endl;
  std::cout<<"Connect to: "<<host<<':'<<port<<std::endl;
  openssl::TCP ssl(host+':'+port);
  ssl<<"GET / HTTP/1.1\x0D\x0AHost: "<<host
     <<"\x0D\x0A\x43onnection: Close\x0D\x0A\x0D\x0A";
  while (ssl) std::cout<<ssl;
  return 0;
 } catch (const std::exception& x) {
  std::cerr<<"**** ERROR: "<<x.what()<<std::endl;
  return 1;
 }
