pike.git / lib / modules / Protocols.pmod / HTTP.pmod / Server.pmod / SSLPort.pike

version» Context lines:

pike.git/lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/SSLPort.pike:22:   //! @param _portno   //! The port number to bind to, defaults to 443.   //! @param _interface   //! The interface address to bind to.   //! @param key   //! An optional SSL secret key, provided in binary format, such   //! as that created by @[Standards.PKCS.RSA.private_key()].   //! @param certificate   //! An optional SSL certificate or chain of certificates with the host   //! certificate first, provided in binary format. + //! @param share + //! If true, the connection will be shared if possible. See + //! @[Stdio.Port.bind] for more information   void create(function(Request:void) _callback,    void|int _portno, -  void|string _interface, void|string key, -  void|string|array(string) certificate) +  void|string _interface, +  void|string|Crypto.Sign.State key, +  void|string|array(string) certificate, +  void|int share)   {    portno=_portno;    if (!portno) portno=443; // default HTTPS port       callback=_callback;    interface=_interface;       port=MySSLPort(); -  port->set_default_keycert(); +     if( key && certificate ) -  port->add_cert( key, certificate ); +  { +  if( stringp(certificate) ) +  certificate = ({ certificate }); +  port->ctx->add_cert( key, certificate ); +  } +  else +  port->set_default_keycert();    -  if (!port->bind(portno,new_connection,[string]interface)) +  if (!port->bind(portno,new_connection,[string]interface,share))    error("HTTP.Server.SSLPort: failed to bind port %s%d: %s\n",    interface?interface+":":"",    portno,strerror(port->errno()));   }      //! Closes the HTTP port.   void close()   {    destruct(port);    port=0;
pike.git/lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/SSLPort.pike:104:    string c = Standards.X509.make_selfsigned_certificate(private_key,    3600*24*365, a);       ctx->add_cert( private_key, ({ c }) );    }    }          // ---- Remove this?    -  private Crypto.Sign tmp_key; +  private string tmp_key;    private array(string) tmp_cert;       //! @deprecated add_cert    __deprecated__ void set_key(string skey)    { -  tmp_key = Standards.PKCS.RSA.parse_private_key(skey) || -  Standards.PKCS.DSA.parse_private_key(skey) || - #if constant(Crypto.ECC.Curve) -  Standards.PKCS.ECDSA.parse_private_key(skey) || - #endif -  0; +  tmp_key = skey;    if( tmp_key && tmp_cert )    ctx->add_cert( tmp_key, tmp_cert );    }       //! @deprecated add_cert    __deprecated__ void set_certificate(string|array(string) certificate)    {    if(arrayp(certificate))    tmp_cert = [array(string)]certificate;    else    tmp_cert = ({ [string]certificate });    if( tmp_key && tmp_cert )    ctx->add_cert( tmp_key, tmp_cert );    }   }      protected string _sprintf(int t) {    return t=='O' && sprintf("%O(%O:%d)", this_program, interface, portno);   }