pike.git / lib / modules / SSL.pmod / https.pike

version» Context lines:

pike.git/lib/modules/SSL.pmod/https.pike:9: Inside #if defined(SSL3_DEBUG)
     #ifdef SSL3_DEBUG   #define SSL3_DEBUG_MSG(X ...) werror(X)   #else /*! SSL3_DEBUG */   #define SSL3_DEBUG_MSG(X ...)   #endif /* SSL3_DEBUG */      import Stdio;      #ifndef HTTPS_CLIENT - inherit SSL.sslport; + SSL.sslport port;    - protected void create() - { -  SSL3_DEBUG_MSG("https->create\n"); -  sslport::create(); - } -  +    void my_accept_callback(object f)   {    werror("Accept!\n"); -  conn(accept()); +  conn(port->accept());   }   #endif      class conn {    import Stdio;       object sslfile;       string message =    "HTTP/1.0 200 Ok\r\n"
pike.git/lib/modules/SSL.pmod/https.pike:158: Inside #if defined(HTTPS_CLIENT)
  {   #ifdef HTTPS_CLIENT    Stdio.File con = Stdio.File();    if (!con->connect("127.0.0.1", PORT)) {    werror("Failed to connect to server: %s\n", strerror(con->errno()));    return 17;    }    client(con);    return -17;   #else +  SSL.context ctx = SSL.context(); +     Crypto.Sign key;    string certificate;       key = Crypto.RSA()->generate_key(1024);    certificate =    Standards.X509.make_selfsigned_certificate(key, 3600*4, ([    "organizationName" : "Test",    "commonName" : "*",    ]));    -  add_cert(key, ({ certificate }), ({ "*" })); +  ctx->add_cert(key, ({ certificate }), ({ "*" }));       key = Crypto.DSA()->generate_key(1024, 160);    certificate =    Standards.X509.make_selfsigned_certificate(key, 3600*4, ([    "organizationName" : "Test",    "commonName" : "*",    ])); -  add_cert(key, ({ certificate })); +  ctx->add_cert(key, ({ certificate }));      #if constant(Crypto.ECC.Curve)    key = Crypto.ECC.SECP_521R1.ECDSA()->generate_key();    certificate =    Standards.X509.make_selfsigned_certificate(key, 3600*4, ([    "organizationName" : "Test",    "commonName" : "*",    ])); -  add_cert(key, ({ certificate })); +  ctx->add_cert(key, ({ certificate }));   #endif       // Make sure all cipher suites are available. -  preferred_suites = get_suites(-1, 2); +  ctx->preferred_suites = ctx->get_suites(-1, 2);    SSL3_DEBUG_MSG("Cipher suites:\n%s", -  .Constants.fmt_cipher_suites(preferred_suites)); +  .Constants.fmt_cipher_suites(ctx->preferred_suites));    -  SSL3_DEBUG_MSG("Certs:\n%O\n", cert_pairs); +  SSL3_DEBUG_MSG("Certs:\n%O\n", ctx->cert_pairs);    -  random = no_random()->read; +  ctx->random = no_random()->read; +  +  port = SSL.sslport(ctx); +     werror("Starting\n"); -  if (!bind(PORT, my_accept_callback)) +  if (!port->bind(PORT, my_accept_callback))    {    perror("");    return 17;    }    else {    werror("Listening on port %d.\n", PORT);    return -17;    }   #endif   }